Skip to content
StrikeOps

JSON Web Token (JWT) Validation Weaknesses

HighTypical severity Web applications and APIsCWE-347

01Description

The application's handling of JSON Web Tokens was weak, for example accepting unsigned tokens, allowing algorithm switching, using a guessable signing secret, or issuing tokens without expiry.

02Impact

Where tokens can be forged or modified, an attacker can impersonate any user or grant themselves additional roles. Long-lived tokens extend the usefulness of any stolen token.

03Severity

Typically

High

Typically High. Critical where tokens can be forged (for example with the none algorithm, algorithm confusion or a crackable secret). Medium for weaknesses such as missing expiry.

04How to verify

  1. 1Decode tokens and review the algorithm, claims and expiry.
  2. 2Test acceptance of tokens with the alg set to none and with modified claims.
  3. 3Attempt offline cracking of HMAC secrets against common wordlists.
  4. 4Test algorithm confusion between asymmetric and symmetric algorithms.

Testing note: only test systems you are authorized to test, within the agreed scope and rules of engagement. Verification steps are written for professional testers and avoid destructive techniques.

05Remediation

  1. 1Validate signatures with a fixed, expected algorithm using a maintained library.
  2. 2Use long random secrets or asymmetric keys, and rotate them.
  3. 3Set short expiry times and validate audience and issuer claims.
  4. 4Support token revocation for logout and compromise.

06References

Draft findings like this from your own evidence

Book a demo
Book a demo