Skip to main content

FastAPI Users CVE-2025-68481

HIGH
Improper Authorization (CWE-285)
2025-12-19 security-advisories@github.com
8.8
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Call /authorize and capture state JWT
  2. Delivery
    Finish upstream OAuth with attacker's own account
  3. Exploit
    Lure victim to crafted callback link
  4. Execution
    Victim's browser completes flow
  5. Impact
    Login CSRF / account takeover

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V8 - Authorization Authorization verification
MITRE ATT&CK

1 technique across 1 tactic: Defense Evasion

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitable only against applications that deploy the fastapi-users OAuth login router (get_oauth_router, e.g. the FastAPI SSO integration) in versions < 15.0.2, where generate_state_token() is called with an empty state_data and the callback only verifies the JWT signature/expiry without any per-session binding. Limiting factors: the attacker is unauthenticated on the target (PR:N) but MUST get the victim to load an attacker-crafted /callback URL (UI:R), and the captured state JWT is only usable within its ~1 hour expiry. The ultimate outcome (full takeover of the victim's account vs. the victim being silently logged into the attacker's account) depends on the host app's OAuth account-association/auto-linking logic. Apps not using the OAuth router, or already on 15.0.2+, are unaffected.

Impact

Signals mostly align toward a genuine, actionable issue but at a tier slightly below the headline score. The CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H, 8.8) indicates a network-reachable, low-complexity flaw needing no attacker authentication but requiring victim interaction. Publicly available exploit detail exists via the GitHub Security Advisory (GHSA-5j53-63w8-8625) and the patch commit, and the root cause is well documented in the diff (stateless state JWT, no CSRF cookie). This is confirmed as login CSRF leading to possible account takeover (CWE-285 Improper Authorization). However, two signals temper the raw severity: (1) no EPSS probability was provided and the CVE is NOT in CISA KEV, so there is no public evidence of active exploitation - the correct status is 'publicly available exploit code exists' rather than in-the-wild use; and (2) the input NVD vector claims A:H (high availability impact), which is not supported by the description - login CSRF/account takeover affects confidentiality and integrity of the victim account, not availability, so A:H appears overstated and inflates the 8.8 score. Exploitation also depends on the host application actually deploying the fastapi-users OAuth/SSO router and on its account-linking logic, and it requires the victim to click an attacker-crafted callback link within the ~1 hour token window. Net: a real, patch-worthy priority for any app using the fastapi-users OAuth flow, but not a drop-everything internet-wide emergency absent KEV/EPSS evidence.

Exploit ScenarioDerived

An attacker hits the target app's /authorize endpoint, captures the server-generated stateless state JWT, and completes the upstream OAuth flow using their own provider account to obtain a valid authorization code. They then send the victim a link to .../callback?code=<attacker_code>&state=<attacker_state>; because the state token carries no per-browser binding and stays valid for ~1 hour, the victim's browser completes the flow and is silently logged into the attacker's account (or, depending on linking logic, the victim's account is taken over). A public advisory and patch diff describing the exact flow exist, but no weaponized exploit tool or active exploitation is confirmed.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 13, 2026

OAuth login CSRF in the FastAPI Users Python library before 15.0.2 allows an unauthenticated attacker to have a victim's browser silently complete an OAuth callback using an attacker-controlled authorization code and a state token the attacker obtained from the same server. Because the state JWT carries no per-request entropy and is never correlated to the browser that started the flow, it is valid for any client for roughly one hour; the attacker needs only to lure the victim into loading a crafted /callback URL (user interaction required). Successful abuse logs the victim into the attacker's account, and depending on the host application's OAuth account-association logic it can escalate to a one-click takeover of the victim's account. Publicly available exploit code and a detailed GitHub security advisory (GHSA-5j53-63w8-8625) exist, and version 15.0.2 contains the vendor patch.

RemediationAI

Upgrade the fastapi-users dependency to 15.0.2 or later (vendor-released patch; pip install -U 'fastapi-users>=15.0.2'), which is the primary and complete fix per GHSA-5j53-63w8-8625. The patched router generates a random CSRF token with secrets.token_urlsafe(32), stores it in the state JWT under csrftoken, sets a matching correlation cookie (default name fastapiusersoauthcsrf) on /authorize, and rejects callbacks with a new OAUTH_INVALID_STATE error; review and harden the new cookie options if you override them, and note that in local HTTP development you may need csrf_token_cookie_secure=False or the browser will not send the cookie. If an immediate upgrade is impossible, compensating controls with trade-offs include: temporarily disabling the OAuth login router or removing the /callback endpoint (blocks third-party SSO login entirely until patched); fronting the OAuth flow with a wrapper that issues and validates its own per-session state or nonce cookie (requires custom code and must be validated on every callback, including provider-initiated ones); shortening the state token lifetime so the ~1 hour reuse window shrinks (reduces attacker leeway but does not eliminate the flaw and may break slow logins); and, if the application auto-links OAuth identities by e-mail without verification, disabling that auto-linking or requiring explicit account confirmation to prevent the login-CSRF from escalating into takeover of the victim's account (adds a user step and reduces SSO convenience). Monitoring for repeated /authorize requests followed by /callback hits from differing browser fingerprints or IPs can help detect exploitation attempts. No vendor workaround is documented beyond upgrading.

