Playing with JSON Web Tokens for Fun and Profit
The application issued JWTs for email confirmation and password reset that were not properly signature-validated, allowing the author to change the email and user ID in the token to confirm another user's account and reset their password. This led to account takeover of an admin account and access to company SSO integrations.
Published on blog.securitybreached.org
Today I wanna share something related JSON Web Tokens (JWT). In this writeup, I’ll tell you how I was able to confirm emails without confirmation tokens, reset password as well as taking over company emails.
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 did not validate the JWT signature, allowing the token payload to be modified and re-encoded.
Impact
An attacker could confirm arbitrary user accounts, set their passwords, and take over company emails, potentially accessing SSO integrations like support panels.
What the attacker needed
Ability to invite users; access to own email inbox; knowledge of target user ID
How it was found
- Invite your own email address and receive a confirmation token in your inbox.
- Invite the target email address (e.g., [redacted]) and capture the response.
- Decode the JWT from your own confirmation email.
- Change the email and user ID in the token to the target's values, and adjust the timestamp to match the issued time.
- Use the modified token to confirm the target user and set their password.
- For password reset, request a reset link with your own email, then change the user ID in the JWT to the target's ID.
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 a small piece of data a website gives you to prove who you are. It is signed so the server can check it has not been changed. Here the server did not check the signature properly, so the author could edit the token to pretend to be someone else and take over their 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.