Skip to content
XSS Write-up Beginner

How a Late-Night Scroll Turned Into an Unexpected XSS Discovery

A search box on an e-commerce site echoed user input into the page without sanitisation, so a script tag in the query ran in the browser. An attacker could use this reflected XSS to run JavaScript in a victim's session, steal cookies and impersonate the user.

akashutosh659 Follow

Published on medium.com

Security stories don’t always start with red-team exercises or bounty targets. Sometimes, they start with boredom.

Ashutosh Anand, 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 search parameter was reflected into the HTML response without output encoding or sanitisation.

Impact

An attacker could run JavaScript in a victim's browser, steal session cookies and impersonate the user, inject fake login or payment pages, or redirect to phishing sites; the text only demonstrates a client-side alert and does not show a real theft.

What the attacker needed

Victim clicks a crafted search link; no account needed to trigger

The fix

The site should sanitise user input and encode output before rendering it, and use frameworks with built-in XSS protection; the text does not say whether it was fixed.

How it was found

  1. Open the e-commerce site's search box.
  2. Enter a harmless value first, then a script tag as the search term.
  3. Submit the search and observe the browser alert, confirming 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) happens when a website takes something a visitor typed, such as a search term, and puts it into the page without cleaning it first. If the text contains code, the browser runs that code as if the site itself had written it. Here the search box did exactly that, so a crafted link could make a victim's browser run the attacker's script.

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 akashutosh659

View all

4 more disclosed reports, best first.

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.