Skip to content
CSRF Write-up Beginner

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.

Sumanth Yerranagula Follow

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.

Sumanth Yerranagula, on medium.com

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

  1. Log in as the test user and open the Change Email section.
  2. Copy the CSRF token from the email change form.
  3. Create an HTML form on the exploit server that posts to the change-email endpoint with the copied token and a new email address.
  4. 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.

More by Sumanth Yerranagula

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.