Attacking Signature Verification
When a web app does not properly verify JWT signatures, attackers can create or alter tokens to escalate privileges.
1. Missing Signature Verification
Vulnerability: Server trusts data from JWTs without verifying if the signature is valid.
Practical Exploit:
Log in to the app normally, extract your JWT from the session/cookie (e.g. using browser dev tools).
Decode the JWT header and payload (e.g. using https://jwt.io or CyberChef).
Change a low-privilege field such as
"isAdmin": falseto"isAdmin": truein the payload.Re-encode the JWT (do not re-sign, leave/break the signature, or reuse original signature bytes).
Replace your session cookie with the manipulated JWT.
Visit a protected page β if the backend does not verify the signature, you gain unauthorized access.
Typical Lab Workflow:
Login β steal JWT β manipulate β send as session β get admin.
Tools: jwt.lannysport.net, jwt.io, CyberChef for viewing/editing tokens.
2. 'none' Algorithm Attack (alg: none)
Vulnerability: Server accepts JWTs with
alg": "none"which disables signature checking entirely.Practical Exploit:
Recreate the JWT header:
{ "alg": "none", "typ": "JWT" }and encode using base64url.Craft the payload (e.g. set
"isAdmin": true).Encode the header and payload, concatenated with a period (e.g.
header.payload.).The JWT must end with a period (empty signature section!)
Set this token as your session cookie and access protected resources.
Example Tools:
In CyberChef: use "JWT Sign" with "None" as the signing algorithm to build a valid unsigned JWT.
Note:
Always check that a JWT-based application verifies signatures and never accepts
alg: noneunless required for a special reason (rare, almost always a vulnerability in auth context).Simple JWT alteration is not usually a productive attack unless these specific misconfigurations are present.
Last updated