Skip to content
IDOR Write-up Beginner

Exploiting a Mass Assignment API Vulnerability

The checkout API accepted a hidden discount field that the frontend never sent, letting a user set their own discount to 100%. An attacker could then place an order for a product without paying.

medium.com

Published on medium.com

PortSwigger | Practitioner | API Testing Series ๐Ÿงจ Status: Lab PWNED ๐Ÿ”— Lab Link: Exploiting Mass Assignment Vulnerability

Aditya Bhatt, 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 backend blindly accepted all fields from the JSON request body and applied them to the order object, without checking which fields the client was allowed to set.

Impact

An attacker could obtain products for free by setting their own discount to 100%.

What the attacker needed

A free account; ability to intercept HTTP requests

How it was found

  1. Log in with the provided credentials.
  2. Add the leather jacket to the cart and attempt to place an order.
  3. In Burp, find the POST /api/checkout request and send it to Repeater.
  4. Notice that a GET /api/checkout response includes a chosen_discount field not present in the POST body.
  5. Add a chosen_discount object with percentage set to 100 to the POST JSON body and send it.
  6. The order is confirmed and the lab is solved.

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.

When a website sends data to its server, the server should only accept the fields it expects. Here, the server also accepted an extra field for a discount percentage, so a user could simply add that field and give themselves a free item.

What is IDOR?

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.