Skip to content
CSRF Write-up Beginner

How a CSRF Vulnerability Can Be Exploited to Target Email Account

The email-change page did not properly validate its CSRF token, so a token could be reused. An attacker could trick a logged-in victim into submitting a crafted form that changes the account email or sends verification codes to an address the attacker chooses.

Dg0x6 Follow

Published on medium.com

In this article, I’ll guide you through a practical example of exploiting a Cross-Site Request Forgery (CSRF) vulnerability that allows an attacker to send unauthorized requests to change a user’s email address or send verification codes to a target email address. This walkthrough will cover how the vulnerability can…

Dg0x6, 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 server accepted a reused CSRF token instead of requiring a fresh, session-bound token for each request.

Impact

The attacker could flood the server with requests, change the victim's account email by sending verification codes to an arbitrary address, and perform other authenticated actions.

What the attacker needed

Victim is logged into the site; victim opens the attacker's page; attacker knows a valid CSRF token

The fix

The site should issue unique, session-bound CSRF tokens validated on every request, check Origin or Referer headers, rate-limit requests, and require re-authentication for sensitive changes.

How it was found

  1. Create an HTML page containing a copy of the legitimate email-change form with a reused token and the attacker's chosen email.
  2. Add JavaScript that clones and submits the form repeatedly with a short delay.
  3. Send the page to a victim who is logged into the site; opening it submits the requests automatically.

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 attack makes a logged-in user's browser send a request the user did not intend, because the site trusts any request that carries the user's session. Here the email-change form accepted a reused security token, so a page the attacker controls could submit that form on the victim's behalf. The result is that the victim's account email could be changed without their knowledge.

What is CSRF?

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

More by Dg0x6

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.