Skip to content
CSRF Write-up Intermediate

From Hidden Parameter to Account Takeover

The change phone number form lacked a CSRF token, but the server validated requests using a hidden token parameter that could be reused if not in consecutive requests. An attacker could bypass this validation by alternating leaked tokens, enabling a CSRF attack to change a victim's phone number and potentially take over their account.

radwan0x Follow

Published on medium.com

While analyzing a web application’s “Change Phone Number” functionality, I noticed that there was no CSRF token present in the form or headers. This indicated that the application might be vulnerable to Cross-Site Request Forgery (CSRF) attacks.

Mohamed Radwan, 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 used a hidden token for CSRF protection but allowed token reuse as long as the same token was not used in consecutive requests, instead of requiring a unique, unpredictable token per request.

Impact

An attacker could perform a CSRF attack to change a victim's phone number, which could lead to account takeover.

What the attacker needed

Victim is logged in; attacker can lure victim to a malicious page; attacker has leaked token values

The fix

The application should use a unique, random token for each request and validate the Origin and Referrer headers, among other CSRF defences.

How it was found

  1. Observe that the change phone number request has no CSRF token.
  2. Craft a CSRF proof-of-concept and note that it fails.
  3. Rule out Referer and Origin header validation.
  4. Use Param Miner to brute-force hidden parameters and discover a hidden token parameter.
  5. Find leaked token values in Burp Suite history.
  6. Alternate between two leaked tokens across requests to bypass validation and successfully change the phone number.

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 flaw: a website accepted a request to change a phone number without proof that the user meant to send it. The site tried to protect itself with a secret code, but that code could be reused in a pattern, so an attacker could still trick a logged-in user into changing their number.

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.