Tweepy
CVE-2012-5825
HIGH
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessGain man-in-the-middle network position
-
DeliveryIntercept Tweepy HTTPS to Twitter API
-
ExploitPresent arbitrary valid certificate
-
ExecutionClient skips hostname verification
-
ImpactDecrypt/alter traffic and steal OAuth tokens
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V2 - Validation and Business Logic Input validation, allowlisting
|
| Exploitation Conditions | Exploitation requires the attacker to occupy an active man-in-the-middle position on the network path between the Tweepy client and Twitter's servers (e.g., rogue/public Wi-Fi, ARP spoofing, DNS/gateway compromise) and to present any certificate that is valid (issued by a trusted CA) but for a different hostname. No special Tweepy configuration is needed - the missing hostname check is the default behavior of the vulnerable versions using Python's httplib, so any application using an affected Tweepy release over HTTPS is exposed. The key limiting factor is the AC:H requirement: without a network intercept position the flaw cannot be triggered, which is why real-world exploitation is localized/targeted rather than remote-from-anywhere despite AV:N. |
| Impact | This is a genuine but moderate-priority integrity/confidentiality issue whose CVSS 3.1 base score of 7.4 (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N) is driven by high confidentiality and integrity impact but tempered by AC:H, which correctly reflects that exploitation requires the attacker to first achieve a man-in-the-middle position on the network path between the Tweepy client and Twitter's servers. Multiple signals converge on 'real but not urgent': EPSS is only 0.15% (35th percentile), the flaw is NOT in CISA KEV (no confirmed active exploitation), yet POC/exploit material IS publicly available - the referenced http://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf is the well-known Georgiev/Shmatikov 'The Most Dangerous Code in the World' CCS 2012 paper documenting this exact class of non-browser SSL certificate-validation failure. The signals are internally consistent rather than conflicting: low EPSS + no KEV + academic-paper POC indicates a well-understood weakness that is demonstrable in research but not the subject of mass opportunistic exploitation, largely because it demands an active network position (rogue AP, ARP spoofing, compromised gateway). Treat this as a patch-in-normal-cadence dependency hygiene item, not an emergency; the primary risk is theft or tampering of Twitter API OAuth credentials/tokens transiting an attacker-controlled network. |
| Exploit ScenarioDerived | An attacker on the same network segment as a host running a Tweepy-based application (public Wi-Fi, compromised router, or ARP-spoofed LAN) intercepts the outbound HTTPS connection to the Twitter API and presents any valid-but-unrelated X.509 certificate. Because Tweepy (via Python httplib) never checks that the certificate's CN/subjectAltName matches the intended hostname, the client accepts the connection, letting the attacker decrypt, read, and modify API traffic including OAuth tokens. A conceptual POC and analysis exist in the referenced CCS 2012 academic paper, though this is not an off-the-shelf weaponized exploit. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Sep 17, 2026
Man-in-the-middle spoofing of Twitter's servers in Tweepy allows attackers to intercept and modify API communications because the library fails to verify the X.509 certificate hostname. Exploitation requires the attacker to occupy a network intercept position (AC:H), but any application using an affected Tweepy release over HTTPS is exposed, leading to high confidentiality and integrity impact. A public proof-of-concept exists, and the vendor has released a patch; EPSS is low at 0.15%.
RemediationAI
Upgrade Tweepy to a version that includes hostname verification for X.509 certificates. The vendor has released a patch; consult the vendor's security advisory for the exact fixed version. If immediate upgrade is not possible, consider using a Python version that performs hostname verification by default in its SSL module (e.g., Python 2.7.9+ or 3.4.3+), as this may mitigate the issue when Tweepy relies on the underlying library. However, this workaround may not cover all cases and requires testing. Alternatively, implement custom hostname verification in your application code before sending sensitive data, but this is error-prone. Finally, restrict Tweepy usage to trusted networks to reduce the risk of man-in-the-middle attacks, though this is not a complete mitigation. For additional details, refer to the X-Force entry (https://exchange.xforce.ibmcloud.com/vulnerabilities/79831) and the academic paper (http://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf).
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
CVE-2012-5825 affects the Tweepy Python library, specifically versions that rely on Python's httplib for HTTPS connections to the Twitter API. The vulnerability arises because Tweepy does not perform hostname verification on the server's X.509 certificate; it checks that the certificate is signed by a trusted CA but does not verify that the certificate's Common Name (CN) or subjectAltName matches the domain being accessed. This is categorized as CWE-20 (Improper Input Validation) because the library fails to validate the input (the certificate's hostname) against the expected value. The root cause is the lack of proper certificate validation in the underlying httplib usage, which was a common issue in older Python versions. As a result, an attacker with a man-in-the-middle position can present any valid certificate (e.g., for a domain they control) to spoof the Twitter server and intercept or modify sensitive API traffic. The CPE cpe:2.3:a:tweepy:tweepy:-:*:*:*:*:*:*:* indicates that all versions of Tweepy prior to the patch are potentially affected, as the CPE does not specify a version, but in practice the fix was applied in a later release.
Know when Tweepy gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
AC:H because a man-in-the-middle position must first be established; PR:N/UI:N as no auth or victim interaction is needed; C:H/I:H for full traffic read/tamper, A:N as availability is unaffected.
Primary rating from NVD.
CVSS VectorNVD
Lifecycle Timeline
4DescriptionNVD
Tweepy does not verify that the server hostname matches a domain name in the subject's Common Name (CN) or subjectAltName field of the X.509 certificate, which allows man-in-the-middle attackers to spoof SSL servers via an arbitrary valid certificate, related to use of the Python httplib library.
Executive ViewAI
Tweepy, a Python library used to integrate applications with Twitter's API, can allow an attacker positioned on the network to intercept or alter API communications in affected releases. This exposes organizations relying on affected applications to potential unauthorized access, data disclosure, or manipulation of Twitter API actions, and publicly available exploit code exists. Leadership should ensure affected applications are inventoried and patched promptly because the issue affects confidentiality and integrity of integrated social-media workflows.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
NVD
CVE.org
EPSS
VulDB
GitHub PoC
Exploit-DB