Skip to content
CSRF Write-up Intermediate

Bypass CSRF attack in json and get €XXX

The user profile update endpoint accepted JSON but lacked CSRF protection, so an attacker could change a victim's name and phone number. The attacker bypassed the email field restriction by using a text/plain form that placed the email value in a way that avoided a trailing equals sign.

medium.com

Published on medium.com

Today i will talk about a so weird CSRF attack and how you can bypass it even if the app working with REST API

Kirollos Botros, 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

Impact

An attacker could change a victim's first name, last name, or mobile number, but the attack required knowing the victim's email address, which limited severity.

What the attacker needed

Victim is logged in; attacker knows victim's email; victim visits attacker's page

How it was found

  1. Identify the profile update endpoint that accepts POST requests in JSON format.
  2. Try a standard HTML form with enctype text/plain, but notice the trailing equals sign breaks the JSON.
  3. Try a fetch request, but encounter a CORS preflight that strips the session cookie.
  4. Craft a text/plain form where the email value is placed before the closing quote, avoiding the trailing equals sign.
  5. Submit the form to change the victim's first name, last name, or mobile 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.

CSRF (Cross-Site Request Forgery) is when a malicious website makes a logged-in user's browser send a request to another site without the user knowing. Here, the update profile page did not check that the request really came from the site itself, so an attacker could trick a victim into changing their own profile details.

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.