Skip to main content

CVE-2026-35039

CRITICAL
Insufficient Verification of Data Authenticity (CWE-345)
2026-04-03 https://github.com/nearform/fast-jwt GHSA-rp9m-7r4c-75qg
9.1
CVSS 3.1 · GitHub Advisory
Share

Severity by source

GitHub Advisory PRIMARY
9.1 CRITICAL
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

Primary rating from GitHub Advisory · only source for this CVE.

CVSS VectorGitHub Advisory

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

Lifecycle Timeline

4
Re-analysis Queued
Apr 22, 2026 - 19:07 vuln.today
cvss_changed
Patch released
Apr 03, 2026 - 08:30 nvd
Patch available
Analysis Generated
Apr 03, 2026 - 04:15 vuln.today
CVE Published
Apr 03, 2026 - 04:07 nvd
CRITICAL 9.1

DescriptionGitHub Advisory

Impact

Setting up a custom cacheKeyBuilder method which does not properly create unique keys for different tokens can lead to cache collisions. This could cause tokens to be mis-identified during the verification process leading to:

  • Valid tokens returning claims from different valid tokens
  • Users being mis-identified as other users based on the wrong token

This could result in:

  • User impersonation - UserB receives UserA's identity and permissions
  • Privilege escalation - Low-privilege users inherit admin-level access
  • Cross-tenant data access - Users gain access to other tenants' resources
  • Authorization bypass - Security decisions made on wrong user identity

Affected Configurations

This vulnerability ONLY affects applications that BOTH:

  1. Enable caching using the cache option
  2. Use custom cacheKeyBuilder functions that can produce collisions

VULNERABLE examples:

// Collision-prone: same audience = same cache key
cacheKeyBuilder: (token) => {
  const { aud } = parseToken(token)
  return `aud=${aud}`
}

// Collision-prone: grouping by user type
cacheKeyBuilder: (token) => {
  const { aud } = parseToken(token)
  return aud.includes('admin') ? 'admin-users' : 'regular-users'
}

// Collision-prone: tenant + service grouping
cacheKeyBuilder: (token) => {
  const { iss, aud } = parseToken(token)
  return `${iss}-${aud}`
}

SAFE examples:

// Default hash-based (recommended)
createVerifier({ cache: true })  // Uses secure default

// Include unique user identifier
cacheKeyBuilder: (token) => {
  const { sub, aud, iat } = parseToken(token)
  return `${sub}-${aud}-${iat}`
}

// No caching (always safe)
createVerifier({ cache: false })

Not Affected

  • Applications using default caching
  • Applications with caching disabled

Assessment Guide

To determine if a consumer application is affected:

  1. Check if caching is enabled: Look for cache: true or cache: <number> in verifier configuration
  2. Check for custom cache key builders: Look for cacheKeyBuilder function in configuration
  3. Analyze collision potential: Review if the application's cacheKeyBuilder can produce identical keys for different users/tokens
  4. If no custom cacheKeyBuilder: The project is NOT affected (default is safe)

Mitigations

While fast-jwt will look to include a fix for this in the next version, immediate mitigations include:

  • Ensure uniqueness of keys produced in cacheKeyBuilder
  • Remove custom cacheKeyBuilder method
  • Disable caching

AnalysisAI

Cache key collisions in fast-jwt's custom cacheKeyBuilder implementations enable token confusion attacks, allowing remote attackers to impersonate users and escalate privileges without authentication. The vulnerability affects Node.js applications using fast-jwt with both caching enabled AND custom cache key builder functions that generate non-unique keys. No public exploit identified at time of analysis, though EPSS data unavailable and exploitation likelihood is high given the network-accessible attack vector (AV:N) and low complexity (AC:L). Applications using default caching behavior are NOT affected.

Technical ContextAI

Fast-jwt is an NPM package (pkg:npm/fast-jwt) providing JSON Web Token verification for Node.js applications. The vulnerability stems from CWE-345 (Insufficient Verification of Data Authenticity) in the token caching mechanism. When developers implement custom cacheKeyBuilder functions, the library uses the returned string as a cache lookup key for verified token data. If the key-building logic groups multiple distinct tokens under the same cache key-such as by audience alone rather than including unique identifiers like subject (sub) or issued-at (iat)-the cache returns cached claims from a different token. This breaks the fundamental security assumption that verified token data corresponds to the presented JWT, leading to identity confusion at the application layer. The default implementation uses a secure hash of the full token, making it collision-resistant, but the library permits developer override without validating uniqueness guarantees.

RemediationAI

Vendor-released patch available per GitHub advisory at https://github.com/nearform/fast-jwt/security/advisories/GHSA-rp9m-7r4c-75qg, though specific patched version number is not provided in available data. Immediate mitigation options include: remove custom cacheKeyBuilder implementations and rely on the secure default hash-based key generation; if custom builder is required, ensure uniqueness by including token-specific identifiers such as subject (sub), audience (aud), and issued-at timestamp (iat) in the cache key formula; disable caching entirely by setting cache to false in verifier configuration. Organizations should audit all fast-jwt deployments by searching codebases for cacheKeyBuilder function definitions and analyzing whether returned keys guarantee uniqueness across all possible token combinations. The advisory provides code examples distinguishing vulnerable patterns (grouping by audience or user type) from safe implementations (including sub, aud, and iat). Upgrade to patched version once available and verify configuration follows secure caching practices per advisory guidance.

Share

CVE-2026-35039 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy