CVE-2022-31042: Guzzlehttp/guzzle Failure To Strip The Cookie Vulnerability
HIGHCVE-2022-31042 is a HIGH (CVSS 7.5) failure to strip the cookie vulnerability (CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer) affecting Guzzlehttp/guzzle libraries in the Packagist ecosystem. The issue involves failure to strip the cookie header on change in host or http downgrade. Remediation is available by upgrading affected packages to version 6.5.7, 7.4.4.
CVE-2022-31042 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2022-31042
To remediate this vulnerability, upgrade all affected Guzzlehttp/guzzle dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade guzzlehttp/guzzle to 6.5.7
Upgrade guzzlehttp/guzzle to 7.4.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for guzzlehttp/guzzle
How to Check if You Are Affected
To determine whether your application is affected by CVE-2022-31042, inspect your project dependencies for Guzzlehttp/guzzle:
inspect dependencies for guzzlehttp/guzzle
Analyze the terminal output to locate any version of Guzzlehttp/guzzle in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.5.7), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer, where the product stores, transfers, or shares a resource that contains sensitive information, but it does not properly remove that information before the product makes the resource available to unauthorized actors. In Guzzlehttp/guzzle, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-31042 Affected Guzzlehttp/guzzle Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
guzzlehttp/guzzle
|
Packagist |
≥ 4.0.0
< 6.5.7
|
6.5.7
|
|
guzzlehttp/guzzle
|
Packagist |
≥ 7.0.0
< 7.4.4
|
7.4.4
|
References
Frequently Asked Questions
What is CVE-2022-31042?
Which Guzzlehttp/guzzle versions are affected?
What version fixes CVE-2022-31042?
Is guzzlehttp/guzzle affected?
What is the CVSS score of CVE-2022-31042?
What CWE is associated with CVE-2022-31042?
How can I check Packagist dependencies for CVE-2022-31042?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-f2wf-25xc-69c9",
"modified" : "2022-06-20T21:56:53Z",
"published" : "2022-06-09T23:47:25Z",
"aliases" : [ "CVE-2022-31042" ],
"summary" : "Failure to strip the Cookie header on change in host or HTTP downgrade",
"details" : "### Impact\n\n`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.\n\n### Patches\n\nAffected 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.\n\n### Workarounds\n\nAn 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.\n\n### References\n\n* [RFC9110 Section 15.4](https://www.rfc-editor.org/rfc/rfc9110.html#name-redirection-3xx)\n\n### For more information\n\nIf you have any questions or comments about this advisory, please get in touch with us in `#guzzle` on the [PHP HTTP Slack](https://php-http.slack.com/). Do not report additional security advisories in that public channel, however - please follow our [vulnerability reporting process](https://github.com/guzzle/guzzle/security/policy).\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "guzzlehttp/guzzle"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "6.5.7"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "guzzlehttp/guzzle"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.0.0"
}, {
"fixed" : "7.4.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/guzzle/guzzle/security/advisories/GHSA-f2wf-25xc-69c9"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31042"
}, {
"type" : "WEB",
"url" : "https://github.com/guzzle/guzzle/commit/e3ff079b22820c2029d4c2a87796b6a0b8716ad8"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/guzzlehttp/guzzle/CVE-2022-31042.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/guzzle/guzzle"
}, {
"type" : "WEB",
"url" : "https://www.debian.org/security/2022/dsa-5246"
}, {
"type" : "WEB",
"url" : "https://www.drupal.org/sa-core-2022-011"
}, {
"type" : "WEB",
"url" : "https://www.rfc-editor.org/rfc/rfc9110.html#name-redirection-3xx"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200", "CWE-212" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-09T23:47:25Z",
"nvd_published_at" : "2022-06-10T00:15:00Z"
}
}