Skip to content
CSRF Write-up Intermediate

How I Discovered a Delete CSRF Vulnerability

The email update endpoint did not validate the CSRF token, allowing an attacker to change a victim's email address via a forged request. However, the change required a verification code sent to the new email, so the attacker could not complete the takeover. The account deletion endpoint also lacked CSRF protection, and a crafted request could delete the victim's account, but only if the victim had previously performed a specific action that set a required session cookie.

medium.com

Published on medium.com

I’m Fatma Mustafa, a Security Researcher and Bug Hunter. In this article, I want to share how I discovered a CSRF (Cross-Site Request Forgery) vulnerability.

Fatma Mustafa, 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 did not validate the CSRF token on state-changing endpoints, and for account deletion it also relied on a session cookie that was only set after a specific prior action.

Impact

An attacker could change a victim's email address (though a verification code sent to the new email prevented full account takeover) and could delete the victim's account, but only if the victim had previously performed a specific action that set a required session cookie.

What the attacker needed

Victim logged in; victim clicks a link or visits a malicious page; victim has performed a specific prior action

How it was found

  1. Register an account and explore account features.
  2. Analyse requests in Burp Suite and notice the email update request with an x-csrf-token header.
  3. Modify the token and resubmit; also send without the token, both receive valid responses.
  4. Craft an HTML form that auto-submits to the email update endpoint.
  5. Open the file while logged into another account; the email update is triggered but requires a verification code.
  6. Craft a similar CSRF exploit for the account deletion endpoint; it works on one account but fails on a new account until the victim performs a specific action.

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.

CSRF (Cross-Site Request Forgery) is when a malicious website tricks your browser into sending a request to another site where you are logged in, without your knowledge. Here, the site did not properly check a security token that should have prevented such forged requests. So an attacker could make your browser change your email or delete your account, but the email change needed a verification code and the deletion only worked if you had done a certain action beforehand.

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.