{"schemaVersion":4,"id":"CVE-2022-31142","aliases":["GHSA-376v-xgjx-7mfr"],"status":"published","duplicateOf":null,"title":"Potential Timing Attack Vector in @fastify/bearer-auth","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.","dates":{"published":"2022-07-14T18:55:11.000Z","modified":"2025-04-23T18:02:16.307Z","reserved":null,"kevAdded":[],"kevDue":[]},"cvss":{"headline":{"score":7.5,"severity":"high","version":"3.1","versionLabel":"v3.1","source":"CVE.org","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","computed":false,"selection":"backend-summary"},"metrics":[{"version":"3.1","versionLabel":"v3.1","source":"CVE.org","score":7.5,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","exploitability":null,"impact":null,"computed":false},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Npm","score":7.5,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","exploitability":10,"impact":6,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"NVD","score":7.5,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","exploitability":null,"impact":null,"computed":false}]},"epss":{"probability":0.01556,"percentile":0.76039,"severity":"low","asOf":"2026-12-04T00:00:00.000Z","change":{"pp":0.059999999999999984,"baselineDate":"2026-11-04T00:00:00.000Z","baselineScore":0.01496},"history":[{"date":"2026-09-14T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-15T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-16T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-17T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-18T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-19T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-20T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-21T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-22T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.01453,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-20T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-21T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-22T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-23T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-24T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-25T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-26T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-27T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-28T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-29T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-30T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-10-31T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-01T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-02T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-03T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-04T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-05T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-06T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-07T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-08T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-09T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-10T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-11T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-12T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-13T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-14T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-15T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-16T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-17T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-18T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-19T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-20T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-21T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-22T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-23T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-24T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-25T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-11-26T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-11-27T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-11-28T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-11-29T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-11-30T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-12-01T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-12-02T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-12-03T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-12-04T00:00:00.000Z","score":0.01556,"percentile":0.76039}],"last30":[{"date":"2026-11-04T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-05T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-06T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-07T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-08T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-09T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-10T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-11T00:00:00.000Z","score":0.01496,"percentile":null},{"date":"2026-11-12T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-13T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-14T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-15T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-16T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-17T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-18T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-19T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-20T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-21T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-22T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-23T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-24T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-11-25T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-11-26T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-11-27T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-11-28T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-11-29T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-11-30T00:00:00.000Z","score":0.01545,"percentile":null},{"date":"2026-12-01T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-12-02T00:00:00.000Z","score":0.01532,"percentile":null},{"date":"2026-12-03T00:00:00.000Z","score":0.01556,"percentile":null},{"date":"2026-12-04T00:00:00.000Z","score":0.01556,"percentile":0.76039}]},"kev":{"state":"not-listed","entries":[],"listedCount":0,"totalCatalogs":3,"catalogs":[{"source":"cisa","label":"CISA","listed":false,"entry":null},{"source":"enisa","label":"ENISA","listed":false,"entry":null},{"source":"circl","label":"CIRCL","listed":false,"entry":null}]},"ransomware":{"state":"none-recorded","sources":[]},"exploits":[],"exploitCount":0,"weaknesses":[{"id":"CWE-208","name":"Observable Timing Discrepancy","description":"Two separate operations in a product require different amounts of time to complete, in a way that is observable to an actor and reveals security-relevant information about the state of the product, such as whether a particular operation was successful or not.","type":"weakness","status":"Incomplete","abstraction":"Base","likelihoodOfExploit":null,"url":"https://cwe.mitre.org/data/definitions/208.html"},{"id":"CWE-203","name":"Observable Discrepancy","description":"The product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor.","type":"weakness","status":"Incomplete","abstraction":"Base","likelihoodOfExploit":null,"url":"https://cwe.mitre.org/data/definitions/203.html"}],"affected":[{"vendor":"fastify","product":"bearer-auth","name":"bearer-auth","label":"bearer-auth","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"≥ 5.0.1, < 7.0.2","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":"5.0.1","startInclusive":true,"end":"7.0.2","endInclusive":false}},{"text":"8.0.0","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"exact","version":"8.0.0"}}],"versionsText":"≥ 5.0.1, < 7.0.2 | 8.0.0","eol":null,"hubHref":"/vendor/fastify/bearer-auth"},{"vendor":"fastify","product":"fastify-bearer-auth","name":"fastify-bearer-auth","label":"fastify-bearer-auth","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"≥ 5.0.1, < 7.0.2","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":"5.0.1","startInclusive":true,"end":"7.0.2","endInclusive":false}},{"text":"= 8.0.0","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":"= 8.0.0","startInclusive":true,"end":"= 8.0.0","endInclusive":true}}],"versionsText":"≥ 5.0.1, < 7.0.2 | = 8.0.0","eol":null,"hubHref":"/vendor/fastify/fastify-bearer-auth"},{"vendor":"Npm","product":"fastify-bearer-auth","name":"fastify-bearer-auth","label":"fastify-bearer-auth","ecosystem":"Npm","cpePart":null,"purl":"pkg:npm/fastify-bearer-auth","purlType":"npm","versions":[{"text":"≥ 5.0.1, ≤ 6.0.3","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":"5.0.1","startInclusive":true,"end":"6.0.3","endInclusive":true}}],"versionsText":"≥ 5.0.1, ≤ 6.0.3","eol":null,"hubHref":null},{"vendor":"@fastify","product":"bearer-auth","name":"@fastify/bearer-auth","label":"bearer-auth","ecosystem":"Npm","cpePart":null,"purl":"pkg:npm/@fastify/bearer-auth","purlType":"npm","versions":[{"text":"< 7.0.2","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":null,"startInclusive":true,"end":"7.0.2","endInclusive":false}},{"text":"≥ 8.0.0, < 8.0.1","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":"8.0.0","startInclusive":true,"end":"8.0.1","endInclusive":false}}],"versionsText":"< 7.0.2 | ≥ 8.0.0, < 8.0.1","eol":null,"hubHref":null}],"affectedCount":4,"eol":{"hasEol":false,"count":0},"references":[{"url":"https://github.com/fastify/fastify-bearer-auth/security/advisories/GHSA-376v-xgjx-7mfr","label":"github.com/fastify/fastify-bearer-auth/security/advisories/GHSA-376v-xgjx-7mfr","hostname":"github.com","tags":["X Refsource CONFIRM","WEB","Third Party Advisory"]},{"url":"https://github.com/fastify/fastify-bearer-auth/commit/0c468a616d7e56126dc468150f6a5a92e530b8e4","label":"github.com/fastify/fastify-bearer-auth/commit/0c468a616d7e56126dc468150f6a5a92e530b8e4","hostname":"github.com","tags":["X Refsource MISC","WEB","Patch","Third Party Advisory"]},{"url":"https://github.com/fastify/fastify-bearer-auth/commit/39353b15409ee99474545f615ffb16180cf3b716","label":"github.com/fastify/fastify-bearer-auth/commit/39353b15409ee99474545f615ffb16180cf3b716","hostname":"github.com","tags":["X Refsource MISC","WEB","Patch","Third Party Advisory"]},{"url":"https://github.com/fastify/fastify-bearer-auth/commit/f921a0582dc83112039004a9b5041141b50c5b3f","label":"github.com/fastify/fastify-bearer-auth/commit/f921a0582dc83112039004a9b5041141b50c5b3f","hostname":"github.com","tags":["X Refsource MISC","WEB","Patch","Third Party Advisory"]},{"url":"https://hackerone.com/reports/1633287","label":"hackerone.com/reports/1633287","hostname":"hackerone.com","tags":["X Refsource MISC","WEB","Permissions Required","Third Party Advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31142","label":"nvd.nist.gov/vuln/detail/CVE-2022-31142","hostname":"nvd.nist.gov","tags":["Advisory"]},{"url":"https://github.com/fastify/fastify-bearer-auth","label":"github.com/fastify/fastify-bearer-auth","hostname":"github.com","tags":["PACKAGE"]}],"lineage":{"upstream":[],"downstream":[],"duplicates":[],"related":[]},"timeline":[{"kind":"published","date":"2022-07-14T18:55:11.000Z","label":"Published","detail":"Vulnerability first disclosed.","source":null},{"kind":"modified","date":"2025-04-23T18:02:16.307Z","label":"Last modified","detail":"Vulnerability information updated.","source":null}],"priority":{"label":"prioritise","tag":"severe","reason":"Severe, CVSS 7.5 (CVE.org); no exploitation reported by the 5 checked sources; EPSS 2% (FIRST, 04-12-2026)","nextStep":"Check applicability and the vendor advisory: no fix release is recorded here","rank":[0,0,0,0,2,75],"checkedSources":["cisa","enisa","circl","shadowserver","cisa-adp"],"evidence":[{"type":"epss","source":"FIRST","date":"2026-12-04T00:00:00.000Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"value":0.01556,"stale":false,"promoted":null},{"type":"cvss","source":"cve.org","date":"2025-04-23T18:02:16.307Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","version":"3.1","headline":true},{"type":"cvss","source":"osv_npm","date":"2025-04-23T18:02:16.307Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","version":"3.1"},{"type":"cvss","source":"nvd","date":"2025-04-23T18:02:16.307Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","version":"3.1"},{"type":"adp","source":"cisa-adp","date":"2025-04-23T15:53:32.961Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"exploitation":"none"}],"epss":{"value":0.01556,"date":"2026-12-04T00:00:00.000Z","stale":false,"promoted":null},"sources":[{"id":"cisa","lastSuccessfulSync":"2026-12-05T09:01:26.874Z","state":"fresh"},{"id":"enisa","lastSuccessfulSync":"2026-12-05T09:01:27.430Z","state":"fresh"},{"id":"circl","lastSuccessfulSync":"2026-12-05T09:01:27.610Z","state":"fresh"},{"id":"shadowserver","lastSuccessfulSync":null,"state":"unavailable"},{"id":"cisa-adp","lastSuccessfulSync":"2026-12-05T09:01:02.756Z","state":"fresh"},{"id":"epss","lastSuccessfulSync":"2026-12-05T09:01:25.188Z","state":"fresh"},{"id":"osv","lastSuccessfulSync":"2026-12-05T09:01:24.136Z","state":"fresh"}],"feedEvent":null},"meta":{"dataAsOf":"2026-12-05T10:03:54.630Z","stale":false,"partial":false}}