Timing Attack Affecting fastapi-api-key package, versions [,1.1.0)


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.04% (12th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-FASTAPIAPIKEY-15054292
  • published22 Jan 2026
  • disclosed21 Jan 2026
  • creditUnknown

Introduced: 21 Jan 2026

NewCVE-2026-23996  (opens in a new tab)
CWE-208  (opens in a new tab)

How to fix?

Upgrade fastapi-api-key to version 1.1.0 or higher.

Overview

fastapi-api-key is a fastapi-api-key provides secure, production-ready API key management for FastAPI. It offers pluggable hashing strategies (Argon2 or bcrypt), backend-agnostic persistence (currently SQLAlchemy), and an optional cache layer (aiocache). Includes a Typer CLI and a FastAPI router for CRUD management of keys.

Affected versions of this package are vulnerable to Timing Attack via the verify_key function. An attacker can determine the validity of API keys by measuring response times and performing statistical analysis of the observed timing discrepancies. This can accelerate brute-force or enumeration attacks against the authentication mechanism.

Workaround

This vulnerability can be mitigated by adding an application-level fixed delay or random jitter to all authentication responses (both success and failure) and by implementing rate limiting to reduce the feasibility of statistical timing attacks.

References

CVSS Base Scores

version 4.0
version 3.1