CSRF - Adding/Removing items to cart - shop.khanacademy.org
The cart update endpoint on shop.khanacademy.org lacked CSRF protection, allowing an attacker to add or remove items from a victim's cart by tricking them into submitting a crafted form. The attacker could set quantities to zero to remove items or increase quantities to add new items.
Originally disclosed on HackerOne
- Disclosed after 30 days
Hi there,
I've discovered a possiblity to remove/add items to a users' cart at shop.khanacademy.org.
###Details
- Host: shop.khanacademy.org
- URL: http://shop.khanacademy.org/cart
- Affected parameters: updates[PRODUCTID]
###Steps to reproduce
-
- Visit http://shop.khanacademy.org/cart and empty your cart
-
- Run the following CSRF PoC:
<html>
<body>
<form action="http://shop.khanacademy.org/cart" method="POST">
<input type="hidden" name="updates[211669705]" value="1" />
<input type="hidden" name="update" value="Update quantities" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>
-
- Take a look into your cart again
-
- There should be a new item.
An attacker can set the quantity to zero to remove an item or increase / add new items to the cart.
###How to fix? You should add a CSRF token to the form.
Best regards, Sebastian Neef
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The cart update form lacked a CSRF token, so forged requests could update the cart.
What the attacker needed
Victim visits attacker's page; victim has an active session
How it was found
- Visit the cart page and empty your cart.
- Run the provided CSRF proof-of-concept form.
- Check your cart again.
- A new item should appear.
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 report has not been written yet. The Original tab links to the source.
When you add something to a shopping cart on a website, your browser sends a request to the site. If the site doesn't check that the request actually came from its own pages, another website can secretly make your browser send that request for you. This is called CSRF (Cross-Site Request Forgery). Here, an attacker could make your browser add or remove items in your cart without you knowing.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.