I Hacked a Web App’s Email System with Just One Click (CSRF B
The web application's CSRF token was not tied to the user's session, so a token obtained from one account could be used to forge requests against another user. An attacker could change a victim's email address by delivering a crafted form that submits the reused token.
Published on medium.com
🧠 “Wait… CSRF tokens are supposed to protect websites. So how did I still break in?” Yeah, that’s what I thought too.
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 generated CSRF tokens that were valid across sessions instead of binding each token to the user's session.
Impact
An attacker could change a victim's email address without their consent, which could lead to account takeover, though the text does not demonstrate that further step.
What the attacker needed
A free account on the lab; victim clicks a link or visits attacker page; attacker obtains a valid CSRF token
The fix
The application should tie each CSRF token to the user's session so that a token from one session cannot be used in another.
How it was found
- Log in as the test user and open the Change Email section.
- Copy the CSRF token from the email change form.
- Create an HTML form on the exploit server that posts to the change-email endpoint with the copied token and a new email address.
- Deliver the exploit to the victim so their browser submits the form.
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 CSRF token is a secret value a website puts in forms to prove a request came from its own pages, not from an attacker's site. Here the token was not linked to the specific logged-in user, so a token taken from one account still worked for another. That let an attacker make a victim's browser change the victim's email address without the victim knowing.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.