CVE-2025-68158: 
Python vulnerability analysis and mitigation

Overview

CVE-2025-68158 is a Cross-Site Request Forgery (CSRF) vulnerability in Authlib, a Python library for building OAuth and OpenID Connect servers and clients. When cache-backed state/request-token storage is configured, the FrameworkIntegration.set_state_data function stores the OAuth state blob without binding it to the initiating user session, and get_state_data ignores the caller's session entirely — enabling a "1-click Account Takeover" attack. Affected versions are 1.0.0 through 1.6.5; version 1.6.6 contains the fix. The GitHub Advisory Database rates this Moderate at CVSS v3.1 score of 5.7, while Feedly's aggregated data reflects a score of 8.8 (High) from an alternate scoring perspective (Github Advisory, Authlib Security Advisory).

Technical details

The root cause is CWE-352 (Cross-Site Request Forgery): when a cache backend (e.g., Redis, Memcached) is supplied to the OAuth client registry, the state blob is stored under the key _state_{app}_{state} in the cache without any session-binding. The get_state_data method retrieves this value purely by the opaque state string, ignoring which user session initiated the flow — violating the OAuth 2.0 RFC 6749 §10.12 requirement that the state parameter be tied to the user-agent session. An attacker who initiates their own OAuth flow can obtain a valid state value, then trick a victim into visiting a crafted callback URL containing the attacker's state and authorization code; Authlib processes the callback without verifying session ownership, completing the token exchange with the attacker's authorization code (Github Advisory, Authlib Security Advisory).

Impact

Successful exploitation enables a one-click account takeover: if the target application links SSO identities to existing accounts upon callback (a common pattern), the attacker's SSO account becomes permanently linked to the victim's account, granting full unauthorized access. The primary impact is high confidentiality loss (access to the victim's account data and resources); integrity and availability impacts depend on the application's post-authentication logic. Only applications using Authlib with a cache-backed state storage configuration are affected — those using session-only storage are not vulnerable (Github Advisory, Authlib Security Advisory).

Exploitability

A proof-of-concept exploit scenario is publicly documented in the GitHub Security Advisory, reported by the Snyk Security Labs team (researcher davidbors-snyk). There is no evidence of active in-the-wild exploitation at this time, and the vulnerability is not listed in the CISA KEV catalog. The EPSS score is approximately 0.017% (4th percentile), indicating a low near-term exploitation probability. Exploitation requires user interaction (victim must click a crafted link) and the attacker must have a valid state token, which is trivially obtainable by initiating their own OAuth flow (Github Advisory, Authlib Security Advisory).

Exploitation steps

  1. Identify a vulnerable target: Locate a web application using Authlib versions 1.0.0–1.6.5 with cache-backed OAuth state storage (e.g., configured with a Redis or Memcached cache in the OAuth client registry).
  2. Initiate attacker-controlled OAuth flow: The attacker begins an SSO/OAuth login flow on the target application using their own account, causing Authlib to generate a valid state value and store it in the shared cache under _state_{app}_{state}.
  3. Capture the state and authorization code: The attacker halts the flow just before the callback step, capturing the state parameter from the redirect URL. The attacker then completes the OAuth flow with their identity provider to obtain a valid authorization code tied to their own SSO account.
  4. Craft a malicious callback URL: Construct a callback URL for the target application's OAuth callback endpoint, embedding the attacker's state and code values (e.g., https://target.app/callback?code=ATTACKER_CODE&state=ATTACKER_STATE).
  5. Deliver to victim via phishing or drive-by: Trick a logged-in victim into visiting the crafted callback URL (e.g., via a phishing email, malicious link, or drive-by redirect).
  6. Account takeover achieved: Because Authlib's get_state_data retrieves the state from cache without verifying the victim's session, the callback is processed successfully. The attacker's authorization code is exchanged, and if the application links SSO identities on callback, the attacker's SSO account is permanently linked to the victim's account — granting the attacker full access (Github Advisory, Authlib Security Advisory).

Indicators of compromise

  • Logs: Unexpected OAuth callback requests where the state parameter does not correspond to any active session for the requesting user; callback requests originating from IP addresses or user agents inconsistent with the session that initiated the OAuth flow.
  • Application Behavior: Accounts with newly linked SSO identities that the legitimate user did not authorize; users reporting unexpected third-party account associations or unauthorized logins.
  • Network: OAuth callback endpoint (/callback, /oauth/callback, or equivalent) receiving GET requests with state and code parameters from users who have no corresponding pending OAuth authorization in their session.
  • Cache: Presence of _state_{app}_{state} keys in the cache backend being accessed by sessions other than the one that created them (detectable via cache access logging if enabled).

Mitigation and workarounds

Upgrade Authlib to version 1.6.6 or later, which resolves the issue by storing a session-bound marker alongside the cache entry: set_state_data now also writes a lightweight expiry record into the user's session, and get_state_data checks for this session record before retrieving from cache — ensuring the state is always tied to the initiating session (Github Advisory, Patch Commit). As a temporary workaround for applications that cannot immediately upgrade, consider switching from cache-backed state storage to session-only storage by removing the cache configuration from the OAuth client registry. Additionally, review application logic for any account-linking behavior triggered on OAuth callback, and add application-level session validation as a defense-in-depth measure.

Community reactions

The vulnerability was discovered and reported by the Snyk Security Labs team (researcher davidbors-snyk), who disclosed it responsibly to the Authlib maintainers. The advisory was published by maintainer lepture on January 8, 2026. Ubuntu issued security notice USN-8065-1 addressing this CVE, and openSUSE published a security announcement as well, indicating broad Linux distribution uptake of the fix (Ubuntu Advisory, openSUSE Announcement). A technical write-up titled "1-click Account Takeover" was published at infinitsec.net shortly after disclosure.

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Fixed

bookworm

python-authlib: 1.2.0-1+deb12u1

Fixed

sid

python-authlib: 1.6.6-1

Fixed

trixie

python-authlib: 1.6.0-1+deb13u1

Fixed

Ubuntu

Fixed

devel

python-authlib

Not Affected

jammy

python-authlib

Not Affected

jammy (esm-apps)

python-authlib

Not Affected

noble

python-authlib

Affected

noble (esm-apps)

python-authlib: 1.3.0-1ubuntu0.1~esm1

Fixed

resolute

python-authlib

Not Affected

resolute (esm-apps)

python-authlib

Not Affected

RHEL / CentOS

Unknown

Source: This report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-v2f8-6655-7grjCRITICAL10
  • Python logoPython
  • vibe-trading-ai
NoYesOct 02, 2026
CVE-2026-105782HIGH7.5
  • Python logoPython
  • scrapy
NoYesOct 06, 2026
GHSA-v853-p72q-4cfwHIGH7.5
  • Python logoPython
  • quart
NoYesOct 05, 2026
CVE-2026-105751MEDIUM6.9
  • Python logoPython
  • docling
NoYesOct 05, 2026
CVE-2026-105750MEDIUM5.9
  • Python logoPython
  • docling
NoYesOct 05, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management