Cart Tricks & Upload Flaws: Uncovering XSS on an Online Store
The cart popup on an online store platform rendered product details without proper encoding, allowing stored cross-site scripting. Additionally, the file upload feature accepted JavaScript files that executed when accessed, enabling another XSS vector.
medium.com
Published on medium.com
Hello, cybersecurity enthusiasts! In this write-up, I’ll walk you through my recent findings on redacted.com, an online store platform that lets users create custom storefronts.
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 cart popup and file upload handling failed to properly encode or restrict user-controlled content, allowing script execution.
Impact
An attacker could execute arbitrary JavaScript in the context of the storefront, potentially affecting customers who interact with the cart or uploaded files.
What the attacker needed
Ability to create a storefront; ability to add products; victim adds product to cart or opens uploaded file
The fix
The platform should apply consistent output encoding in the cart popup and restrict file uploads to safe types, serving them with appropriate content types.
How it was found
- Create a storefront and add a product with HTML tags in its name or description.
- Add the product to the cart to trigger the popup.
- Observe that the HTML tags render and can execute script.
- Upload a JavaScript file through the file upload feature.
- Access the uploaded file to trigger script execution.
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.
Cross-site scripting (XSS) is a flaw where a website displays user-supplied text as if it were part of the page's code, so a malicious script runs in a visitor's browser. Here, product names and descriptions were shown without being made safe, so a script hidden in a product name could run when someone added that product to their cart. Separately, the site let people upload JavaScript files that ran when opened, which is another way to run code in a victim's browser.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.