CVE-2025-59936 Overview
CVE-2025-59936 is a cache poisoning vulnerability in the get-jwks library, a utility package for fetching JSON Web Key Sets (JWKS) keys. In versions prior to 11.0.2, a design flaw in the JWKS key-fetching mechanism allows cached keys from an unexpected issuer to be reused when the iss (issuer) claim is validated only after keys are retrieved from the cache. This authentication bypass enables malicious actors to craft JWT pairs that leverage cached public keys to pass signature validation for arbitrary issuer values.
Critical Impact
Attackers can bypass JWT issuer validation by poisoning the shared JWKS cache, potentially gaining unauthorized access to protected resources through forged authentication tokens.
Affected Products
- get-jwks versions prior to 11.0.2
Discovery Timeline
- 2025-09-27 - CVE CVE-2025-59936 published to NVD
- 2025-09-29 - Last updated in NVD database
Technical Details for CVE-2025-59936
Vulnerability Analysis
The vulnerability exists in the cache key generation mechanism of get-jwks. When fetching JWKS keys, the library stores retrieved public keys in a shared cache without properly incorporating the normalized domain (issuer) into the cache key. This design flaw creates a race condition where an attacker can pre-populate the cache with their own public key by presenting a crafted JWT from an attacker-controlled domain first.
The attack works only when iss validation occurs after get-jwks retrieves keys from cache. In this scenario, the attacker crafts two JWTs: the first ensures a chosen public key is fetched and cached, while the second leverages that cached key to pass signature validation for a different, targeted issuer value.
Root Cause
The root cause is classified under CWE-116 (Improper Encoding or Escaping of Output). The vulnerability stems from insufficient isolation of cache entries across different issuers. The cache key structure did not include the normalized domain as a differentiator, allowing keys from one issuer to be inadvertently used for validating tokens claiming a different issuer.
Attack Vector
The attack is network-based and requires no authentication or user interaction. An attacker exploiting this vulnerability would:
- Set up a malicious JWKS endpoint with a controlled key pair
- Send an initial request with a JWT pointing to the attacker's issuer, causing the malicious public key to be cached
- Craft a second JWT claiming a legitimate target issuer but signed with the attacker's private key
- The cached attacker key is used for validation since cache lookup occurs before issuer validation
- The signature validates successfully, bypassing issuer authentication
The patch introduces a CACHE_KEY_DELIMITER and a generateCacheKey function that properly incorporates the normalized domain into cache keys:
type GetJwks = {
+ generateCacheKey: (alg: string, kid: string, normalizedDomain: string) => string
getPublicKey: (options?: GetPublicKeyOptions) => Promise<string>
getJwk: (signature: JWKSignature) => Promise<JWK>
getJwksUri: (normalizedDomain: string) => Promise<string>
Source: GitHub Commit
const ONE_MINUTE = 60 * 1000
const FIVE_SECONDS = 5 * 1000
+const CACHE_KEY_DELIMITER = ':'
function ensureTrailingSlash(domain) {
return domain[domain.length - 1] === '/' ? domain : `${domain}/`
Source: GitHub Commit
Detection Methods for CVE-2025-59936
Indicators of Compromise
- Unusual JWT validation attempts with mismatched issuer claims and signing key sources
- Multiple authentication requests from the same source using different issuer values in short succession
- JWKS endpoint requests to unexpected or previously unseen domains
- Authentication success logs where token issuer doesn't match expected application configuration
Detection Strategies
- Monitor dependency versions and alert on applications using get-jwks versions below 11.0.2
- Implement logging around JWT validation to track issuer claims and key retrieval sources
- Deploy runtime application security monitoring to detect authentication anomalies
- Use software composition analysis (SCA) tools to identify vulnerable library versions in your codebase
Monitoring Recommendations
- Review authentication logs for patterns indicating cache poisoning attempts
- Monitor network traffic to JWKS endpoints for requests to unauthorized domains
- Set up alerts for authentication successes with untrusted or unexpected issuer values
- Implement rate limiting on JWKS fetching to reduce attack surface for cache poisoning
How to Mitigate CVE-2025-59936
Immediate Actions Required
- Upgrade get-jwks to version 11.0.2 or later immediately
- Review application code to ensure issuer validation occurs before or during key retrieval, not after
- Audit recent authentication logs for potential exploitation attempts
- Clear existing JWKS caches after patching to remove potentially poisoned entries
Patch Information
The vulnerability has been patched in get-jwks version 11.0.2. The fix introduces proper cache key generation that includes the normalized domain, ensuring cache isolation between different issuers. The patch commit is available at the GitHub repository. Additional details are available in the GitHub Security Advisory.
Workarounds
- Implement issuer validation before calling get-jwks key retrieval functions
- Restrict allowed issuers to a predefined allowlist in your application configuration
- Add middleware validation to reject JWTs with unexpected issuer claims before JWKS lookup
- Consider implementing separate cache instances per trusted issuer if immediate upgrade is not possible
# Update get-jwks to patched version
npm update get-jwks@11.0.2
# Or install specific patched version
npm install get-jwks@^11.0.2
# Verify installed version
npm list get-jwks
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


