pentesting, updated

Testing JSON Web Tokens

Check JWT signature verification, algorithm handling, claim trust and expiry — the most common sources of real JWT bugs.

Goal

Confirm the server actually verifies the JWT signature with a fixed, expected algorithm and doesn’t trust unverified claims.

How to test

Decode the token to inspect header and payload:

echo '<header>.<payload>.<sig>' | cut -d. -f1 | base64 -d   # header
echo '<header>.<payload>.<sig>' | cut -d. -f2 | base64 -d   # payload (claims)

Then try the classic bypasses:

# 1. alg:none — strip the signature, set alg to "none"
# 2. algorithm confusion — if alg is RS256, resign as HS256 using the public key as the HMAC secret
# 3. kid injection — if "kid" selects a key file/path, try path traversal or SQLi in its value

Also check exp/nbf enforcement, and whether a revoked/logged-out token is still accepted (stateless JWTs often aren’t checked against a blocklist).

What to look for

Any accepted token where the signature was stripped or forged, a claim (role, user ID) trusted without re-validation, or an expired/revoked token still honored.

Notes

See the site’s own JWT Decoder tool for quickly inspecting a captured token.

References

§ home
~/knubertus/home/
1,1 Top