Skip to content
XSS Write-up Beginner

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.

jsamia Follow

Published on medium.com

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.

Jaeden Samia, on medium.com

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

  1. Perform recon to find subdomains and identify a search feature.
  2. Enter a test string in the search and observe it is not reflected.
  3. Intercept a request when clicking on statistics and send it to Burp Repeater.
  4. Replace the name parameter with a basic script payload and observe the response.
  5. Inspect the page and notice the payload is reflected inside a script tag.
  6. 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.

More by jsamia

View all

4 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.