{"id":"CVE-2022-31142","aliases":["CVE-2022-31142","GHSA-376v-xgjx-7mfr"],"related":[],"kind":"vulnerability","state":"published","title":"Potential Timing Attack Vector in @fastify/bearer-auth","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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"@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.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nfastify-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.\n\nAll versions of fastify-bearer-auth are also affected.\n\n### Patches\n\nWe released:\n\n* v8.0.1 with a fix for the Fastify v4 line\n* v7.0.2 with a fix for the Fastify v3 line\n\n### Workarounds\n\nThere are no workarounds. Update your dependencies.\n\n### References\n\nhttps://hackerone.com/reports/1633287\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [https://github.com/fastify/fastify-bearer-auth](https://github.com/fastify/fastify-bearer-auth)\n* Email us at [hello@matteocollina.com](mailto:hello@matteocollina.com)","format":"markdown","source":"ghsa"},{"lang":"es","text":"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","source":"nvd"}],"published":"2022-07-14T18:55:11.000Z","modified":"2026-06-17T04:44:53.493Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-203","CWE-208"],"affected":[{"ranges":[{"version":">= 5.0.1, < 7.0.2","status":"affected"},{"version":"= 8.0.0","status":"affected"}],"vendor":"fastify","product":"fastify-bearer-auth","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"5.0.1","status":"affected","lastAffected":"6.0.3"}],"ecosystem":"npm","package":"fastify-bearer-auth","purl":"pkg:npm/fastify-bearer-auth","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"7.0.2"}],"ecosystem":"npm","package":"@fastify/bearer-auth","purl":"pkg:npm/%40fastify/bearer-auth","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"8.0.0","status":"affected","fixed":"8.0.1"}],"ecosystem":"npm","package":"@fastify/bearer-auth","purl":"pkg:npm/%40fastify/bearer-auth","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"5.0.1","fixed":"7.0.2"},{"status":"affected","version":"8.0.0"}],"vendor":"fastify","product":"bearer-auth","cpe":"cpe:2.3:a:fastify:bearer-auth:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/fastify/fastify-bearer-auth/security/advisories/GHSA-376v-xgjx-7mfr","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/fastify/fastify-bearer-auth/commit/0c468a616d7e56126dc468150f6a5a92e530b8e4","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/fastify/fastify-bearer-auth/commit/39353b15409ee99474545f615ffb16180cf3b716","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/fastify/fastify-bearer-auth/commit/f921a0582dc83112039004a9b5041141b50c5b3f","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://hackerone.com/reports/1633287","tags":["permissions-required","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31142","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/fastify/fastify-bearer-auth","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2025-04-23T15:53:32.961Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-31142","url":"https://www.cve.org/CVERecord?id=CVE-2022-31142","licence":"CVE Terms of Use","modified":"2025-04-23T18:02:16.307Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-376v-xgjx-7mfr","url":"https://github.com/advisories/GHSA-376v-xgjx-7mfr","licence":"CC-BY-4.0","modified":"2023-11-08T04:09:27.360Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-31142","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31142","licence":"Public domain","modified":"2026-06-17T04:44:53.493Z"}],"updatedAt":"2026-11-25T22:58:12.953Z","epss":{"score":0.01532,"percentile":0.75534,"date":"2026-12-01T12:00:22.000Z"}}