Exploiting JWT - Lack of Signature Verification
The application accepted JSON Web Tokens whose signature had been removed, so the token's contents were not verified. An attacker could modify the payload and re-encode it to take over another user's account.
Published on blog.dixitaditya.com
JSON Web Tokens are one of the most in-trend authentication mechanisms that are currently being used in modern applications to protect their data and maintain a tight access control over their apps and API endpoints.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The server did not verify the JWT signature at all, so any token with a valid-looking structure was accepted regardless of whether it had been signed.
Impact
An attacker could forge tokens and take over other users' accounts.
What the attacker needed
A valid JWT cookie from any account
How it was found
- Capture a request containing the authentication JWT cookie.
- Keep the header algorithm as HS256 and remove the signature part of the token.
- Send the modified token and observe that the request still succeeds.
- Change the clientid parameter in the payload and re-encode the token.
- Use the forged token to access another user's account.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A JSON Web Token is a small piece of data a website gives you after you log in, and it is supposed to be signed so the site can tell it has not been changed. Here the site never checked that signature, so anyone could edit the token's contents and the site would still trust it. That let the author change which account the token pointed to and log in as someone else.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.