How I found my first DOM based XSS
A DOM-based XSS vulnerability was found on a subdomain where a search parameter was reflected inside a script tag, allowing an attacker to break out and execute arbitrary JavaScript. The attacker could craft a malicious link that, when visited by a victim, would run script in the victim's browser.
The website we will refer to as target.com, this was a VDP not a BBP unforuntately with a few things on the unfortunate side but we will get into that later.
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 by tricking them into visiting a crafted link, potentially leading to data theft or other malicious actions.
What the attacker needed
Victim clicks a crafted link
The fix
The vulnerability should be fixed by properly encoding or sanitising user input before inserting it into a script context.
How it was found
- Perform recon to find subdomains and identify a search feature.
- Enter a test string in the search and observe it is not reflected.
- Intercept a request when clicking on statistics and send it to Burp Repeater.
- Replace the name parameter with a basic script payload and observe the response.
- Inspect the page and notice the payload is reflected inside a script tag.
- Modify the payload to close the script tag and add a new script tag, then load the crafted URL in a 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.
The website took a value from the URL and placed it directly inside a JavaScript block on the page without cleaning it. By adding a closing script tag and a new script tag, the attacker could make the browser run their own code. This is called cross-site scripting (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.