How I Took Admin Account via JWT Bypass
The application used JWT for authentication but failed to verify the token's algorithm and signature. An attacker could modify JWT claims to impersonate an admin and gain full access to the admin panel.
Published on medium.com
In web applications, JSON Web Tokens (JWT) have become a popular choice for handling authentication and authorization. They offer a simple and efficient way to manage user sessions and access control.
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
Likely the server accepted JWTs with the 'none' algorithm and did not validate the signature, allowing attackers to forge tokens.
Impact
The attacker could manage events, access customer data, and modify user accounts, leading to complete compromise of the platform.
What the attacker needed
A free account; ability to intercept HTTP traffic
The fix
The application should properly validate JWT signatures and reject tokens with insecure algorithms like 'none'.
How it was found
- Create a regular account on the platform.
- Inspect the JavaScript source code to find admin user IDs and email addresses.
- Log in with regular credentials and capture the JWT using Burp Suite.
- Modify the JWT claims to set the user ID and email to the admin's, change the role to admin, and set the algorithm to none.
- Forward the modified token to the browser, which accepted it and granted admin access.
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 (JWT) is like a digital ID card that a website gives you after you log in. The website is supposed to check that the ID card is genuine (by verifying its signature) before trusting it. Here, the website did not check, so the attacker could change the ID card to say they were an admin and get in.
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.