Skip to content

JWT Claims Not Validated

SeverityHigh
Checksjwt.issuer_not_validated, jwt.claim_removal, jwt.scope_not_validated
ClassificationsCWE-287: Improper Authentication, CWE-285: Improper Authorization
OWASP CategoryOWASP 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.

CheckWhat it sendsRequires
jwt.issuer_not_validatedThe token given with --other-issuer-token, or the token re-signed with another issAnother issuer’s token, or the signing key
jwt.claim_removalThe token re-signed without iss, aud, sub, exp, nbf and iat, one at a time and all togetherThe signing key
jwt.scope_not_validatedThe token re-signed without its scope, scp, roles, role, groups, permissions and authorities claimsThe 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.

Terminal window
jwtop crack [token] --url [url] --secret [known-secret]
jwtop crack [token] --url [url] --signing-key private.pem --other-issuer-token [token-from-another-issuer]

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.

  • Configure the JWT library to require and verify iss, aud, exp and sub, 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.