How I Found a Reflected XSS in Just 2 Minutes
A search parameter on a healthcare site reflected user input into the HTML page without encoding. An attacker could craft a link that runs script in a victim's browser.
medium.com
Published on medium.com
Today I want to share a small but exciting story about how I found my first reflected XSS vulnerability in a private bug bounty program 😄
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 written into the HTML response without output encoding or context-aware escaping.
Impact
An attacker could send a crafted search link that runs script in a victim's browser, though the report does not show any action beyond an alert box.
What the attacker needed
Victim clicks a crafted search link
How it was found
- Open the site's search page with a test value in the query string.
- Submit simple test values and watch how they appear in the response.
- View the page source to see where the input is reflected.
- Try an image tag with an error handler to break out of the HTML context.
- Observe the alert box 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.
A reflected cross-site scripting (XSS) bug happens when a website takes something you typed, such as a search term, and puts it straight into the page without cleaning it. If the text contains code, the browser runs that code as if the site itself had written it. Here the search box echoed the input back, so a crafted link could make a visitor'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.