JWT alg=none bypass generator
Forge an unsigned JWT by setting the algorithm to none, and understand why some libraries still accept it.
Open in ctfpalThe JWT specification includes none as a legitimate algorithm, meaning the token is unsigned. The vulnerability appears when a library reads the algorithm from the token and dispatches on it: an attacker who sets alg to none and drops the signature is telling the verifier not to verify, and a naive verifier obliges.
Constructing the token
- Set the header to
{"alg":"none","typ":"JWT"}. - Edit the payload claims - flip
adminto true, changesub, extendexp. - Base64-URL encode both, strip padding, join with a dot.
- Append a trailing dot with an empty signature. Some implementations require the dot; some accept the token without it. Try both.
Authorization: Bearer eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJ1c2VyIjoiYWRtaW4iLCJhZG1pbiI6dHJ1ZX0.Variants worth trying
Libraries that block none often compare case-sensitively, so None, NONE, and nOnE are worth a try. The related attack is algorithm confusion: take an RS256 token, change alg to HS256, and sign it with the server’s public key as the HMAC secret. If the verifier picks the HMAC path but still loads the RSA public key as key material, the signature checks out.
Part of a module
6. Web attacks and session tokens
Read and forge JWTs and Flask sessions, find content nobody linked to, and probe for injection with detection payloads.
Practise on real challenges
Go deeper
- Attacking JWTs: alg=none, algorithm confusion, and the header fields nobody auditsA JSON Web Token is a signed claim you were handed and asked to give back. Every classic JWT bug is a place where the verifier lets the token choose how it is verified - alg=none, RS256 to HS256 confusion, kid injection, and attacker-hosted key URLs.
Related tools
JWT decoder and signature verifier
Decode a JSON Web Token’s header and payload and verify HS256/HS384/HS512 signatures against a known secret - all locally.
JWT secret brute force
Recover a weak HMAC signing secret from a JWT by testing a wordlist against the token’s own signature, in the browser.
Web attack payload catalog
Curated payloads for SQL injection, XSS, SSTI, SSRF, GraphQL, and deserialization, organised by what you are trying to establish.