7.5high
Potential Timing Attack Vector in @fastify/bearer-auth
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.53% (higher than 75% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-376v-xgjx-7mfr
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| fastify fastify-bearer-auth | >= 5.0.1, < 7.0.2, = 8.0.0 | CVE List |
| fastify-bearer-auth (npm) | from 5.0.1 up to 6.0.3 | GitHub Advisory Database |
| @fastify/bearer-auth (npm) | before 7.0.2, from 8.0.0 before 8.0.1 | GitHub Advisory Database |
| fastify bearer-auth | from 5.0.1 before 7.0.2, 8.0.0 | NVD |
All scores
| GitHub_M | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
Classification
What each source says
CVE List
@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.
GitHub Advisory Database
Impact
fastify-bearer-auth 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.
All versions of fastify-bearer-auth are also affected.
Patches
We released:
- v8.0.1 with a fix for the Fastify v4 line
- v7.0.2 with a fix for the Fastify v3 line
Workarounds
There are no workarounds. Update your dependencies.
References
https://hackerone.com/reports/1633287
For more information
If you have any questions or comments about this advisory:
- Open an issue in https://github.com/fastify/fastify-bearer-auth
- Email us at hello@matteocollina.com
NVD (es)
fastify/bearer-auth es un plugin de Fastify para requerir encabezados de autorización de portador. fastify/bearer-auth versiones anteriores a 7.0.2 y 8.0.1, no usa de forma segura crypto.timingSafeEqual. Un atacante malicioso podría estimar la longitud de un token de portador válido. Según el correspondiente RFC 6750, el token de portador sólo presenta caracteres válidos en base64, reduciendo el rango de caracteres para un ataque de fuerza bruta. Las versiones 7.0.2 y 8.0.1 de fastify/bearer-auth contienen un parche. Actualmente no se presentan mitigaciones conocidas. El paquete fastify-bearer-auth, que cubre las versiones 6.0.3 y anteriores, también es vulnerable a partir de la versión 5.0.1. Los usuarios de fastify-bearer-auth deberían actualizar a una versión parcheada de fastify/bearer-auth
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
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2022-31142 changed 2025-04-23 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-376v-xgjx-7mfr changed 2023-11-08 | CC-BY-4.0 |
| NVD | CVE-2022-31142 changed 2026-06-17 | Public domain |