BREACHSPIDER
CVE databaseVendorsIntelFeaturesDevelopersDocsPricingSign inStart free trial

CVE-2022-31142 in Fastify Bearer-Auth

High 7.5

@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 ha...

Affects 1 product from 1 vendor. Facts below cite their sources.

CVSS 3.17.5
EPSS1.5%
EPSS percentile75th
FixUnknown

Remotely exploitable over the network, low complexity, no authentication required, no user interaction needed, impact contained to the vulnerable component, full confidentiality impact, no integrity impact, no availability impact.

Affected products and versions

VendorProductAffected versions
Fastify Bearer-Auth 8.0.0 ≥ 5.0.1, < 7.0.2

A product listed here is affected only at the versions shown. Use the free check to test the exact version you run.

Fix and vendor advisory

No official vendor advisory link on record. See the CVE record.

Exploitation

CISA known-exploitedNot in the CISA KEV catalog
Public exploitNot confirmed

Official 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.

Source: NIST NVD / MITRE CVE.

Record details

CVE IDCVE-2022-31142
BreachSpider IDBS-2022-GLOBAL-067167-H
CVSS vectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Published2022-07-14
Last modified2026-06-17
Weakness (CWE)
SourceNVD

Weakness definitions

CWE-203: CWE-203

CWE-208: CWE-208

Related attack patterns (CAPEC)

CAPEC-462 Cross-Domain Search Timing via CWE-208

CAPEC-189 Black Box Reverse Engineering via CWE-203

CAPEC-541 Application Fingerprinting via CWE-208

CAPEC-580 System Footprinting via CWE-208

Mapping is CWE to CAPEC per MITRE CAPEC 3.9.

Analysis AI-written, not human-reviewed

A vulnerability in @fastify/bearer-auth prior to versions 7.0.2 and 8.0.1 allows attackers to estimate the length of a valid bearer token due to insecure use of crypto.timingSafeEqual, potentially facilitating brute force attacks.

The vulnerability arises from the use of an insecure method for comparing bearer tokens, which can leak information about the token length through timing differences. This can be exploited by attackers to reduce the search space for brute force attacks on bearer tokens.

Questions

What is CVE-2022-31142?

A vulnerability in @fastify/bearer-auth prior to versions 7.0.2 and 8.0.1 allows attackers to estimate the length of a valid bearer token due to insecure use of crypto.timingSafeEqual, potentially facilitating brute force attacks.

What is the CVSS score for CVE-2022-31142?

CVE-2022-31142 has CVSS 7.5 (High). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N. EPSS: 1.5%.

Is CVE-2022-31142 actively exploited?

No confirmed active exploitation of CVE-2022-31142 as of 2026-09-25.

How do I remediate CVE-2022-31142?

Priority: HIGH.

What systems are affected by CVE-2022-31142?

CVE-2022-31142 affects Fastify Bearer-Auth.

For developers and AI agents

Run this check from your own code or agent

REST API

curl -s https://breachspider.com/api/v1/assets/correlate-cves \
 -H "Authorization: Bearer $BREACHSPIDER_API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"assets":[{"asset_id":"dev-1","vendor":"Fastify","product":"Bearer-Auth","version":"1.0"}]}'

API reference

Python SDK

pip install breachspider

PyPI · GitHub

MCP for AI agents

# hosted: add as a connector
https://mcp.breachspider.com/mcp
# local
pipx install breachspider-mcp

Setup for Claude, ChatGPT, Cursor

Free trial: 14 days, 750 device checks, no card.

Page facts from NVD, MITRE, CISA and vendor advisories, record last modified 2026-06-17.