Affected Packages

pypi fastapi-users fix: 15.0.2

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

FastAPI Users exposes an OAuth router (get_oauth_router, used by the FastAPI SSO integration) that implements the authorization-code flow. In vulnerable versions, generate_state_token() is called with an empty state_data dict, so the state value is a signed JWT whose only claims are a fixed audience (STATE_TOKEN_AUDIENCE) and an expiration roughly one hour out - no nonce, no session identifier, no per-request entropy. On callback, the library only decodes the JWT under state_secret and checks the audience and expiry; there is no correlation cookie, no server-side state cache, and no comparison against the originating session, so any valid, unexpired state is accepted for any client. This is recorded as CWE-285 (Improper Authorization) and functionally behaves as a login CSRF / state-fixation flaw (CWE-352-style), since possession of any valid state token authorizes an arbitrary browser to finish the flow. The affected CPE is cpe:2.3:a:fastapi-users_project:fastapi_users:*:*:*:*:*:python:*:* - the pip package fastapi-users. The patch commit 7cf413cd766b9cb0ab323ce424ddab2c0d235932 (version 15.0.2) adds a CSRF token generated with secrets.token_urlsafe(32), embeds it in the state JWT under a csrftoken key, and sets a same-named correlation cookie (fastapiusersoauthcsrf) on the /authorize response with max_age 3600 and configurable secure, httponly and samesite (default lax) attributes, plus a new OAUTH_INVALID_STATE error code and cookie configuration options in the OAuth router. Applications that do not deploy the OAuth router, or that are already on 15.0.2 or later, are unaffected.

Know when Fastapi Users gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

NVD PRIMARY 8.8 HIGH
AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
vuln.today AI 8.1 HIGH

Network, low-complexity, unauthenticated attacker (AV:N/AC:L/PR:N) but victim must click a callback link (UI:R); account takeover gives C:H/I:H while availability is unaffected (A:N, unlike the overstated NVD A:H).

3.1 AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

DescriptionNVD

FastAPI Users allows users to quickly add a registration and authentication system to their FastAPI project. Prior to version 15.0.2, the OAuth login state tokens are completely stateless and carry no per-request entropy or any data that could link them to the session that initiated the OAuth flow. generate_state_token() is always called with an empty state_data dict, so the resulting JWT only contains the fixed audience claim plus an expiration timestamp. On callback, the library merely checks that the JWT verifies under state_secret and is unexpired; there is no attempt to match the state value to the browser that initiated the OAuth request, no correlation cookie, and no server-side cache. Any attacker can hit /authorize, capture the server-generated state, finish the upstream OAuth flow with their own provider account, and then trick a victim into loading .../callback?code=<attacker_code>&state=<attacker_state>. Because the state JWT is valid for any client for \~1 hour, the victim’s browser will complete the flow. This leads to login CSRF. Depending on the app’s logic, the login CSRF can lead to an account takeover of the victim account or to the victim user getting logged in to the attacker's account. Version 15.0.2 contains a patch for the issue.

Executive ViewAI

Why It Matters

The FastAPI Users authentication library used across Python web applications has an OAuth login cross-site request forgery flaw (CVE-2025-68481) that lets an attacker lure a victim into silently signing in to an attacker-controlled account, and in some deployments escalate to a one-click takeover of the victim's own account. Any customer-facing or workforce application built on versions before 15.0.2 is exposed, making this a user-account integrity risk that can undermine trust in our authentication layer. A vendor patch is available and publicly available exploit code exists, so exposure is real but remediable through a routine dependency upgrade.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.3%
Top 84% exploitable
Prevalence
Medium
popular FastAPI auth library, but only apps using its OAuth router are affected
Exploit
POC
Public exploit code exists
Data Quality
3 sources
Confidence: Low

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
Poc
System Exposure· derived
Open
Automatable· derived
No
Human Impact
High

Priority Score

64
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +44
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Request Forgery exploits the automatic credential inclusion behavior of web browsers.

Authentication bypass attacks exploit flaws in the verification mechanisms that control access to systems and applications.

Affected Products (CPE)NVD

cpe:2.3:a:fastapi-users_project:fastapi_users:*:*:*:*:*:python:*:*

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy