Skip to content

FastAPI Api Key has a timing side-channel in verify_key that allows statistical key validity detection

Low severity GitHub Reviewed Published Jan 21, 2026 in Athroniaeth/fastapi-api-key • Updated Jan 22, 2026

Package

pip fastapi-api-key (pip)

Affected versions

< 1.1.0

Patched versions

1.1.0

Description

Impact

Timing side-channel vulnerability in verify_key(). The method applied a random delay only on verification failures, allowing an attacker to statistically distinguish valid from invalid API keys by measuring response latencies. With enough repeated requests, an adversary could infer whether a key_id corresponds to a valid key, potentially accelerating brute-force or enumeration attacks.

Affected: all users relying on verify_key() for API key authentication prior to the fix.

Patches

Yes. Users should upgrade to version 1.1.0 (or the version containing this fix). The patch applies a uniform random delay (min_delay to max_delay) to all responses regardless of outcome, eliminating the timing correlation.

Workarounds

  • Add an application-level fixed delay or random jitter to all authentication responses (success and failure) before the fix is applied.
  • Use rate limiting to reduce the feasibility of statistical timing attacks.

References

References

@Athroniaeth Athroniaeth published to Athroniaeth/fastapi-api-key Jan 21, 2026
Published to the GitHub Advisory Database Jan 21, 2026
Reviewed Jan 21, 2026
Published by the National Vulnerability Database Jan 21, 2026
Last updated Jan 22, 2026

Severity

Low

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(11th percentile)

Weaknesses

Observable Timing Discrepancy

Two separate operations in a product require different amounts of time to complete, in a way that is observable to an actor and reveals security-relevant information about the state of the product, such as whether a particular operation was successful or not. Learn more on MITRE.

CVE ID

CVE-2026-23996

GHSA ID

GHSA-95c6-p277-p87g
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.