Skip to content
CSRF Write-up Intermediate

Facebook SMS Captcha Was Vulnerable to CSRF Attack

The SMS captcha endpoint accepted a 'next' parameter that set the form's action URL without CSRF protection, so an attacker could make a victim's browser POST to any sensitive GraphQL endpoint. Clicking Continue would execute actions such as adding or removing email addresses or modifying settings.

Lokesh Kumar Follow

Published on lokeshdlk77.medium.com

Bounty$18,750 View original

This post is about an bug that I found on Meta (aka Facebook) which allows to make any Endpoint as POST request in SMS Captcha flow which leads to CSRF attack.

Lokesh Kumar, on lokeshdlk77.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 captcha page used the user-supplied 'next' parameter as the form action without validating it or adding a separate CSRF token for that destination.

Impact

An attacker could make a victim perform sensitive account changes such as adding or removing an email address or mobile number, or modifying settings, if the victim clicked Continue.

What the attacker needed

Victim is logged in to Facebook; victim clicks a crafted link; victim clicks the Continue button

The fix

Meta fixed it by adding a next_mac CSRF protection parameter and restricting the form action to only the OTP code sending endpoint.

How it was found

  1. Open the SMS captcha endpoint with a 'next' parameter pointing to a sensitive GraphQL endpoint.
  2. The captcha page renders a form whose action is that endpoint.
  3. The victim clicks the Continue button.
  4. The POST request is sent with the CSRF token and the action executes.

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 tricks a logged-in user's browser into sending a request the user did not intend. Here, a page on Facebook took a web address from the URL and used it as the place to send a form, without checking the request was genuine, so an attacker could point it at sensitive account actions.

What is CSRF?

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

More from Meta

View all

The newest disclosed reports for this program.

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.