JWT Claims Not Validated
| Severity | High |
|---|---|
| Checks | jwt.issuer_not_validated, jwt.claim_removal, jwt.scope_not_validated |
| Classifications | CWE-287: Improper Authentication, CWE-285: Improper Authorization |
| OWASP Category | OWASP API2:2023 Broken Authentication |
A valid signature only proves who signed the token. The server must also check that the token was issued by the expected issuer (iss), for this API (aud), for a subject (sub), that it is within its validity window (exp, nbf, iat), and that it grants the scope or role the operation needs.
Checks
Section titled “Checks”| Check | What it sends | Requires |
|---|---|---|
jwt.issuer_not_validated | The token given with --other-issuer-token, or the token re-signed with another iss | Another issuer’s token, or the signing key |
jwt.claim_removal | The token re-signed without iss, aud, sub, exp, nbf and iat, one at a time and all together | The signing key |
jwt.scope_not_validated | The token re-signed without its scope, scp, roles, role, groups, permissions and authorities claims | The signing key |
The token for another audience is covered by jwt.audience_not_validated.
The signing key is the HMAC secret cracked by the weak secret check (add it with --secret when you know it), or the private key given with --signing-key. Without it, these checks are skipped with a reason.
How to test?
Section titled “How to test?”jwtop crack [token] --url [url] --secret [known-secret]jwtop crack [token] --url [url] --signing-key private.pem --other-issuer-token [token-from-another-issuer]What is the impact?
Section titled “What is the impact?”A server that skips these checks accepts tokens issued for another tenant, realm or API of the same identity provider, tokens without a subject or expiry, and tokens stripped of their permissions, which leads to impersonation and privilege escalation.
How to remediate?
Section titled “How to remediate?”- Configure the JWT library to require and verify
iss,aud,expandsub, with the expected issuer and audience values. - Reject tokens missing a required claim instead of treating it as optional.
- Authorize each operation against the scope or role claims, and deny when they are absent.