CVE-2022-29248: Guzzlehttp/guzzle Cross-domain Cookie Leakage Vulnerability

HIGH
Advisory Identifier: GHSA-cwmx-hcrq-mhc3
CVSS 8.0
CWE-565 CWE-200
Published
Advisory Summary

CVE-2022-29248 is a HIGH (CVSS 8.0) cross-domain cookie leakage vulnerability (CWE-565: Reliance on Cookies without Validation and Integrity Checking) affecting Guzzlehttp/guzzle libraries in the Packagist ecosystem. The issue involves cross-domain cookie leakage in guzzle. Remediation is available by upgrading affected packages to version 6.5.6, 7.4.3.

CVE-2022-29248 at a Glance

CVE Identifier CVE-2022-29248
GHSA Identifier GHSA-cwmx-hcrq-mhc3
Severity HIGH
CVSS v3.1 Base Score 8.0
CWE Classification CWE-565: Reliance on Cookies without Validation and Integrity Checking
Affected Product Guzzlehttp/guzzle
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2022-29248

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.

guzzlehttp/guzzle fixed: 6.5.6
Upgrade guzzlehttp/guzzle to 6.5.6
guzzlehttp/guzzle fixed: 7.4.3
Upgrade guzzlehttp/guzzle to 7.4.3
Verify Direct and Transitive Dependencies

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-29248, 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.6), 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-565: Reliance on Cookies without Validation and Integrity Checking, where the product relies on the existence or values of cookies when performing security-critical operations, but it does not properly ensure that the setting is valid for the associated user. 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

### Impact Previous version of Guzzle contain a vulnerability with the cookie middleware. The vulnerability is that it is not checked if the cookie domain equals the domain of the server which sets the cookie via the `Set-Cookie` header, allowing a malicious server to set cookies for unrelated domains. For example an attacker at `www.example.com` might set a session cookie for `api.example.net`, logging the Guzzle client into their account and retrieving private API requests from the security log of their account. Note that our cookie middleware is disabled by default, so most library consumers will not be affected by this issue. Only those who manually add the cookie middleware to the handler stack or construct the client with `['cookies' => true]` are affected. Moreover, those who do not use the same Guzzle client to call multiple domains and have disabled redirect forwarding are not affected by this vulnerability. ### Patches Affected Guzzle 7 users should upgrade to Guzzle 7.4.3 as soon as possible. Affected users using any earlier series of Guzzle should upgrade to Guzzle 6.5.6 or 7.4.3. ### Workarounds If you do not need support for cookies, turn off the cookie middleware. It is already off by default, but if you have turned it on and no longer need it, turn it off. ### References * [RFC6265 Section 5.3](https://datatracker.ietf.org/doc/html/rfc6265#section-5.3) * [RFC9110 Section 15.4](https://www.rfc-editor.org/rfc/rfc9110.html#name-redirection-3xx) ### 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](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).

CVE-2022-29248 Affected Guzzlehttp/guzzle Versions

2 component(s)
Fixed Versions:
6.5.67.4.3
Product / Package Ecosystem Affected Versions Fixed Version
guzzlehttp/guzzle
Packagist
< 6.5.6
6.5.6
guzzlehttp/guzzle
Packagist
≥ 7.0.0
< 7.4.3
7.4.3

References

Frequently Asked Questions

What is CVE-2022-29248?
CVE-2022-29248 is a security vulnerability in Guzzlehttp/guzzle involving Cross-domain cookie leakage in Guzzle under CWE-565: Reliance on Cookies without Validation and Integrity Checking.
Which Guzzlehttp/guzzle versions are affected?
Affected versions include releases prior to 6.5.6, 7.4.3 across affected packages: guzzlehttp/guzzle.
What version fixes CVE-2022-29248?
Upgrading to 6.5.6, 7.4.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is guzzlehttp/guzzle affected?
Yes, guzzlehttp/guzzle is affected in releases prior to 6.5.6, 7.4.3. Upgrade your dependency to 6.5.6, 7.4.3 or later.
What is the CVSS score of CVE-2022-29248?
CVE-2022-29248 has a CVSS v3.1 base score of 8.0 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2022-29248?
CVE-2022-29248 is classified under CWE-565: Reliance on Cookies without Validation and Integrity Checking (The product relies on the existence or values of cookies when performing security-critical operations, but it does not properly ensure that the setting is valid for the associated user.).
How can I check Packagist dependencies for CVE-2022-29248?
Run the dependency tree command: 'inspect dependencies for guzzlehttp/guzzle'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-cwmx-hcrq-mhc3",
  "modified" : "2022-06-20T22:02:17Z",
  "published" : "2022-05-25T18:09:55Z",
  "aliases" : [ "CVE-2022-29248" ],
  "summary" : "Cross-domain cookie leakage in Guzzle",
  "details" : "### Impact\n\nPrevious version of Guzzle contain a vulnerability with the cookie middleware. The vulnerability is that it is not checked if the cookie domain equals the domain of the server which sets the cookie via the `Set-Cookie` header, allowing a malicious server to set cookies for unrelated domains. For example an attacker at `www.example.com` might set a session cookie for `api.example.net`, logging the Guzzle client into their account and retrieving private API requests from the security log of their account.\n\nNote that our cookie middleware is disabled by default, so most library consumers will not be affected by this issue. Only those who manually add the cookie middleware to the handler stack or construct the client with `['cookies' => true]` are affected. Moreover, those who do not use the same Guzzle client to call multiple domains and have disabled redirect forwarding are not affected by this vulnerability.\n\n### Patches\n\nAffected Guzzle 7 users should upgrade to Guzzle 7.4.3 as soon as possible. Affected users using any earlier series of Guzzle should upgrade to Guzzle 6.5.6 or 7.4.3.\n\n### Workarounds\n\nIf you do not need support for cookies, turn off the cookie middleware. It is already off by default, but if you have turned it on and no longer need it, turn it off.\n\n### References\n\n* [RFC6265 Section 5.3](https://datatracker.ietf.org/doc/html/rfc6265#section-5.3)\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:H/PR:N/UI:R/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "guzzlehttp/guzzle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.5.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "guzzlehttp/guzzle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.4.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/guzzle/guzzle/security/advisories/GHSA-cwmx-hcrq-mhc3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-29248"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/guzzle/guzzle/pull/3018"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/guzzle/guzzle/commit/74a8602c6faec9ef74b7a9391ac82c5e65b1cdab"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/guzzlehttp/guzzle/CVE-2022-29248.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-010"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-565" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-05-25T18:09:55Z",
    "nvd_published_at" : "2022-05-25T18:15:00Z"
  }
}