LiveActive security incident?Get immediate response
CVE Record

CVE-2022-31142: Potential Timing Attack Vector in @fastify/bearer-auth

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

HighCVSS 7.5Not KEV-listedUpdated
Glexia's TakeAutomated analysishigh

Security readout for executives and security teams

Plain-English summary

Applications using vulnerable Fastify bearer authentication may leak information about a valid token's length through timing differences. This does not directly grant access, but it weakens token secrecy and could aid attacks against APIs relying on static bearer tokens. Patched versions are available; the advisory names no workaround.

Executive priority

Prioritize remediation for public or partner-facing APIs that use this plugin with bearer tokens. The fix is a dependency upgrade, and delaying leaves token-based access controls weaker than intended. Treat as high priority where bearer tokens protect sensitive data or administrative operations.

Technical view

Improper comparison logic around crypto.timingSafeEqual creates a CWE-208 timing discrepancy. An unauthenticated network attacker could estimate the length of one valid bearer token. Affected versions include @fastify/bearer-auth before 7.0.2, version 8.0.0, and legacy fastify-bearer-auth from 5.0.1 through 6.0.3. Fixed releases are 7.0.2 and 8.0.1.

Likely exposure

Exposure is likely limited to Node.js Fastify applications that use the affected bearer-auth plugin for Authorization header enforcement. Internet-facing APIs using long-lived bearer tokens carry the highest concern. Systems not using these packages are not indicated as affected by the provided sources.

Exploitation context

The CVE has high CVSS severity and network attack characteristics, but the source bundle does not show CISA KEV listing or active exploitation. The issue supports information leakage through timing, which may assist further token attacks but is not described as a complete authentication bypass by itself.

Researcher notes

Focus validation on dependency presence, version ranges, and whether bearer tokens are static or long-lived. The sources support timing-based length disclosure, patched versions, and no workaround. They do not provide evidence of active exploitation or broader product impact beyond the named Fastify packages.

Mitigation direction

  • Upgrade @fastify/bearer-auth to 7.0.2, 8.0.1, or later.
  • Migrate legacy fastify-bearer-auth users to a patched @fastify/bearer-auth release.
  • Rotate bearer tokens after upgrading if token exposure is plausible.
  • Review vendor guidance because the advisory states no known workarounds.

Validation and detection

  • Check dependency manifests and lockfiles for @fastify/bearer-auth or fastify-bearer-auth versions.
  • Identify Fastify routes protected by the affected bearer authentication plugin.
  • Confirm deployed artifacts use patched package versions, not only updated source manifests.
  • Review access logs for unusual repeated authorization failures against protected API routes.
Prepared
Confidence
high
Sources
7

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · low confidence lookup

CWE-208: Exact CWE lookup

Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
description · low confidence lookup

Credential and access behavior lookup

The CVE wording references authentication or credential exposure, so valid-account and credential-access review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2022-31142 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
High
CVSS
7.5 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

1CVSS vectors
0Timeline events
0ADP providers
6Source links

CVSS vector scores

1 official score

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

ScoreVersionSeverityVectorExploitImpactSource
7.5CVSS 3.1HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N3.93.6Primary CVE score

Vulnerability scoring details

Base CVSS 3.1 score

7.5High
CVSS 3.1 vector shape for CVE-2022-31142Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone
Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
fastifyfastify-bearer-auth>= 5.0.1, < 7.0.2, = 8.0.0Listed
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.

CWE-208 · source CWE mapping

Observable Timing Discrepancy

Observable Timing Discrepancy represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.