How I Found A JWT Token Vulnerability that Led to Full Account Ta
The application placed JWT tokens containing plaintext email and password in URLs, and allowed password changes without verifying the old password. An attacker who obtained a leaked token could log in as the user and change their password, leading to full account takeover.
Published on infosecwriteups.com
While testing example.com for security vulnerabilities through HackerOne, I discovered a critical flaw involving JWT tokens in URLs, which ultimately allowed me to take over any user’s account.
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 application embedded sensitive credentials in a JWT and exposed it in URLs, and the password change endpoint lacked verification of the current password.
Impact
An attacker could take over any user's account by obtaining a leaked token, logging in, and changing the password without knowing the old one.
What the attacker needed
A free account; access to a leaked JWT token
The fix
The application should not include sensitive data like passwords in JWTs, should not expose tokens in URLs, and should require the current password for password changes.
How it was found
- Sign up for an account and observe the email confirmation link containing a JWT token in the URL.
- Decode the JWT token to see the payload containing email and password in plaintext.
- Find leaked JWT tokens through reconnaissance.
- Decode leaked tokens to obtain valid email/password credentials.
- Log in using the leaked credentials and change the user's password without confirming the old password.
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 JWT is a token used to prove who you are, but it is only encoded, not encrypted, so anyone can read its contents. Here, the token included the user's email and password and was placed in a web address, which can leak through browser history or logs. An attacker who found such a token could log in as that user and change their password without knowing the old one, taking over the account.
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.