DOM XSS — Simple but Elegant on Hidden Parameter— Bypassing Filter
A hidden parameter on a website was reflected into a script tag without proper filtering, allowing an attacker to break out and execute JavaScript. A blacklist filter blocked a simple alert payload but was bypassed by adding dashes around the payload.
Published on medium.com
I discovered this DOM XSS on a public program on a website that looked in the first glance like a static website, but had some hidden functionality on one of it’s directories. I found the hidden directory by crawling and manually browsing the site.
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 inserted user input into a script context without proper output encoding, and relied on a weak blacklist filter that could be bypassed.
What the attacker needed
Victim clicks a crafted link
The fix
The application should properly encode user input before inserting it into a script context, rather than relying on a blacklist filter.
How it was found
- Find a hidden directory by crawling and manually browsing the site.
- Check the source code and find a parameter 't' that appears controllable.
- Send a test value in the 't' parameter and see it reflected in the source code.
- Break out of the parenthesis by sending a value with quotes.
- Try to execute an alert, which is blocked by a filter.
- Bypass the filter by adding dashes around the alert payload and trigger the popup.
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 website took a value from the URL and put it directly inside a script on the page. Because it did not clean the value, an attacker could add their own code and make the browser run it. This is called cross-site scripting, or XSS, and it lets an attacker run code in a victim's browser.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.