Skip to content
XSS Write-up Beginner

Stored XSS: Exploiting Buggy Buy with a Single Script

The Buggy Buy application stored user-supplied review content and rendered it without encoding, so a script submitted in a review executed in the browser of anyone who viewed the product page. An attacker could use this to steal cookies, hijack sessions, or inject phishing content.

medium.com

Published on medium.com

Injecting just one malicious tag can give an attacker full control over a user’s brower. have you ever wonder how that is possible? Yes!

Muniza Badar, 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 application stored review input and rendered it into the page without output encoding or sanitisation.

Impact

The stored script ran for every visitor, which could allow cookie theft, account hijacking, or phishing content injection.

What the attacker needed

A product page with a review or comment feature; ability to submit a review

The fix

User-generated content should be encoded before rendering, dangerous input rejected, inline JavaScript avoided, and input sanitised with a library such as DOMPurify.

How it was found

  1. Navigate to a product page that allows reviews or comments.
  2. Enter a script payload into the review input field.
  3. Submit the review.
  4. Reload the product page or visit it from another account to trigger the stored script.

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.

When a website lets people leave comments or reviews, it should treat that text as plain text, not as code. Here, the site saved the review and later showed it to other visitors as if it were part of the page, so a hidden instruction (a script) ran in their browsers. That let the author of the review run code in other people's sessions.

What is XSS?

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

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.