How a Simple Search Parameter Exposed a Potential XSS Vulnerabili
A search parameter on a website was found to reflect user input into the HTML response without proper encoding, potentially allowing an attacker to inject and execute JavaScript in a victim's browser. The author claims this could lead to session hijacking, data theft, or other malicious actions if exploited.
Modern web applications process user input constantly — search bars, login forms, comments, filters, and URL parameters all rely on user-controlled data. But when developers fail to properly sanitize and encode input, attackers may inject malicious scripts directly into web pages.
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 reflects the search parameter into the HTML response without encoding special characters, allowing injected script tags to be interpreted as code.
Impact
If exploited, an attacker could steal session cookies (if not HttpOnly), hijack accounts, redirect users to phishing pages, modify page content, perform actions as the victim, capture keystrokes, or deliver malware.
What the attacker needed
Victim clicks a crafted link; search parameter reflects input; no output encoding
The fix
The application should encode output contextually before rendering, and add a strong Content Security Policy as defence-in-depth.
How it was found
- Craft a URL with a script payload in the search parameter.
- Send the URL to a victim, who opens it.
- The application reflects the input into the page response.
- The browser executes the script because it appears to come from the trusted domain.
- The attacker can then attempt to steal data or perform actions.
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 you type something into a search box, the website often shows it back to you, like 'Results for: your search'. If the site doesn't clean up special characters like < and >, a malicious user could type a script instead of a search term, and the website would run that script in your browser. This is called cross-site scripting (XSS), and it lets an attacker do things like steal your login session or redirect you to a fake page.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.