Reflected XSS in blog search
A reflected cross-site scripting vulnerability existed in the blog search function, where a filter removed certain characters but could be bypassed using URL encoding and JavaScript template literals to execute arbitrary script. An attacker could steal cookies or perform actions in the victim's browser.
Published on medium.com
today i will talk about how i found a tricky reflected XSS in the core blog application in search functionality.
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 input was reflected without proper output encoding, and the blacklist filter was incomplete, allowing bypass via URL encoding and JavaScript template literal evaluation.
Impact
An attacker could execute arbitrary JavaScript in a victim's browser, potentially stealing cookies or performing actions on their behalf.
What the attacker needed
Victim clicks a crafted link
How it was found
- Inject special characters to test the filter and see what gets removed.
- Try URL-encoded tags to see if they bypass the filter.
- Use a mixed-case script tag with extra characters to trigger an alert.
- Attempt to call confirm with document.cookie but find parentheses are stripped.
- Discover that eval.call with a template literal can execute code without parentheses.
- Use hex encoding inside the template literal to bypass the filter and execute alert(document.cookie).
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.
The blog's search box echoed back what you typed, but it tried to block dangerous characters. The author found a way around that block, so a malicious link could run code in a visitor's browser and steal their login cookies.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.