CVE-2026-49265: Oauthlib Timing Attack Vulnerability in PKCE Code_Verifier Comparison

oauthlib Updated 01 Oct 2026

Summary

01/10/2026
Yes i
Moderate
6.8

CVE-2026-49265: Oauthlib: Timing Attack Vulnerability in PKCE code_verifier Comparison (CWE-208). Affects oauthlib versions >= 3.0.0, < 4.0.0. Fixed in 4.0.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Oauthlib is a popular Python library that provides a framework for OAuth 1 and OAuth 2, enabling developers to integrate secure authorization into their applications. It simplifies the implementation of various OAuth flows, including the Authorization Code Grant flow, which is widely used for web applications. However, a vulnerability has been identified in its PKCE (Proof Key for Code Exchange) implementation, specifically in the way it compares code verifiers, potentially exposing applications to timing attacks.

Vulnerability Detail

A timing side-channel vulnerability exists in the PKCE implementation of the Authorization Code Grant flow in Oauthlib. The affected function, code_challenge_method_plain, uses Python's standard '==' operator for string comparison instead of a constant-time comparison function. This can lead to timing-based attacks where an attacker can measure the time taken for string comparisons to infer information about the code_verifier, potentially allowing them to recover it character by character. This vulnerability is categorized as CWE-208 (Observable Timing Discrepancy) and can lead to account takeover if exploited.

How To Fix

Latest published version: 4.0.0 as of 23 Oct 2026

pip install --upgrade "oauthlib==4.0.0"

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate updating is not feasible, consider implementing a constant-time comparison function in your code as a temporary workaround. Replace the usage of '==' for comparing code verifiers with the following code: 'hmac.compare_digest(code_verifier, stored_challenge)'. This will help mitigate the timing attack risk until the package can be updated.

Conclusion

The Oauthlib timing attack vulnerability (CVE-2026-49265) poses a significant risk to applications using the library for OAuth 2.0 authorization flows. By understanding the nature of the vulnerability and following the recommended steps to update the package or implement workarounds, developers can protect their applications from potential exploitation.

See every vulnerability recorded for oauthlib →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 6.8, indicating a medium severity level.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

PKCE (Proof Key for Code Exchange) is an extension to the OAuth 2.0 protocol that enhances security for public clients by requiring them to generate a code_verifier and code_challenge during the authorization process.

If exploited, this vulnerability can allow an attacker to recover the code_verifier, leading to unauthorized access and account takeover.

Yes, the vulnerability has been fixed in oauthlib version 4.0.0 and later. It is recommended to update to this version.

Related vulnerabilities

Recent vulnerabilities recorded for oauthlib.

How To Fix

Latest published version: 4.0.0 as of 23 Oct 2026

pip install --upgrade "oauthlib==4.0.0"

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback