CVE-2022-31043: Guzzlehttp/guzzle Fix Failure To Strip Authorization Vulnerability

HIGH
Advisory Identifier: GHSA-w248-ffj2-4v5q
CVSS 7.5
CWE-212 CWE-200 CWE-863
Published
Advisory Summary

CVE-2022-31043 is a HIGH (CVSS 7.5) fix failure to strip authorization vulnerability (CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer) affecting Guzzlehttp/guzzle libraries in the Packagist ecosystem. The issue involves fix failure to strip authorization header on http downgrade. Remediation is available by upgrading affected packages to version 6.5.7, 7.4.4.

CVE-2022-31043 at a Glance

CVE Identifier CVE-2022-31043
GHSA Identifier GHSA-w248-ffj2-4v5q
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer
Affected Product Guzzlehttp/guzzle
Package Ecosystem Packagist
Published Date
Last Updated

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).

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

How to Fix CVE-2022-31043

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.7
Upgrade guzzlehttp/guzzle to 6.5.7
guzzlehttp/guzzle fixed: 7.4.4
Upgrade guzzlehttp/guzzle to 7.4.4
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-31043, 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

### Impact `Authorization` 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, we should not forward the `Authorization` header on. This is much the same as to how we don't forward on the header if the host changes. Prior to this fix, `https` to `http` downgrades did not result in the `Authorization` header being removed, only changes to the host. ### 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](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-31043 Affected Guzzlehttp/guzzle Versions

2 component(s)
Fixed Versions:
6.5.77.4.4
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-31043?
CVE-2022-31043 is a security vulnerability in Guzzlehttp/guzzle involving Fix failure to strip Authorization header on HTTP downgrade under CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer.
Which Guzzlehttp/guzzle versions are affected?
Affected versions include releases prior to 6.5.7, 7.4.4 across affected packages: guzzlehttp/guzzle.
What version fixes CVE-2022-31043?
Upgrading to 6.5.7, 7.4.4 (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.7, 7.4.4. Upgrade your dependency to 6.5.7, 7.4.4 or later.
What is the CVSS score of CVE-2022-31043?
CVE-2022-31043 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2022-31043?
CVE-2022-31043 is classified under CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer (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.).
How can I check Packagist dependencies for CVE-2022-31043?
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-w248-ffj2-4v5q",
  "modified" : "2022-06-20T21:59:37Z",
  "published" : "2022-06-09T23:47:23Z",
  "aliases" : [ "CVE-2022-31043" ],
  "summary" : "Fix failure to strip Authorization header on HTTP downgrade",
  "details" : "### Impact\n\n`Authorization` 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, we should not forward the `Authorization` header on. This is much the same as to how we don't forward on the header if the host changes. Prior to this fix, `https` to `http` downgrades did not result in the `Authorization` header being removed, only changes to the host.\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-w248-ffj2-4v5q"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31043"
  }, {
    "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-31043.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", "CWE-863" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-09T23:47:23Z",
    "nvd_published_at" : "2022-06-10T00:15:00Z"
  }
}