Skip to main content

CVE-2022-31090: CWE-200: Exposure of Sensitive Information to an Unauthorized Actor in guzzle guzzle

Medium
Published: Mon Jun 27 2022 (06/27/2022, 00:00:00 UTC)
Source: CVE
Vendor/Project: guzzle
Product: guzzle

Description

Guzzle, an extensible PHP HTTP client. `Authorization` headers on requests are sensitive information. In affected versions 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 (change in host, scheme or port), if we choose to follow it, we should remove the `CURLOPT_HTTPAUTH` option before continuing, stopping curl from appending the `Authorization` header to the new request. 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. 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 steam handler backend, rather than curl.

AI-Powered Analysis

AILast updated: 06/23/2025, 04:49:56 UTC

Technical Analysis

CVE-2022-31090 is a medium-severity vulnerability affecting Guzzle, a widely used extensible PHP HTTP client library. The vulnerability arises from improper handling of the `Authorization` header during HTTP redirects when using Guzzle's Curl handler. Specifically, when a request includes an `Authorization` header via the `CURLOPT_HTTPAUTH` option and the server responds with a redirect to a URI that changes the origin—defined as a change in host, scheme (e.g., HTTP to HTTPS), or port—Guzzle should remove the `Authorization` header before following the redirect. Failure to do so results in the sensitive `Authorization` header being sent to an unintended, potentially unauthorized third-party endpoint. This exposure can lead to unauthorized disclosure of credentials or tokens, compromising confidentiality. Affected versions include all Guzzle versions prior to 6.5.8 and versions from 7.0.0 up to but not including 7.4.5. A partial fix in version 7.4.2 addressed removal of the header only when the host changed, but did not cover changes in scheme or port, leaving the vulnerability partially open until 7.4.5. Users who do not require automatic redirect following can mitigate risk by disabling redirects entirely or by switching from the Curl handler to the Guzzle stream handler backend, which is not affected by this issue. This vulnerability is classified under CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor). While no known exploits have been reported in the wild, the risk remains significant due to the potential for credential leakage during redirects, especially in complex web environments where redirects are common. The vulnerability requires no user interaction but does require that the application uses the Curl handler with vulnerable versions of Guzzle and follows redirects across origins with sensitive authorization headers present.

Potential Impact

For European organizations, the impact of CVE-2022-31090 can be significant, especially for those relying on Guzzle in their PHP-based web applications or services that handle sensitive authentication tokens or credentials in HTTP headers. Exposure of `Authorization` headers to unintended endpoints can lead to unauthorized access to protected resources, data breaches, and potential lateral movement within networks. This is particularly critical for sectors handling sensitive personal data under GDPR, such as finance, healthcare, and government services, where unauthorized disclosure can result in regulatory penalties and reputational damage. Additionally, organizations using microservices architectures or API gateways that rely on Guzzle for HTTP client functionality may inadvertently expose credentials when redirects occur, increasing the attack surface. The vulnerability could also facilitate man-in-the-middle attacks if redirects lead to malicious endpoints, further compromising confidentiality and integrity.

Mitigation Recommendations

1. Upgrade Guzzle to version 7.4.5 or later, or to 6.5.8 or later if using the 6.x series, as these versions contain the complete fix for this vulnerability. 2. If upgrading is not immediately feasible, disable automatic redirect following in Guzzle by setting the `allow_redirects` option to false, preventing the client from sending authorization headers to redirected origins. 3. Alternatively, configure Guzzle to use the stream handler backend instead of the Curl handler, as the stream handler does not exhibit this vulnerability. 4. Review application code to audit usage of `Authorization` headers in HTTP requests, ensuring that sensitive headers are not sent to untrusted or external domains. 5. Implement strict validation and whitelisting of redirect URLs to prevent redirects to untrusted origins. 6. Monitor network traffic and logs for unexpected outbound requests containing authorization headers to unknown or suspicious endpoints. 7. Educate developers about secure handling of HTTP headers and the risks associated with automatic redirects involving sensitive information.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2022-05-18T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9844c4522896dcbf34b7

Added to database: 5/21/2025, 9:09:24 AM

Last enriched: 6/23/2025, 4:49:56 AM

Last updated: 8/13/2025, 1:59:27 AM

Views: 17

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats