{"id":"PYSEC-2026-1358","summary":"FastAPI Api Key has a timing side-channel in verify_key that allows statistical key validity detection","details":"### Impact\nTiming 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.\n\nAffected: all users relying on verify_key() for API key authentication prior to the fix.\n\n### Patches\nYes. 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.\n\n### Workarounds\n- Add an application-level fixed delay or random jitter to all authentication responses (success and failure) before the fix is applied.\n- Use rate limiting to reduce the feasibility of statistical timing attacks.\n\n### References\n- CWE-208: Observable Timing Discrepancy\n- Commit: 87b27640f77c5ef86c46311b6b5a7e2887e35b77\n- OWASP: https://owasp.org/www-community/attacks/Timing_attack","aliases":["CVE-2026-23996","GHSA-95c6-p277-p87g"],"modified":"2026-07-07T17:47:35.926091029Z","published":"2026-07-07T16:03:19.699103Z","references":[{"type":"WEB","url":"https://github.com/Athroniaeth/fastapi-api-key/security/advisories/GHSA-95c6-p277-p87g"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-23996"},{"type":"WEB","url":"https://github.com/Athroniaeth/fastapi-api-key/commit/310b2c5c77305f38c63c0b917539a0344071dfd8"},{"type":"PACKAGE","url":"https://github.com/Athroniaeth/fastapi-api-key"},{"type":"WEB","url":"https://github.com/Athroniaeth/fastapi-api-key/releases/tag/1.1.0"},{"type":"PACKAGE","url":"https://pypi.org/project/fastapi-api-key"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-95c6-p277-p87g"}],"affected":[{"package":{"name":"fastapi-api-key","ecosystem":"PyPI","purl":"pkg:pypi/fastapi-api-key"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.1.0"}]}],"versions":["0.10.0","0.11.0","0.12.0","0.13.0","0.13.1","0.13.2","0.13.3","0.2.1","0.3.0","0.4.0","0.5.0","0.6.0","0.7.1","0.7.2","0.7.3","0.8.0","0.8.1","0.8.2","0.8.3","0.9.0","1.0.0"],"database_specific":{"source":"https://github.com/pypa/advisory-database/blob/main/vulns/fastapi-api-key/PYSEC-2026-1358.yaml"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"}]}