Discovering a Reflected XSS Vulnerability in an Shopping Website
A search parameter on a shopping website reflected user input without encoding, allowing an attacker to inject and execute script in a victim's browser. The author demonstrated this with a payload that triggered a prompt dialog.
Published on medium.com
I recently discovered a reflected Cross-Site Scripting (XSS) vulnerability in the website of a company. This blog post will walk you through the discovery process, the technical details of the vulnerability, and the steps taken to report and mitigate the issue.
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 reflected the search parameter into the HTML response without output encoding or input validation.
Impact
An attacker could execute arbitrary scripts in a user's session, potentially leading to session hijacking, phishing redirects, or data theft.
What the attacker needed
Victim clicks a crafted link; no authentication needed
The fix
The report says the company fixed the vulnerability after being contacted, and recommended input validation, output encoding, and a Content Security Policy.
How it was found
- Map the web application and identify user input points such as search forms and URL parameters.
- Enter a simple HTML test string in the search bar and observe the response.
- Notice that the search results page displays the input without encoding.
- Inject a script payload into the cname search parameter and confirm it executes in the browser.
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 takes what you type in a search box and puts it straight back on the page without cleaning it, an attacker can type code instead of normal text. That code then runs in the browser of anyone who clicks a crafted link, letting the attacker act as that user.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.