Insecure JSON Web Token (Untrusted Key Reference)
- CWE 347
- OWASP 2025-A04
- OWASP 2025-A07
The header of the token contains a parameter that influences which key is used to verify it: jku (URL of a key set), x5u (URL of a certificate), jwk (a key embedded in the token), or a kid (key identifier) value with path or query characters in it.
When the verifier follows these values blindly, an attacker can make it fetch the verification key from a server under their control, accept a key that they embedded, or steer a file or database lookup with the key identifier (path traversal, SQL injection), and then sign tokens with the matching private key.
Rapplex only reports the presence of the parameter, since the behavior of the verifier cannot be told from a token alone. It is worth testing whether the server follows it.
Remediation
Ignore
jku,x5uandjwkunless the value matches a strict allow-list that is configured on the server.Look keys up by
kidin a fixed set and treat the value as data. Never use it to build a file path or a query.Reject tokens whose key reference is not recognized.
References
Search Vulnerability
You may also see
- Insecure JSON Web Token (Unsigned)
- Insecure JSON Web Token (Weak Signing Secret)
- Insecure JSON Web Token (Missing Expiration)
- Insecure JSON Web Token (Excessive Lifetime)
- Insecure JSON Web Token (Sensitive Claims)
- Insecure JSON Web Token (Untrusted Key Reference)
- Insecure JSON Web Token (Exposed in URL)
- Insecure JSON Web Token (Cleartext Transmission)
- Insecure JSON Web Token
- Insecure Session Management