guzzlehttp/guzzle

CVE-2022-31042

CVE-2022-31042 is a high-severity security vulnerability in guzzlehttp/guzzle (composer), affecting versions >= 7.0.0, < 7.4.4. It is fixed in 7.4.4, 6.5.7.

Key facts
CVSS score
7.5
High
Attack vector
Network
Issuing authority
GitHub Advisory Database
Affected package
guzzlehttp/guzzle
Fixed in
7.4.4, 6.5.7
Disclosed
2022

Summary

Impact Cookie headers on requests are sensitive information. On making a request using the https scheme to a server which responds with a redirect to a URI with the http scheme, or on making a request to a server which responds with a redirect to a a URI to a different host, we should not forward the Cookie header on. Prior to this fix, only cookies that were managed by our cookie middleware would be safely removed, and any Cookie header manually added to the initial request would not be stripped. We now always strip it, and allow the cookie middleware to re-add any cookies that it deems should be there. Patches Affected Guzzle 7 users should upgrade to Guzzle 7.4.4 as soon as possible. Affected users using any earlier series of Guzzle should upgrade to Guzzle 6.5.7 or 7.4.4. Workarounds An alternative approach would be to use your own redirect middleware, rather than ours, if you are unable to upgrade. If you do not require or expect redirects to be followed, one should simply disable redirects all together. References RFC9110 Section 15.4 For more information If you have any questions or comments about this advisory, please get in touch with us in #guzzle on the PHP HTTP Slack. Do not report additional security advisories in that public channel, however - please follow our vulnerability reporting process.

Impact

Severity and exposure

CVE-2022-31042 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment.

A fixed version is available (7.4.4, 6.5.7). Upgrading removes the vulnerable code path.

Affected versions

composer

  • guzzlehttp/guzzle (>= 7.0.0, < 7.4.4)
  • guzzlehttp/guzzle (>= 4.0.0, < 6.5.7)

Security releases

  • guzzlehttp/guzzle → 7.4.4 (composer)
  • guzzlehttp/guzzle → 6.5.7 (composer)
Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter instead of chasing every advisory.

Kodem's runtime-powered SCA identifies whether CVE-2022-31042 is reachable in your applications. Explore open-source security for your team.

See if CVE-2022-31042 is reachable in your applications. Get a demo

Remediation advice

Upgrade the following packages to resolve this vulnerability:

  • Upgrade guzzlehttp/guzzle to 7.4.4 or later
  • Upgrade guzzlehttp/guzzle to 6.5.7 or later

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently asked questions about CVE-2022-31042

What is CVE-2022-31042?

CVE-2022-31042 is a high-severity security vulnerability in guzzlehttp/guzzle (composer), affecting versions >= 7.0.0, < 7.4.4. It is fixed in 7.4.4, 6.5.7.

How severe is CVE-2022-31042?

CVE-2022-31042 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.

Which versions of guzzlehttp/guzzle are affected by CVE-2022-31042?

guzzlehttp/guzzle (composer) versions >= 7.0.0, < 7.4.4 is affected.

Is there a fix for CVE-2022-31042?

Yes. CVE-2022-31042 is fixed in 7.4.4, 6.5.7. Upgrade to this version or later.

Is CVE-2022-31042 exploitable, and should I be worried?

Whether CVE-2022-31042 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo

What actually determines whether CVE-2022-31042 is exploitable, and how bad it is?

Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.

How do I fix CVE-2022-31042?
  • Upgrade guzzlehttp/guzzle to 7.4.4 or later
  • Upgrade guzzlehttp/guzzle to 6.5.7 or later

Stop the waste.
Protect your environment with Kodem.