The lab
here is how portswigger describes it
To solve the lab, find and exploit a mass assignment vulnerability to buy a Lightweight l33t Leather Jacket. You can log in to your own account using the following credentials:
wiener:peter.
the new pieces in this lab#
this lab is about a parameter the client is never supposed to send, but can.
- mass assignment (also called autobinding) is a framework convenience: incoming request fields are automatically mapped onto the matching properties of a server-side object. it saves developers writing out each assignment by hand, but it becomes a vulnerability when the object has sensitive properties the user should not control (a discount, a role, an account balance) and the framework binds them from user input just as readily as the harmless ones. if you can name the property in your request, you can set it.
- the giveaway here is a symmetry between the GET and POST bodies. the
GET /api/checkoutresponse and thePOST /api/checkoutrequest share the same JSON shape, because the server serialises the same object for both. so the GET response shows us fields that exist on the object but aren't in the normal POST, here achosen_discountparameter. that is our clue: a bindable field the UI never sends. the method: the GET response reveals a hiddenchosen_discountfield, we add it to our POST, confirm the server actually processes it, then set the discount to 100% so the jacket costs nothing.
why the hidden field is bindable#
the flaw is that the checkout object includes a chosen_discount property and the framework binds it straight from the request body without checking whether a customer has any business setting it. the discount is server-side state, it should be decided by the application, not supplied by the buyer, but mass assignment makes no distinction between "fields the user may set" and "fields that merely happen to exist on this object". because the same object is serialised in the GET response, the application effectively tells us the field's name and structure; we copy that shape into our POST and the binder dutifully applies our value. there is no allow-list of acceptable input fields, so a parameter that should be internal becomes attacker-controlled, and a 100% discount sails through as if the application had granted it.
Step 1 - hit the credit limit and find the checkout API#
we log in as wiener:peter, add the Lightweight "l33t" Leather Jacket to the basket, go to the basket, and click Place order, we don't have enough credit. in Proxy > HTTP history we notice both the GET and POST API requests for /api/checkout.

Step 2 - spot the hidden field in the GET response#
we compare the two: the GET /api/checkout response contains the same JSON structure as the POST request, but the GET version includes a chosen_discount parameter that the POST does not send. that field exists on the object but isn't part of the normal order submission.


Step 3 - inject the discount field and confirm it's processed#
we send the POST /api/checkout request to Repeater and add the chosen_discount parameter:
{
"chosen_discount":{
"percentage":0
},
"chosen_products":[
{
"product_id":"1",
"quantity":1
}
]
}
sending it causes no error. to confirm the value is actually being processed, we change chosen_discount to the string "x" and send, this returns an error that the value isn't a number. the server is parsing our field, so it's bound.

Step 4 - set a 100% discount and order#
we change the discount percentage to 100 and send the request.

with the discount applied, the jacket costs nothing, so we place the order.

with this, the lab is solved!
