Skip to main content

Oauthlib: Timing Attack Vulnerability in PKCE code_verifier Comparison (CWE-208) (CVE-2026-49265)

0
Medium
Published: 09/29/2026 (09/29/2026, 17:56:31 UTC)
Source: GCVE Database
Product: oauthlib

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

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N

Affected software

PyPIghsa
oauthlib
Affected versions
>=3.0.0 <4.0.0

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 09/29/2026, 21:23:00 UTC

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.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

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 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

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

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses