CVE-2022-31091: Guzzlehttp/guzzle Change Vulnerability

HIGH
Advisory Identifier: GHSA-q559-8m2m-g699
CVSS 7.7
CWE-200
Published
Advisory Summary

CVE-2022-31091 is a HIGH (CVSS 7.7) change vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Guzzlehttp/guzzle libraries in the Packagist ecosystem. The issue involves change in port should be considered a change in origin. Remediation is available by upgrading affected packages to version 6.5.8, 7.4.5.

CVE-2022-31091 at a Glance

CVE Identifier CVE-2022-31091
GHSA Identifier GHSA-q559-8m2m-g699
Severity HIGH
CVSS v3.1 Base Score 7.7
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Guzzlehttp/guzzle
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 7.7

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

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

How to Fix CVE-2022-31091

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.8
Upgrade guzzlehttp/guzzle to 6.5.8
guzzlehttp/guzzle fixed: 7.4.5
Upgrade guzzlehttp/guzzle to 7.4.5
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-31091, 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.8), 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-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. 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 `Authorization` and `Cookie` headers on requests are sensitive information. On making a request which responds with a redirect to a URI with a different port, if we choose to follow it, we should remove the `Authorization` and `Cookie` headers from the request, before containing. Previously, we would only consider a change in host or scheme downgrade. Now, we consider any change in host, port or scheme to be a change in origin. ### Patches Affected Guzzle 7 users should upgrade to Guzzle 7.4.5 as soon as possible. Affected users using any earlier series of Guzzle should upgrade to Guzzle 6.5.8 or 7.4.5. ### 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](https://www.rfc-editor.org/rfc/rfc9110.html#name-redirection-3xx) * [CVE-2022-27776](https://curl.se/docs/CVE-2022-27776.html) ### 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-31091 Affected Guzzlehttp/guzzle Versions

2 component(s)
Fixed Versions:
6.5.87.4.5
Product / Package Ecosystem Affected Versions Fixed Version
guzzlehttp/guzzle
Packagist
< 6.5.8
6.5.8
guzzlehttp/guzzle
Packagist
≥ 7.0.0
< 7.4.5
7.4.5

References

Frequently Asked Questions

What is CVE-2022-31091?
CVE-2022-31091 is a security vulnerability in Guzzlehttp/guzzle involving Change in port should be considered a change in origin under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Guzzlehttp/guzzle versions are affected?
Affected versions include releases prior to 6.5.8, 7.4.5 across affected packages: guzzlehttp/guzzle.
What version fixes CVE-2022-31091?
Upgrading to 6.5.8, 7.4.5 (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.8, 7.4.5. Upgrade your dependency to 6.5.8, 7.4.5 or later.
What is the CVSS score of CVE-2022-31091?
CVE-2022-31091 has a CVSS v3.1 base score of 7.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2022-31091?
CVE-2022-31091 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check Packagist dependencies for CVE-2022-31091?
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-q559-8m2m-g699",
  "modified" : "2022-12-03T04:02:32Z",
  "published" : "2022-06-21T20:07:16Z",
  "aliases" : [ "CVE-2022-31091" ],
  "summary" : "Change in port should be considered a change in origin",
  "details" : "### Impact\n\n`Authorization` and `Cookie` headers on requests are sensitive information. On making a request which responds with a redirect to a URI with a different port, if we choose to follow it, we should remove the `Authorization` and `Cookie` headers from the request, before containing. Previously, we would only consider a change in host or scheme downgrade. Now, we consider any change in host, port or scheme to be a change in origin.\n\n### Patches\n\nAffected Guzzle 7 users should upgrade to Guzzle 7.4.5 as soon as possible. Affected users using any earlier series of Guzzle should upgrade to Guzzle 6.5.8 or 7.4.5.\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* [CVE-2022-27776](https://curl.se/docs/CVE-2022-27776.html)\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:L/UI:N/S:C/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "guzzlehttp/guzzle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.5.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "guzzlehttp/guzzle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.4.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/guzzle/guzzle/security/advisories/GHSA-q559-8m2m-g699"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31091"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/guzzle/guzzle/commit/1dd98b0564cb3f6bd16ce683cb755f94c10fbd82"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/guzzlehttp/guzzle/CVE-2022-31091.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/guzzle/guzzle"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/202305-24"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2022/dsa-5246"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-21T20:07:16Z",
    "nvd_published_at" : "2022-06-27T22:15:00Z"
  }
}