Insecure JSON Web Token (Weak Signing Secret)
- CWE 326
- OWASP 2025-A04
- OWASP 2025-A07
The token is signed with an HMAC algorithm (HS256, HS384 or HS512) and the secret that was used is a well known or easily guessable value, such as a word from a tutorial, a default configuration or the name of the site. Rapplex recovered the secret by checking the token against a list of common secrets, without contacting the server.
Knowing the secret allows anybody to sign tokens of their own. They can impersonate any user, including administrators, and change roles and permissions at will. The attack runs offline and cannot be detected or rate limited by the server.
Remediation
Replace the secret immediately with a random value of at least 256 bits generated by a cryptographically secure generator.
Invalidate every token that was signed with the old secret. All of them must be considered forged.
Store the secret outside the code base, in a secret manager or in protected server configuration, and never reuse it between environments.
Consider asymmetric signing (RS256, ES256, EdDSA) so that services that only verify tokens never hold a key that can sign them.
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