CVE-2022-31042

7.5 HIGH

📋 TL;DR

Guzzle HTTP client versions before 6.5.7 and 7.4.4 expose sensitive cookie information during HTTP redirects. When a request to an HTTPS server redirects to HTTP or to a different host, manually added Cookie headers are improperly forwarded, potentially leaking session tokens or authentication cookies. This affects PHP applications using vulnerable Guzzle versions for HTTP requests.

💻 Affected Systems

Products:
  • Guzzle HTTP client
Versions: All versions before 6.5.7 and 7.x before 7.4.4
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability triggers when applications manually add Cookie headers and follow redirects to HTTP or different hosts.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers intercept sensitive cookies during redirects, leading to session hijacking, account takeover, or unauthorized access to user accounts and data.

🟠

Likely Case

Session cookies or authentication tokens are exposed when applications follow redirects to less secure HTTP endpoints or different domains, enabling credential theft.

🟢

If Mitigated

With proper network segmentation and monitoring, exposure is limited to internal traffic, reducing external attack surface.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires control over redirect targets or ability to intercept traffic, but the vulnerability itself is straightforward.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Guzzle 6.5.7 or 7.4.4

Vendor Advisory: https://github.com/guzzle/guzzle/security/advisories/GHSA-f2wf-25xc-69c9

Restart Required: No

Instructions:

1. Update Guzzle via Composer: 'composer require guzzlehttp/guzzle:^6.5.7' or 'composer require guzzlehttp/guzzle:^7.4.4'. 2. Run 'composer update'. 3. Test application functionality.

🔧 Temporary Workarounds

Disable redirects

all

Prevent Guzzle from following redirects entirely

$client = new \GuzzleHttp\Client(['allow_redirects' => false]);

Custom redirect middleware

all

Implement custom redirect handling to strip Cookie headers manually

🧯 If You Can't Patch

  • Implement network monitoring for suspicious redirect patterns
  • Use application firewalls to block redirects to HTTP or external domains

🔍 How to Verify

Check if Vulnerable:

Check composer.json or run 'composer show guzzlehttp/guzzle' to see installed version

Check Version:

composer show guzzlehttp/guzzle | grep versions

Verify Fix Applied:

Confirm version is 6.5.7+ or 7.4.4+ and test redirect scenarios

📡 Detection & Monitoring

Log Indicators:

  • Unusual redirect patterns in application logs
  • Requests to HTTP endpoints after HTTPS origins

Network Indicators:

  • Cookie headers in HTTP traffic after HTTPS redirects
  • Cross-domain redirects with preserved cookies

SIEM Query:

source="application.logs" AND "redirect" AND ("http://" OR "different-host")

🔗 References

📤 Share & Export