Skip to content
CSRF Write-up Beginner

Cracking CSRF: How I Found a Hidden Flaw as a Bug Bounty Beginner

The lab's email change form accepted a reused CSRF token, so an attacker could change a victim's email address without their consent. The author confirmed this by replaying the request with the same token and then built a proof-of-concept form.

medium.com

Published on medium.com

As someone relatively new to bug bounty hunting, I decided to level up my skills by diving into PortSwigger's Web Security Academy.

Aashif, 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 properly validate or rotate the CSRF token, allowing a previously used token to be accepted again.

Impact

An attacker could change a victim's email address without their interaction, potentially leading to account takeover.

What the attacker needed

Victim is logged in; attacker hosts a malicious form; victim visits the malicious page

The fix

The application should properly validate CSRF tokens and reject reused or missing tokens.

How it was found

  1. Log in to the lab with the given credentials.
  2. Intercept the email change request using Burp Suite's proxy.
  3. Resend the request with the same CSRF token and observe a 302 Found response.
  4. Change the token slightly and observe a 400 Bad Request response.
  5. Remove the token entirely and observe a 400 Bad Request response.
  6. Create an HTML form mimicking the email change request and host it on the lab's exploit server.

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 is when a malicious website makes a logged-in user's browser send a request to another site without the user knowing. A CSRF token is a secret value added to forms to prove the request came from the real site. Here, the site accepted an old token, so an attacker could trick a victim into changing their email address.

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.