Skip to content
All tools
TokensRuns locallyNo account

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 ctfpal

The 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 admin to true, change sub, extend exp.
  • 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.
The finished token, with the signature segment empty

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

Related tools