Bug 2550336 (CVE-2026-49265) - CVE-2026-49265 oauthlib: oauthlib: Timing attack vulnerability in PKCE code_verifier/code_challenge comparison allows authorization code recovery
Summary: CVE-2026-49265 oauthlib: oauthlib: Timing attack vulnerability in PKCE code_v...
Keywords:
Status: NEW
Alias: CVE-2026-49265
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Product Security DevOps Team
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2026-10-13 09:58 UTC by OSIDB Bzimport
Modified: 2026-10-13 11:57 UTC (History)
125 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description OSIDB Bzimport 2026-10-13 09:58:51 UTC
A timing side-channel exists in oauthlib's PKCE (RFC 7636) verification, used by
`AuthorizationCodeGrant` to validate the `code_verifier` presented at the token
endpoint against the `code_challenge` stored at authorization time
(`oauthlib/oauth2/rfc6749/grant_types/authorization_code.py`):

    def code_challenge_method_plain(verifier, challenge):
        return verifier == challenge

    def code_challenge_method_s256(verifier, challenge):
        return base64.urlsafe_b64encode(
            hashlib.sha256(verifier.encode()).digest()
        ).decode().rstrip('=') == challenge

Both comparisons use Python's `==` operator, which short-circuits on the first
mismatching byte. Response timing therefore leaks the length of the correct prefix
of an attacker-supplied verifier, giving a remote timing oracle that can in principle
be used to recover a valid `code_verifier` character-by-character via repeated
requests to the token endpoint.

Attack scenario:
1. Attacker intercepts a victim's `authorization_code` (e.g. via custom URI scheme
   hijacking on a public/native OAuth client), but does not know the `code_verifier`.
2. Attacker repeatedly submits token requests with guessed `code_verifier` values,
   measuring response latency to infer correct-prefix length at each position.
3. Having recovered a verifier that matches the stored challenge, the attacker
   exchanges the authorization code for an access token, impersonating the victim.

Practical exploitability is constrained: it requires high-precision timing
measurement over the network (noise needs to be largely eliminated), repeated
requests against the same still-valid authorization code, and a vulnerable
client/server deployment that doesn't invalidate the code after a failed exchange
attempt. These constraints are also called out by the reporting researcher as
limiting real-world exploitability, with the fix framed as defense-in-depth.

Source: GHSA-xpv3-w29h-x7cv
(https://github.com/oauthlib/oauthlib/security/advisories/GHSA-xpv3-w29h-x7cv),
published 2026-09-29 by the oauthlib maintainers, CWE-208, reported by GitHub user
Rickidevs.


Note You need to log in before you can comment on or make changes to this bug.