CVE-2025-68481

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.
Configurations

Configuration 1 (hide)

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

History

13 Oct 2026, 11:10

Type Values Removed Values Added
Summary
  • (es) FastAPI Users permite a los usuarios añadir rápidamente un sistema de registro y autenticación a su proyecto FastAPI. Antes de la versión 15.0.2, los tokens de estado de inicio de sesión de OAuth son completamente sin estado y no llevan entropía por solicitud ni ningún dato que pueda vincularlos a la sesión que inició el flujo de OAuth. 'generate_state_token()' siempre se llama con un diccionario 'state_data' vacío, por lo que el JWT resultante solo contiene la declaración de audiencia fija más una marca de tiempo de expiración. En la devolución de llamada, la biblioteca simplemente verifica que el JWT se valida bajo 'state_secret' y no ha expirado; no hay ningún intento de hacer coincidir el valor de estado con el navegador que inició la solicitud de OAuth, ninguna cookie de correlación y ninguna caché del servidor. Cualquier atacante puede acceder a '/authorize', capturar el estado generado por el servidor, finalizar el flujo de OAuth ascendente con su propia cuenta de proveedor y luego engañar a una víctima para que cargue '.../callback?code=<attacker_code>&state=<attacker_state>'. Debido a que el JWT de estado es válido para cualquier cliente durante ~1 hora, el navegador de la víctima completará el flujo. Esto conduce a CSRF de inicio de sesión. Dependiendo de la lógica de la aplicación, el CSRF de inicio de sesión puede llevar a una toma de control de la cuenta de la víctima o a que el usuario víctima inicie sesión en la cuenta del atacante. La versión 15.0.2 contiene un parche para el problema.

Information

Published : 2025-12-19 21:15

Updated : 2026-10-13 11:10


NVD link : CVE-2025-68481

Mitre link : CVE-2025-68481

CVE.ORG link : CVE-2025-68481


JSON object : View

Products Affected

fastapi-users_project

  • fastapi_users
CWE
CWE-285

Improper Authorization

CWE-352

Cross-Site Request Forgery (CSRF)