CVE-2022-31090: Guzzlehttp/guzzle CURLOPT_HTTPAUTH Option Not Cleared On Vulnerability

HIGH
Advisory Identifier: GHSA-25mq-v84q-4j7r
CVSS 7.7
CWE-212 CWE-200
Published
Advisory Summary

CVE-2022-31090 is a HIGH (CVSS 7.7) curlopt_httpauth option not cleared on vulnerability (CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer) affecting Guzzlehttp/guzzle libraries in the Packagist ecosystem. The issue involves curlopt_httpauth option not cleared on change of origin. Remediation is available by upgrading affected packages to version 6.5.8, 7.4.5.

CVE-2022-31090 at a Glance

CVE Identifier CVE-2022-31090
GHSA Identifier GHSA-25mq-v84q-4j7r
Severity HIGH
CVSS v3.1 Base Score 7.7
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.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-31090

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-31090, 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-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. When using our Curl handler, it is possible to use the `CURLOPT_HTTPAUTH` option to specify an `Authorization` header. On making a request which responds with a redirect to a URI with a different origin, if we choose to follow it, we should remove the `CURLOPT_HTTPAUTH` and `CURLOPT_USERPWD` options before continuing, stopping curl from appending the `Authorization` header to the new request. Previously, we would only consider a change in host. 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. Note that a partial fix was implemented in Guzzle 7.4.2, where a change in host would trigger removal of the curl-added Authorization header, however this earlier fix did not cover change in scheme or change in port. ### Workarounds If you do not require or expect redirects to be followed, one should simply disable redirects all together. Alternatively, one can specify to use the Guzzle stream handler backend, rather than curl. ### 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-31090 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-31090?
CVE-2022-31090 is a security vulnerability in Guzzlehttp/guzzle involving CURLOPT_HTTPAUTH option not cleared on change of origin 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.8, 7.4.5 across affected packages: guzzlehttp/guzzle.
What version fixes CVE-2022-31090?
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-31090?
CVE-2022-31090 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-31090?
CVE-2022-31090 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-31090?
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-25mq-v84q-4j7r",
  "modified" : "2022-07-12T21:58:38Z",
  "published" : "2022-06-21T16:57:10Z",
  "aliases" : [ "CVE-2022-31090" ],
  "summary" : "CURLOPT_HTTPAUTH option not cleared on change of origin",
  "details" : "### Impact\n\n`Authorization` headers on requests are sensitive information. When using our Curl handler, it is possible to use the `CURLOPT_HTTPAUTH` option to specify an `Authorization` header. On making a request which responds with a redirect to a URI with a different origin, if we choose to follow it, we should remove the `CURLOPT_HTTPAUTH` and `CURLOPT_USERPWD` options before continuing, stopping curl from appending the `Authorization` header to the new request. Previously, we would only consider a change in host. 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. Note that a partial fix was implemented in Guzzle 7.4.2, where a change in host would trigger removal of the curl-added Authorization header, however this earlier fix did not cover change in scheme or change in port.\n\n### Workarounds\n\nIf you do not require or expect redirects to be followed, one should simply disable redirects all together. Alternatively, one can specify to use the Guzzle stream handler backend, rather than curl.\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-25mq-v84q-4j7r"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31090"
  }, {
    "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-31090.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/guzzle/guzzle"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/guzzle/guzzle/blob/6.5.8/CHANGELOG.md"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/guzzle/guzzle/blob/7.4.5/CHANGELOG.md"
  }, {
    "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", "CWE-212" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-21T16:57:10Z",
    "nvd_published_at" : "2022-06-27T22:15:00Z"
  }
}