# CVE-2022-31142: Potential Timing Attack Vector in @fastify/bearer-auth

- Severity: High 7.5 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.53%, higher than 75% of CVEs (2026-12-01)
- Published: 2022-07-14T18:55:11.000Z
- Modified: 2026-06-17T04:44:53.493Z
- Also known as: GHSA-376v-xgjx-7mfr
- Weaknesses: CWE-203, CWE-208
- SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial
- Assigned by: GitHub_M

## Description

@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.

(As written by CVE List.)

## Affected

- fastify fastify-bearer-auth: >= 5.0.1, < 7.0.2; = 8.0.0
- fastify-bearer-auth (npm): from 5.0.1 up to 6.0.3
- @fastify/bearer-auth (npm): before 7.0.2; from 8.0.0 before 8.0.1
- fastify bearer-auth: from 5.0.1 before 7.0.2; 8.0.0

## Every score

- GitHub_M: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`
- GitHub: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`
- NVD: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`

## References

- <https://github.com/fastify/fastify-bearer-auth/security/advisories/GHSA-376v-xgjx-7mfr> (third-party-advisory, web)
- <https://github.com/fastify/fastify-bearer-auth/commit/0c468a616d7e56126dc468150f6a5a92e530b8e4> (patch, third-party-advisory, web)
- <https://github.com/fastify/fastify-bearer-auth/commit/39353b15409ee99474545f615ffb16180cf3b716> (patch, third-party-advisory, web)
- <https://github.com/fastify/fastify-bearer-auth/commit/f921a0582dc83112039004a9b5041141b50c5b3f> (patch, third-party-advisory, web)
- <https://hackerone.com/reports/1633287> (permissions-required, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2022-31142> (advisory)
- <https://github.com/fastify/fastify-bearer-auth> (package)

## Sources

- CVE List: [CVE-2022-31142](https://www.cve.org/CVERecord?id=CVE-2022-31142), CVE Terms of Use, modified 2025-04-23
- GitHub Advisory Database: [GHSA-376v-xgjx-7mfr](https://github.com/advisories/GHSA-376v-xgjx-7mfr), CC-BY-4.0, modified 2023-11-08
- NVD: [CVE-2022-31142](https://nvd.nist.gov/vuln/detail/CVE-2022-31142), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-31142 · Whole record: https://cve.day/CVE-2022-31142.json · Rebuilt by cve.day 2026-11-25T22:58:12.953Z
