Potential Timing Attack Vector in @fastify/bearer-auth
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Information disclosure
- Confidentiality · integrity · availability
- High · None · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-208.
Summary
@fastify/bearer-auth is a Fastify plugin to require bearer Authorization headers. @fastify/bearer-auth prior to versions 7.0.2 and 8.0.1 does not securely use crypto.timingSafeEqual. A malicious attacker could estimate the length of one valid bearer token. According to the corresponding RFC 6750, the bearer token has only base64 valid characters, reducing the range of characters for a brute force attack. Version 7.0.2 and 8.0.1 of @fastify/bearer-auth contain a patch. There are currently no known workarounds. The package fastify-bearer-auth, which covers versions 6.0.3 and prior, is also vulnerable starting at version 5.0.1. Users of fastify-bearer-auth should upgrade to a patched version of @fastify/bearer-auth.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- Yes
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| fastify | fastify-bearer-auth | 5.0.1 to before 7.0.2; = 8.0.0 | 7.0.2 | Patch available | CNA |
| — | fastify-bearer-auth (npm) | 5.0.1 – 6.0.3 | — | No fix listed | GHSA-376v-xgjx-7mfr |
| — | @fastify/bearer-auth (npm) | before 7.0.2 | 7.0.2 | Patch available | GHSA-376v-xgjx-7mfr |
| — | @fastify/bearer-auth (npm) | 8.0.0 to before 8.0.1 | 8.0.1 | Patch available | GHSA-376v-xgjx-7mfr |
- fastify-bearer-auth Vendorfastify Affected 5.0.1 to before 7.0.2; = 8.0.0 Fixed in 7.0.2 Patch available CNA
- fastify-bearer-auth (npm) Vendor— Affected 5.0.1 – 6.0.3 Fixed in — No fix listed GHSA-376v-xgjx-7mfr
- @fastify/bearer-auth (npm) Vendor— Affected before 7.0.2 Fixed in 7.0.2 Patch available GHSA-376v-xgjx-7mfr
- @fastify/bearer-auth (npm) Vendor— Affected 8.0.0 to before 8.0.1 Fixed in 8.0.1 Patch available GHSA-376v-xgjx-7mfr
Remediation
- Fix · CNA fastify-bearer-auth (fastify) Fixed in 7.0.2
- Fix · GHSA-376v-xgjx-7mfr @fastify/bearer-auth (npm) Fixed in 7.0.2 Advisory →
- Fix · GHSA-376v-xgjx-7mfr @fastify/bearer-auth (npm) Fixed in 8.0.1 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2022-31142
- 2026-10-03 Alias added: GHSA-376v-xgjx-7mfr
References
Patch 3
Advisory 3
Sources
- CVE-2022-31142 · CVE Program
- CVE-2022-31142 · NVD
- FIRST EPSS
- GHSA-376v-xgjx-7mfr · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences