Skip to content
CSRF Write-up Intermediate

[TOKOPEDIA] Site-wide CSRF through GraphQL request

The GraphQL endpoint accepted state-changing requests authenticated only by session cookies and did not enforce CSRF protections, so an attacker could craft a form that submits a JSON-like body as text/plain to perform actions on behalf of a logged-in user. This allowed adding products, changing profile data, and potentially stealing wallet funds by adding an attacker bank account.

Rafie Muhammad Follow

Published on yeraisci.com

Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. CSRF attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request.

Rafie Muhammad (@rafiem777), on yeraisci.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 GraphQL endpoint relied solely on session cookies for authentication and did not validate a CSRF token or check the Origin/Referer headers, allowing cross-site form submissions with text/plain content type.

Impact

An attacker could perform any state-changing action available through the GraphQL API on behalf of a logged-in user, including adding products, editing profile data, and potentially stealing wallet funds by adding an attacker-controlled bank account.

What the attacker needed

Victim is logged in; victim visits attacker page; victim clicks submit or auto-submit

The fix

The vulnerability was fixed according to the timeline.

How it was found

  1. Capture a GraphQL request that performs a state-changing action (e.g., add product to wishlist) in Burp Suite.
  2. Modify the request: remove the Referer header, set Origin to null, set Content-Type to text/plain, and append an equals sign to the body.
  3. Send the modified request and observe that it succeeds.
  4. Craft an HTML form with enctype text/plain that posts a JSON payload to the GraphQL endpoint.
  5. Host the HTML page and trick a logged-in victim into submitting the form (or auto-submit via JavaScript).

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 tricks your browser into sending a request to another site where you are logged in, using your existing cookies. Here, the GraphQL API accepted requests that did not include a special token, so a simple HTML form could make changes to the victim's account without their knowledge.

What is CSRF?

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

More from Tokopedia

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.