Skip to content
CSRF Write-up Beginner

Account Takeover via CSRF on the Email-Change Endpoint $1,300 Bou

The email-change endpoint accepted cross-site POST requests without any anti-CSRF protection, so an attacker could silently change a logged-in victim's account email to one they controlled. A standard password reset then completed a full account takeover.

Gautam Sharma Follow

Published on medium.com

The email change endpoint accepted a cross-site POST with no anti-CSRF protection. A logged in victim who opened an attacker-controlled page had their account email silently changed to one the attacker owned from there, a standard password reset completed a full account takeover.

Gautam Sharma, 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 endpoint lacked a CSRF token and the session cookie was not marked SameSite, so a cross-site POST was accepted with the victim's session; additionally, email changes were applied immediately without re-authentication or verification of the new address.

Impact

Full account takeover, reachable against any logged-in user who opens a page, giving the attacker access to the victim's stored files.

What the attacker needed

Victim is logged in; victim opens attacker's page

The fix

The endpoint should require a CSRF token, set the session cookie to SameSite=Lax or Strict, and treat email change as sensitive by requiring re-authentication and verifying the new address before it becomes the account identity.

How it was found

  1. Victim opens the attacker's page, which auto-submits a form to the email-change endpoint.
  2. The victim's email is changed to the attacker's address.
  3. Attacker requests a password reset for the account.
  4. The reset link arrives in the attacker's inbox.
  5. Attacker sets a new password and takes over the account.

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.

When you log into a website, your browser stores a cookie that proves who you are. If a website changes important settings (like your email) based only on that cookie, another website can trick your browser into sending that change request without you knowing. Here, an attacker could change your email to theirs, then use the 'forgot password' link to take over your account.

What is CSRF?

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

More by Gautam Sharma

View all

1 more disclosed report, 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.