Skip to main content

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

Medium
Published: Wed May 25 2022 (05/25/2022, 00:00:00 UTC)
Source: CVE
Vendor/Project: guzzle
Product: guzzle

Description

Guzzle is a PHP HTTP client. Guzzle prior to versions 6.5.6 and 7.4.3 contains 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. The 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. Guzzle versions 6.5.6 and 7.4.3 contain a patch for this issue. As a workaround, turn off the cookie middleware.

AI-Powered Analysis

AILast updated: 06/23/2025, 07:51:45 UTC

Technical Analysis

CVE-2022-29248 is a vulnerability identified in the Guzzle PHP HTTP client library, specifically affecting versions prior to 6.5.6 and versions from 7.0.0 up to but not including 7.4.3. The vulnerability arises from improper validation in the cookie middleware component, which is responsible for handling HTTP cookies. Normally, when a server sets a cookie via the Set-Cookie header, the client should verify that the cookie's domain attribute matches the domain of the server that issued it. However, in the affected Guzzle versions, this domain check is missing. This flaw allows a malicious server to set cookies for unrelated domains, potentially leading to unauthorized exposure of sensitive information. The cookie middleware is disabled by default in Guzzle, so only users who explicitly enable it—either by adding the cookie middleware to the handler stack or by constructing the client with the ['cookies' => true] option—are vulnerable. Additionally, users who do not reuse the same Guzzle client instance to make requests across multiple domains or who have disabled redirect forwarding are not impacted by this vulnerability. The issue has been addressed in versions 6.5.6 and 7.4.3 by adding the necessary domain validation checks. As a temporary mitigation, disabling the cookie middleware prevents exploitation. No known exploits have been reported in the wild to date. This vulnerability is classified under CWE-200, indicating exposure of sensitive information to unauthorized actors due to improper access control in cookie handling.

Potential Impact

For European organizations, the impact of this vulnerability depends largely on their use of the Guzzle HTTP client with cookie middleware enabled. Organizations that develop or maintain PHP applications relying on Guzzle for HTTP requests and have enabled cookie handling are at risk of sensitive information leakage. Specifically, if a Guzzle client instance is reused across multiple domains, a malicious server could set cookies for unrelated domains, potentially exposing session tokens, authentication credentials, or other sensitive cookie data to unauthorized parties. This could lead to session hijacking, unauthorized access, or data leakage. The impact is heightened in multi-tenant or microservices environments where HTTP clients communicate with various domains using the same client instance. However, since the cookie middleware is disabled by default and the vulnerability requires specific client configurations, the overall exposure is limited. The absence of known exploits reduces immediate risk, but the vulnerability could be leveraged in targeted attacks against organizations with vulnerable configurations. European organizations handling sensitive data, such as financial institutions, healthcare providers, and government agencies, should be particularly cautious. Failure to address this vulnerability could result in breaches of confidentiality, regulatory non-compliance (e.g., GDPR), and reputational damage.

Mitigation Recommendations

1. Upgrade affected Guzzle versions to 6.5.6 or 7.4.3 or later, where the vulnerability is patched. 2. If immediate upgrade is not feasible, disable the cookie middleware by avoiding the ['cookies' => true] option or removing the cookie middleware from the handler stack. 3. Avoid reusing the same Guzzle client instance for requests across multiple domains, especially when cookie middleware is enabled. Instead, instantiate separate clients per domain to isolate cookie storage. 4. Disable redirect forwarding in Guzzle clients to prevent unintended cookie forwarding across domains. 5. Conduct a thorough audit of PHP applications using Guzzle to identify configurations enabling cookie middleware and assess exposure. 6. Implement strict input validation and monitoring on servers interacting with Guzzle clients to detect anomalous cookie behavior. 7. Educate development teams about secure usage patterns of HTTP clients and cookie handling best practices. 8. Monitor for updates from Guzzle and related security advisories to promptly apply patches.

Need more detailed analysis?Get Pro

Technical Details

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

Threat ID: 682d9843c4522896dcbf3061

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

Last enriched: 6/23/2025, 7:51:45 AM

Last updated: 8/7/2025, 7:48:23 AM

Views: 16

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