{"schemaVersion":3,"id":"CVE-2022-31142","aliases":["GHSA-376v-xgjx-7mfr"],"status":"published","duplicateOf":null,"title":null,"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.01496,"percentile":0.73804,"severity":"low","asOf":"2026-10-19T00:00:00.000Z","change":{"pp":0.04299999999999998,"baselineDate":"2026-09-19T00:00:00.000Z","baselineScore":0.01453},"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":0.73804}],"last30":[{"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":0.73804}]},"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},{"text":"8.0.0","noFixRecorded":false,"fixedIn":null}],"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},{"text":"= 8.0.0","noFixRecorded":false,"fixedIn":null}],"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}],"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},{"text":"≥ 8.0.0, < 8.0.1","noFixRecorded":false,"fixedIn":null}],"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}],"risk":{"score":30,"level":"medium","profile":"Default","thresholds":{"critical":75,"high":50,"medium":25,"low":10}},"meta":{"dataAsOf":"2026-10-20T13:57:51.585Z","stale":false,"partial":false}}