Skip to main content

CVE-2022-21712: CWE-200: Exposure of Sensitive Information to an Unauthorized Actor in twisted twisted

Medium
Published: Mon Feb 07 2022 (02/07/2022, 00:00:00 UTC)
Source: CVE
Vendor/Project: twisted
Product: twisted

Description

twisted is an event-driven networking engine written in Python. In affected versions twisted exposes cookies and authorization headers when following cross-origin redirects. This issue is present in the `twited.web.RedirectAgent` and `twisted.web. BrowserLikeRedirectAgent` functions. Users are advised to upgrade. There are no known workarounds.

AI-Powered Analysis

AILast updated: 06/23/2025, 17:18:55 UTC

Technical Analysis

CVE-2022-21712 is a medium-severity vulnerability affecting the Twisted framework, an event-driven networking engine implemented in Python widely used for asynchronous network programming. The vulnerability arises from the way Twisted's web client components, specifically the RedirectAgent and BrowserLikeRedirectAgent classes, handle HTTP redirects across different origins (cross-origin redirects). When these components follow a redirect to a different origin, they inadvertently expose sensitive information such as cookies and authorization headers to the redirected destination. This exposure violates the same-origin policy principles and can lead to unauthorized disclosure of sensitive session tokens or credentials. The affected versions include all Twisted releases from version 11.1.0 up to but not including 22.1.0. There are no known workarounds, and users are advised to upgrade to a fixed version. The vulnerability is classified under CWE-200, indicating exposure of sensitive information to unauthorized actors. Although there are no known exploits in the wild, the flaw presents a significant risk in environments where Twisted is used to make HTTP requests that involve redirects, especially when sensitive authentication data is involved. The issue is rooted in the improper handling of cross-origin redirects, which should not carry sensitive headers to prevent leakage to potentially malicious endpoints.

Potential Impact

For European organizations, the exposure of cookies and authorization headers through cross-origin redirects in Twisted can lead to unauthorized access to protected resources, session hijacking, and potential data breaches. Organizations using Twisted in web services, APIs, or internal tools that rely on HTTP redirects may inadvertently leak authentication tokens to untrusted third parties, compromising confidentiality and integrity of user sessions. This can affect sectors with high security requirements such as finance, healthcare, government, and critical infrastructure. The impact is heightened in environments where Twisted is integrated into microservices architectures or cloud-native applications that perform cross-origin HTTP requests. Additionally, the exposure could facilitate lateral movement within networks if attackers gain access to sensitive credentials. Although the vulnerability does not directly affect availability, the resulting breaches could lead to service disruptions or regulatory penalties under GDPR due to data leakage. The absence of known exploits suggests limited active targeting so far, but the ease of exploitation through crafted redirects means the threat could escalate if weaponized.

Mitigation Recommendations

To mitigate this vulnerability, European organizations should prioritize upgrading Twisted to version 22.1.0 or later where the issue is resolved. Since no workarounds exist, patching is the primary defense. Additionally, organizations should audit their use of Twisted's RedirectAgent and BrowserLikeRedirectAgent to identify any cross-origin redirect scenarios involving sensitive headers. Where possible, redesign HTTP client logic to avoid following cross-origin redirects or to explicitly strip sensitive headers before redirecting. Implement strict Content Security Policies (CSP) and HTTP header controls to limit exposure of cookies and authorization headers. Network-level controls such as web application firewalls (WAFs) can be tuned to detect and block suspicious redirect patterns. Logging and monitoring should be enhanced to detect anomalous redirect behavior or unauthorized access attempts. Finally, conduct security reviews of applications using Twisted to ensure that sensitive information is not unnecessarily transmitted during redirects and that authentication tokens are scoped with minimal privileges.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2021-11-16T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9842c4522896dcbf2460

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

Last enriched: 6/23/2025, 5:18:55 PM

Last updated: 7/31/2025, 12:08:12 PM

Views: 14

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