The lab
here is how portswigger describes it
To solve the lab, exploit a hidden API endpoint 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#
the shop's front-end only ever reads a product's price, but the same API endpoint can do more than the UI uses it for. we find that extra capability with the OPTIONS method.
- the
OPTIONSmethod asks an endpoint "which HTTP methods do you accept?" rather than performing an action. a well-behaved API answers with anAllowheader listing the supported verbs. this is the cheapest way to discover functionality the UI never calls, if the UI only doesGETbutOPTIONSrevealsPATCH, there is an unused, possibly dangerous capability sitting there. - an unused / hidden API endpoint (really, an unused method on a visible endpoint) is functionality that exists server-side but isn't wired to any button. here
GET /api/products/1/pricejust reads the price, but the same path also acceptsPATCH, which updates it. the shop never offers price editing in the UI, yet the method is live. PATCHpartially updates a resource. to call it by hand we need to supply the body the server expects, the rightContent-Type(application/json) and the right JSON fields. the server's error messages tell us exactly what's missing at each step, so we assemble a valid request from its complaints. the method:OPTIONSrevealsPATCHis allowed on the price endpoint, we authenticate, then craft aPATCHwith{"price":0}to set the leather jacket's price to zero and check out for free.
why the unused method is exploitable#
the flaw is that an endpoint exposes a powerful operation (updating a price) that the application never intended customers to reach, and once we authenticate, nothing stops us calling it. the UI is not a security boundary, hiding the "edit price" capability by simply not drawing a button leaves the underlying PATCH fully functional for anyone who sends the request directly. OPTIONS hands us the list of verbs, so we don't even have to guess; the server volunteers that PATCH is allowed. the only gate is authentication, not authorisation, any logged-in user can rewrite any product's price, so we set it to zero. the server even coaches us through building the request with its Unauthorized → wrong Content-Type → missing price error chain, each message revealing the next requirement until the PATCH succeeds.
Step 1 - find the product API request#
we click on a product and, in Proxy > HTTP history, notice the API request for it, e.g. GET /api/products/3/price. we right-click it and Send to Repeater.

Step 2 - discover allowed methods with OPTIONS#
in Repeater we change the method from GET to OPTIONS and send. the response's Allow header specifies that GET and PATCH are permitted, so PATCH is an unused capability on this endpoint.

Step 3 - probe PATCH unauthenticated#
we change the method from GET to PATCH and send. we get an Unauthorized message, suggesting we need to be authenticated to update via this endpoint.

Step 4 - authenticate and hit the content-type check#
in Burp's browser we log in as wiener:peter, click the Lightweight "l33t" Leather Jacket, and in Proxy > HTTP history send its GET /api/products/1/price request to Repeater. we change the method to PATCH and send. now the error is about an incorrect Content-Type, specifying it should be application/json.

Step 5 - supply the JSON body shape#
we add a Content-Type: application/json header and an empty JSON object {} as the body, then send. the error now says the body is missing a price parameter, so the server has told us exactly what field it wants.

Step 6 - set the price to zero#
we add the price parameter with value 0:
{"price":0}
we send the request, then reload the leather jacket product page in Burp's browser, its price is now $0.00.


Step 7 - buy the jacket#
we add the leather jacket to our basket, go to the basket, and click Place order.

with this, the lab is solved!
