Skip to content
CSRF Write-up Intermediate

A Unique Case of One-Click Account Takeover via CSRF Chain

The profile update endpoint lacked CSRF protection and did not require the current password, allowing an attacker to change a victim's password and email. By chaining an email confirmation leak and Cloudflare Email Routing, the attacker could automate the theft of the victim's email and username, achieving one-click account takeover.

medium.com

Published on medium.com

Hello everyone! Today I want to walk through an account takeover vulnerability I found recently.

Sepehr Pirhayati, 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 did not validate anti-CSRF tokens, did not check Origin or Referer headers, and did not require the current password for sensitive changes.

Impact

An attacker could achieve full account takeover with a single click from the victim, changing the password and email address.

What the attacker needed

Victim clicks a link; attacker controls a domain; Cloudflare account

How it was found

  1. The attacker sets up Cloudflare Email Routing, an Email Worker, and a server with email.php and exploit.html.
  2. The victim visits the attacker's page and clicks a button.
  3. The first request is sent to the update_profile endpoint with the attacker's email address, triggering a confirmation email to the attacker's domain.
  4. The Cloudflare Worker forwards the email to email.php, which extracts the victim's current email address and username.
  5. The attacker's JavaScript polls email.php and, once the victim's email is found, sends a second request with the victim's real email and a new password.
  6. The password is changed, and the attacker logs in using the leaked username and new password.

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.

This report describes a CSRF (Cross-Site Request Forgery) flaw, where a malicious website can make a logged-in user's browser send a request to another site without the user's knowledge. The attacker tricked the victim into clicking a button that silently changed their password and email, and then used a clever email forwarding setup to learn the victim's email address and username, completing the takeover.

What is CSRF?

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

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.