An XSS Story
A reflected cross-site scripting vulnerability existed in a JavaScript context where double quotes were not escaped, allowing an attacker to inject JavaScript code that executes in the victim's browser.
Last night I stumbled across an XSS in a bug bounty program, this was quite fun to exploit.
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
Impact
An attacker could execute arbitrary JavaScript in a victim's browser, potentially leading to session hijacking or other client-side attacks.
What the attacker needed
Victim clicks a crafted link
How it was found
- Identify a URL parameter that is reflected inside a JavaScript tag.
- Test with a payload containing a double quote to see if it is escaped.
- Observe that the double quote is not escaped, allowing breaking out of the string.
- Craft a payload that uses the unescaped double quote to inject JavaScript code.
- Bypass parenthesis filtering by using backticks to call alert.
- Confirm the alert executes in the browser.
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.
Cross-site scripting (XSS) is a bug where a website puts user input into a page without properly cleaning it, so an attacker can make the site run their own JavaScript code. Here, the input was placed inside a script tag, and the double quote character was not escaped, letting the attacker break out of the string and run code like alert(1).
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.