{"id":"GHSA-376v-xgjx-7mfr","summary":"fastify-bearer-auth vulnerable to Timing Attack Vector","details":"### 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)\n","aliases":["CVE-2022-31142"],"modified":"2023-11-08T04:09:27.360758Z","published":"2022-07-15T19:14:27Z","database_specific":{"github_reviewed_at":"2022-07-15T19:14:27Z","github_reviewed":true,"nvd_published_at":"2022-07-14T19:15:00Z","severity":"HIGH","cwe_ids":["CWE-203","CWE-208"]},"references":[{"type":"WEB","url":"https://github.com/fastify/fastify-bearer-auth/security/advisories/GHSA-376v-xgjx-7mfr"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31142"},{"type":"WEB","url":"https://github.com/fastify/fastify-bearer-auth/commit/0c468a616d7e56126dc468150f6a5a92e530b8e4"},{"type":"WEB","url":"https://github.com/fastify/fastify-bearer-auth/commit/39353b15409ee99474545f615ffb16180cf3b716"},{"type":"WEB","url":"https://github.com/fastify/fastify-bearer-auth/commit/f921a0582dc83112039004a9b5041141b50c5b3f"},{"type":"WEB","url":"https://hackerone.com/reports/1633287"},{"type":"PACKAGE","url":"https://github.com/fastify/fastify-bearer-auth"}],"affected":[{"package":{"name":"fastify-bearer-auth","ecosystem":"npm","purl":"pkg:npm/fastify-bearer-auth"},"ranges":[{"type":"SEMVER","events":[{"introduced":"5.0.1"},{"last_affected":"6.0.3"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/07/GHSA-376v-xgjx-7mfr/GHSA-376v-xgjx-7mfr.json"}},{"package":{"name":"@fastify/bearer-auth","ecosystem":"npm","purl":"pkg:npm/%40fastify/bearer-auth"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"7.0.2"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/07/GHSA-376v-xgjx-7mfr/GHSA-376v-xgjx-7mfr.json"}},{"package":{"name":"@fastify/bearer-auth","ecosystem":"npm","purl":"pkg:npm/%40fastify/bearer-auth"},"ranges":[{"type":"SEMVER","events":[{"introduced":"8.0.0"},{"fixed":"8.0.1"}]}],"versions":["8.0.0"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/07/GHSA-376v-xgjx-7mfr/GHSA-376v-xgjx-7mfr.json"}}],"schema_version":"1.7.3","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"}]}