Oauthlib: Timing Attack Vulnerability in PKCE code_verifier Comparison (CWE-208) (CVE-2026-49265)
A timing side-channel vulnerability exists in oauthlib's PKCE implementation for the Authorization Code Grant flow. The vulnerable functions use Python's standard string equality operator instead of a constant-time comparison, enabling attackers to measure timing differences and potentially recover the code_verifier. This flaw affects oauthlib versions from 3.0.0 up to but not including 4.0.0. Although practical exploitation is limited due to network noise and the single-use nature of authorization codes, the vulnerability poses a risk of account takeover if exploited. A patch is available that replaces the vulnerable comparison with a constant-time function.
AI Analysis
Technical Summary
Oauthlib versions >=3.0.0 <4.0.0 contain a timing side-channel vulnerability (CWE-208) in the PKCE code_verifier comparison within the Authorization Code Grant flow. The functions code_challenge_method_plain and code_challenge_method_s256 use Python's '==' operator for string comparison, which short-circuits on the first mismatch and leaks timing information proportional to the length of the matching prefix. This timing discrepancy can be exploited by an attacker who intercepts an authorization code and repeatedly sends token requests, measuring response times to recover the code_verifier character by character. The vulnerability is mitigated by replacing '==' with hmac.compare_digest(), a constant-time comparison function. The CVSS v3.1 score is 6.8 (medium severity) with network attack vector, high attack complexity, no privileges required, user interaction required, and high confidentiality and integrity impact.
Potential Impact
Successful exploitation allows an attacker to recover the PKCE code_verifier via timing analysis, potentially leading to access token theft and account takeover. However, practical exploitation is constrained by the single-use nature of authorization codes and real-world network noise, limiting the feasibility of the attack in typical environments.
Mitigation Recommendations
A patch is available that replaces the vulnerable string comparison with a constant-time comparison using hmac.compare_digest(). Users of oauthlib versions >=3.0.0 <4.0.0 should upgrade to a fixed version. No additional mitigations are indicated as the vulnerability is addressed by this fix.
Oauthlib: Timing Attack Vulnerability in PKCE code_verifier Comparison (CWE-208) (CVE-2026-49265)
Description
A timing side-channel vulnerability exists in oauthlib's PKCE implementation for the Authorization Code Grant flow. The vulnerable functions use Python's standard string equality operator instead of a constant-time comparison, enabling attackers to measure timing differences and potentially recover the code_verifier. This flaw affects oauthlib versions from 3.0.0 up to but not including 4.0.0. Although practical exploitation is limited due to network noise and the single-use nature of authorization codes, the vulnerability poses a risk of account takeover if exploited. A patch is available that replaces the vulnerable comparison with a constant-time function.
CVSS v3.1
Score 6.8medium
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Oauthlib versions >=3.0.0 <4.0.0 contain a timing side-channel vulnerability (CWE-208) in the PKCE code_verifier comparison within the Authorization Code Grant flow. The functions code_challenge_method_plain and code_challenge_method_s256 use Python's '==' operator for string comparison, which short-circuits on the first mismatch and leaks timing information proportional to the length of the matching prefix. This timing discrepancy can be exploited by an attacker who intercepts an authorization code and repeatedly sends token requests, measuring response times to recover the code_verifier character by character. The vulnerability is mitigated by replacing '==' with hmac.compare_digest(), a constant-time comparison function. The CVSS v3.1 score is 6.8 (medium severity) with network attack vector, high attack complexity, no privileges required, user interaction required, and high confidentiality and integrity impact.
Potential Impact
Successful exploitation allows an attacker to recover the PKCE code_verifier via timing analysis, potentially leading to access token theft and account takeover. However, practical exploitation is constrained by the single-use nature of authorization codes and real-world network noise, limiting the feasibility of the attack in typical environments.
Mitigation Recommendations
A patch is available that replaces the vulnerable string comparison with a constant-time comparison using hmac.compare_digest(). Users of oauthlib versions >=3.0.0 <4.0.0 should upgrade to a fixed version. No additional mitigations are indicated as the vulnerability is addressed by this fix.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-xpv3-w29h-x7cv
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-49265"]
- Ecosystems
- ["PyPI"]
- Database Specific Severity
- MODERATE
- Cvss Version
- 3.1
Threat ID: 6abc27d2680226ef6846f932
Added to database: 09/29/2026, 21:04:18 UTC
Last enriched: 09/29/2026, 21:23:00 UTC
Last updated: 09/30/2026, 03:12:09 UTC
Views: 5
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.