fast-jwt Cache Collision Vulnerability Leading to Identity Confusion

Vulnerability

A critical vulnerability exists in fast-jwt versions 0.0.1 prior to 6.1.0, allowing for cache collisions that can misidentify JSON Web Tokens (JWTs) during verification. This issue arises when a custom cacheKeyBuilder method fails to create unique keys for different tokens, leading to valid tokens incorrectly returning claims from others. As a result, users may be misidentified as other users based on the wrong token, potentially allowing for user impersonation, privilege escalation, cross-tenant data access, and authorization bypass.

Impact

Exploitation of this vulnerability causes a logical authorization flaw by creating confusion between identities and their associated claims. This mix-up can lead to user impersonation, where one user gains access to another's identity and permissions, and privilege escalation, allowing low-privilege users to inherit admin-level access. Additionally, it can cause cross-tenant data access, where users access resources from other tenants, and bypass security decisions based on incorrect user identities.

Reproduction

To reproduce this vulnerability, create a verifier with caching enabled and a custom cacheKeyBuilder that generates identical keys for different tokens. When this verifier processes tokens that should be distinct, it will return claims from one token for the other, demonstrating the cache collision and resulting identity confusion.

Remediation

To address this vulnerability, ensure that custom cacheKeyBuilder methods generate unique keys for each token. Alternatively, remove the custom cacheKeyBuilder and disable caching altogether.

Added: Apr 6, 2026, 5:27 PM
Updated: Apr 6, 2026, 5:27 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
1.3
exploitability
4.6
remediation
8.3
relevance
5.4
threat
6.4
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.