平台
python
组件
fastapi-users
修复版本
15.0.3
15.0.2
CVE-2025-68481 describes a vulnerability in the fastapi-users library where OAuth login state tokens are generated without sufficient entropy. This lack of per-request data linkage allows an attacker to potentially hijack user sessions during the OAuth flow. The vulnerability affects versions of fastapi-users up to 9.3.2 and is resolved in version 15.0.2.
The core issue lies in the stateless nature of the OAuth login state tokens. The generatestatetoken() function consistently uses an empty state_data dictionary, resulting in JWTs that only contain a fixed audience claim and an expiration timestamp. An attacker could potentially intercept or manipulate these tokens, impersonating a legitimate user and gaining unauthorized access to their account. This is particularly concerning in environments where OAuth is used for single sign-on (SSO) or federated authentication, as a compromised token could grant access to multiple applications and services. The lack of state data makes it difficult to correlate the token with the originating session, increasing the attack surface.
This vulnerability was publicly disclosed on 2025-12-19. There is currently no indication of active exploitation campaigns targeting this specific vulnerability. While no public proof-of-concept (PoC) code has been released, the lack of entropy in the state token makes it relatively straightforward to exploit. The vulnerability is not currently listed on the CISA KEV catalog, and its EPSS score is pending evaluation.
Applications built with FastAPI and utilizing the fastapi-users library for OAuth authentication are at risk. This includes web applications, APIs, and microservices that rely on OAuth for user authentication and authorization. Specifically, deployments using older versions of fastapi-users (<= 9.3.2) and those that haven't implemented robust token validation practices are particularly vulnerable.
• python / server:
grep -r 'generate_state_token' /path/to/your/project/
# Look for instances where state_data is an empty dictionary.• python / supply-chain:
import os
import hashlib
def check_fastapi_users_version():
try:
import fastapi_users
version = fastapi_users.__version__
if version <= '9.3.2':
print(f"WARNING: fastapi-users version {version} is vulnerable.")
else:
print(f"fastapi-users version {version} is not vulnerable.")
except ImportError:
print("fastapi-users is not installed.")
check_fastapi_users_version()disclosure
漏洞利用状态
EPSS
0.06% (17% 百分位)
CISA SSVC
CVSS 向量
The primary mitigation is to upgrade to version 15.0.2 of fastapi-users or later. This version includes a fix that addresses the entropy deficiency in the state token generation process. If upgrading immediately is not feasible, consider implementing a temporary workaround by adding unique, per-request data to the statedata dictionary passed to generatestatetoken(). This could involve incorporating a random value or a session identifier. Additionally, review your OAuth configuration to ensure that the authorizeredirect_url is properly secured and that token validation is robust. After upgrading, confirm the fix by attempting to initiate an OAuth flow and verifying that the generated state token includes unique, per-request data.
将 FastAPI Users 库升级到版本 15.0.2 或更高版本。这修复了 OAuth 登录流程中的跨站请求伪造 (CSRF) 漏洞。升级可以减轻攻击者接管用户帐户的风险。
漏洞分析和关键警报直接发送到您的邮箱。
CVE-2025-68481 is a medium severity vulnerability affecting FastAPI Users versions up to 9.3.2. It involves stateless OAuth login state tokens lacking entropy, potentially allowing session hijacking.
You are affected if you are using FastAPI Users version 9.3.2 or earlier and rely on OAuth authentication. Upgrade to version 15.0.2 to resolve the issue.
Upgrade to version 15.0.2 of the fastapi-users library. If immediate upgrade is not possible, implement a temporary workaround by adding unique per-request data to the state_data dictionary.
There is currently no indication of active exploitation campaigns targeting this specific vulnerability, but the lack of entropy makes exploitation relatively straightforward.
Refer to the official FastAPI Users repository and release notes for the latest information and advisory regarding CVE-2025-68481.
上传你的依赖文件,立即了解此CVE和其他CVE是否影响你。
上传你的 requirements.txt 文件,立即知道是否受影响。