# CVE-2026-23996: FastAPI Api Key has a timing side-channel in verify_key that allows statistical key validity detection

> Attackers can statistically detect valid API keys via timing side-channels in verify_key, facilitating brute-force attacks against FastAPI Api Key users.

- **Severity:** Low 3.7 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 Jan 2026
- **Updated:** 22 Jan 2026
- **Also known as:** GHSA-95c6-p277-p87g, PYSEC-2026-1358

## What is CVE-2026-23996?

CVE-2026-23996 is a low-severity vulnerability in Athroniaeth fastapi-api-key, published on 21 Jan 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

FastAPI Api Key provides a backend-agnostic library that provides an API key system. Version 1.1.0 has a 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. All users relying on verify_key() for API key authentication prior to the fix are affected. Users should upgrade to version 1.1.0 to receive a patch. The patch applies a uniform random delay (min_delay to max_delay) to all responses regardless of outcome, eliminating the timing correlation. Some workarounds are available. Add an application-level fixed delay or random jitter to all authentication responses (success and failure) before the fix is applied and/or use rate limiting to reduce the feasibility of statistical timing attacks.

Weakness: CWE-208 (Observable Timing Discrepancy)

## Which versions are affected by CVE-2026-23996?

3 open source packages ship an affected version, including fastapi-api-key. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `fastapi-api-key` | PyPI | All versions | 1.1.0 |
| `fastapi-api-key` | PyPI | All versions | 1.1.0 |
| `fastapi-api-key` | PyPI | All versions | 1.1.0 |

Products: Athroniaeth Fastapi Api Key.

## How do I fix CVE-2026-23996?

Upgrade fastapi-api-key to 1.1.0 or later.

## Is CVE-2026-23996 being exploited?

There is no known exploitation of CVE-2026-23996 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-23996 and fix it if it is affected.

What it is: CVE-2026-23996 is a low-severity vulnerability in Athroniaeth fastapi-api-key, published on 21 Jan 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-23996 in the wild and no public exploit code.

Affected packages and fixed versions:
- fastapi-api-key (PyPI): affected all versions; fixed in 1.1.0
- fastapi-api-key (PyPI): affected all versions; fixed in 1.1.0
- fastapi-api-key (PyPI): affected all versions; fixed in 1.1.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-23996/ (Markdown: https://insights.sbomify.com/CVE-2026-23996/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-23996
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-23996
- OSV: https://osv.dev/vulnerability/CVE-2026-23996

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-23996/
Summaries are generated and may contain mistakes; the official description above is the record.
