Case Study: Reflected Cross‑Site Scripting (XSS)
A search parameter reflected user input into the page without sanitisation, so a script tag placed in the query was executed by the browser. An attacker could craft a link that runs their code in a victim's browser and redirects them to another site.
medium.com
Published on medium.com
The original lives on medium.com
We do not hold its text, 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's value was written into the HTML response without encoding or sanitisation, so browser-interpretable markup was treated as code.
Impact
The tester only demonstrated a redirect, but the text says attackers could use it for phishing pages, malware downloads, or chaining with other attacks to steal sessions or credentials; it requires the victim to open a crafted link.
What the attacker needed
Victim clicks a crafted link; search feature reflects input
The fix
Input should be sanitised and validated, special characters encoded before being reflected, a Content Security Policy added, and well-tested security libraries used instead of homegrown filters.
How it was found
- Open the site's search feature with a normal query to see how the input is echoed back.
- Put a small script into the search query instead of plain text.
- Load the query and observe that the browser runs the script rather than showing results.
- See the page redirect to the attacker-chosen site.
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.
A reflected cross-site scripting bug means whatever you type into a box, such as a search field, gets sent straight back into the page as if it were part of the site's own code. If someone types code instead of normal text, the browser runs it, because it cannot tell the difference. Here the tester typed a small script into the search box and the browser obeyed it, sending the visitor to a different website.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.