Skip to content
CSRF Write-up Intermediate

CSRF to Delete Products From Any User Cart Lead To $$$

The application's cart update endpoint did not enforce the CSRF token, allowing an attacker to craft a malicious page that deletes products from a victim's cart. The attacker also needed to know the victim's product and order IDs, which the author could not easily obtain.

medium.com

Published on medium.com

Hello Again Hunters! I’m excited to share something interesting I found while testing a private bug bounty program on an online shopping website.

Yassin Hamdi, 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 server did not validate the CSRF token on the cart update endpoint, and the request relied on predictable or guessable identifiers.

Impact

An attacker could delete products from any user's cart without their permission, but the attack complexity is high because the attacker may need other attacks to obtain the order_id value.

What the attacker needed

Victim is logged in; attacker knows victim's product ID; attacker knows victim's order ID; victim visits attacker's page

The fix

The application should enforce CSRF token validation on the cart update endpoint and use unpredictable identifiers.

How it was found

  1. Capture the POST request to /cart/updatecart that removes a product from the cart.
  2. Remove the X-Csrf-Token header and resend the request; the server responds with 200 OK.
  3. Build an HTML form that replicates the request with hidden fields for the product and order IDs.
  4. Auto-submit the form via JavaScript when a victim visits the attacker's page.

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's knowledge. Here, the shopping site accepted a request to remove items from the cart even though the request lacked the security token that should prove it came from the site itself. An attacker could trick a victim into visiting a page that silently sends this request, deleting items from their cart.

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.