In-depth lesson · technique
DOM-based XSS
What every disclosed DOM-based XSS report in the index teaches, put together: how it works, how it changed year by year, where it turns up, and things to try. Every point shows the reports it is seen in.
- reports cited in this lesson
- 166
- median public bounty
- $1,000
Learning Client-side in depth, step 1
Overview
What it is and why programs pay for it.
DOM-based cross-site scripting is a client-side flaw where untrusted data from a source such as the URL fragment, query string, referrer, postMessage data or localStorage is written into a dangerous sink like innerHTML or eval without proper handling. The browser then executes attacker-controlled script in the page's origin. Programs care because it can run in the context of their site, bypass server-side filters and sometimes evade CSP, and it has been reported across major properties including Google, Facebook, PayPal, Uber and NASA.
It usually leads to script execution on the affected origin, which can mean session theft, account takeover, data exfiltration or chaining with other issues such as clickjacking and CSRF. Some reports show it combined with clickjacking or CSRF, and others show it escalating to account takeover. It is most often found in search features, redirect and return URL parameters, postMessage handlers, third-party widgets and libraries, error pages, checkout and login flows, and pages that read from localStorage or the URL fragment.
The evidence covers a wide range of technologies and contexts, from AngularJS templates and Swagger UI to mermaid diagrams, browser extensions and mobile sites. It also appears in shared widgets that affect several sites, and in bundled third-party libraries. This breadth is why it is worth checking both first-party code and the components a site pulls in.
Seen in these reports14
-
$3,000 -
$500 Low -
Info
Show 5 moreShow fewer
-
High -
-
Medium -
Low -
Medium
How it works
The mechanics, as the reports show them.
The flaw needs a source and a sink. A source is where attacker-influenced data enters the client, such as a URL fragment parameter, a query parameter, the referrer, a postMessage event, clipboard data or localStorage. A sink is a browser API that turns text into markup or code, such as innerHTML, script loaders, location assignment or eval. When data flows from a source to a sink without encoding, validation or safe APIs, script can run.
A common pattern is a URL fragment parameter assigned directly to innerHTML. Another is a URL parameter passed to a script loader such as jQuery's getScript without restricting the source. In both cases the page trusts data it should not, and the browser executes what the attacker supplies.
postMessage handlers are a frequent route. The page listens for messages and either fails to check the sender's origin or checks it with a prefix or substring match instead of an exact comparison. It then passes message data into innerHTML, location assignment or eval. This makes it possible for a malicious page to send crafted messages and trigger execution.
Client-side frameworks and template engines add their own paths. User input placed into an Angular template without sanitising expressions can be evaluated by Angular. A lodash template that fails to escape a value for an attribute context can inject into a template evaluated as JavaScript. Prototype pollution through URL parsing can also feed a gadget that later reaches eval or innerHTML.
Third-party components and libraries are another source. Outdated Swagger UI reads a configuration parameter and uses it without proper sanitisation. The mermaid diagram renderer has allowed javascript scheme links and unsanitised style injection. Bundled libraries and shared widgets can carry the flaw into many sites at once.
What makes it possible is the gap between where data enters and where it is used. Server-side filters do not see client-side flows, and some defences such as CSP or URL encoding may not apply in older browsers. Reports show retesting in Internet Explorer or Edge where a CSP-blocked payload executed, and bypassing origin checks by registering domains that match a prefix or substring.
Seen in these reports17
-
$2,500 High -
$500 Medium -
$500 Low
Show 5 moreShow fewer
-
$100 Medium -
Low -
$3,000 -
$3,000 High -
$1,000 High
Year by year
12 yearsWhat each year's disclosed reports show, newest first. A year with few reports says less.
| 2001 | 1 |
|---|---|
| 2010 | 1 |
| 2011 | 1 |
| 2012 | 2 |
| 2014 | 3 |
| 2015 | 3 |
| 2016 | 15 |
| 2017 | 28 |
| 2018 | 14 |
| 2019 | 20 |
| 2020 | 34 |
| 2021 | 16 |
| 2022 | 7 |
| 2023 | 17 |
| 2024 | 32 |
| 2025 | 73 |
| 2026 | 62 |
-
2026
New this year3
- Using AngularJS $location.absUrl() propagation as a DOM XSS primitive was a new technique, as shown in the disclosed reports.
- Testing a VOTable viewer for reflected DOM-based XSS with data exfiltration via same-origin XHR was novel, as shown in the disclosed reports.
- Testing a publicly exposed shared-code feature in a 3D globe sandbox for DOM-based XSS was new, as shown in the disclosed reports.
Kept working1
- They tested a WordPress playground path under wp-includes for DOM-based XSS, as shown in the disclosed reports.
Turned up less1
- postMessage listener exploitation, common in 2024, was not reported, as shown in the earlier reports.
-
2025
New this year1
- Turning browser console input into DOM-based XSS was a new technique, as shown in the disclosed reports.
Kept working3
- Hunters found DOM-based XSS on NASA web properties, as shown in the disclosed reports.
- They tested birthdate confirmation and thanks pages for DOM-based XSS, as shown in the disclosed reports.
Turned up less1
- postMessage listener exploitation, common in 2024, was not reported, as shown in the earlier reports.
-
2024
New this year1
- A chatbot feature was identified as a place for unusual DOM-based XSS, as shown in the disclosed reports.
Kept working3
- They sent crafted messages to listeners on multiple domains and search engine pages to trigger DOM-based XSS, as shown in the disclosed reports.
- Hunters pointed outdated Swagger UI configUrl parameters at external JSON files to run script, as shown in the disclosed reports.
Turned up less1
- Open redirect to DOM-based XSS chains, seen in 2023, were not reported, as shown in the earlier reports.
Earlier years9
Where it is found
57The features and places the reports found it in, most-reported first.
-
A DoD website had a DOM-based XSS flaw.
Seen in 4 reports
-
A NASA web property had a DOM-based XSS flaw.
Seen in 3 reports
-
A Google web property had a DOM-based XSS flaw.
Seen in 1 report
-
Facebook's FBML markup rendering was a place where DOM-based script injection could occur.
Seen in 1 report
-
AVG's web pages carried a DOM-based XSS flaw.
Seen in 1 report
Technologies in these reports16
Root causes
21The mistakes in the code or configuration behind the reports.
-
User input was placed into a client-side Angular template without sanitising template expressions, so Angular evaluated attacker-controlled expressions.
Seen in 1 report
-
A URL fragment parameter was assigned to innerHTML without encoding or validation.
Seen in 1 report
-
A lodash template used for the input modal failed to escape the value parameter for the data-define attribute context, letting an attacker inject into a twine template that was evaluated as JavaScript.
-
A URL parameter was passed straight to jQuery's getScript without validating or restricting the script source.
Seen in 1 report
-
$500 Medium
-
-
The application reflected the untrusted X-Forwarded-Host header into page attributes that drive a client-side fetch, and the fetched JSON was written into the DOM without escaping.
Seen in 1 report
Things to try
The most-reported tests in the largest contexts. Tick what you have tried; ticks stay in this browser and carry over to the full checklist. Test only what a program's scope allows.
ticked in this lesson
postMessage and cross-window messaging
of 3 ticked-
Seen in 1 report
-
Seen in 1 report
Editors, markdown and rich content
of 3 ticked-
Seen in 1 report
-
Seen in 1 report
-
Seen in 1 report
-
$3,000 High
-
Redirect and return URL parameters
of 3 ticked-
Seen in 2 reports
-
Seen in 1 report
Bypasses and variations
5How reports got past filters, encoders and other defences.
-
Retest a patched DOM-based XSS to find a bypass of the fix.
-
Bypass an origin check that compares only the start of the origin string by registering a domain whose name begins with the trusted origin.
Seen in 1 report
-
Bypass an origin check that uses a substring match by hosting the attacker page on a domain that contains the trusted origin string.
Seen in 1 report
-
Load AngularJS from an allowed CDN inside an injected iframe and use ng-on-error to run code past CSP.
Seen in 1 report
-
Bypass a WAF to deliver a DOM-based XSS on a government domain.
Seen in 1 report
Payouts
43 paidPublic bounties in US dollars, from the data. 43 of 442 reports show an amount.
- a quarter paid up to
- $500
- median
- $1,000
- three quarters paid up to
- $3,000
- highest
- $20k
One in ten paid reports was paid $4,800 or more.
| Severity | Reports | Paid | Median | Highest |
|---|---|---|---|---|
| Critical | 4 | 0 | None paid | None |
| High | 36 | 5 | $2,500 | $3,600 |
| Medium | 64 | 7 | $1,000 | $4,000 |
| Low | 30 | 8 | $375 | $500 |
| Informational | 6 | 0 | None paid | None |
| Unrated | 302 | 23 | $1,250 | $20k |
Highest-paid reports5
-
$20,000 -
$8,000 -
$7,500 -
$5,000 -
$5,000
Tips for beginners
13Advice for a first hunt, drawn from the reports.
-
Start with the obvious sources: URL fragments, query parameters, redirect and return URL parameters, search boxes and error pages. Test whether values you control are reflected into the page and whether they reach a sink such as innerHTML. Reports show these are common places for DOM-based XSS.
Seen in 5 reports
-
Look at postMessage handlers. Check whether the listener verifies the sender's origin with an exact match and whether message data is written into the DOM or used as a URL. Prefix and substring checks are bypassable, and missing origin checks are a direct route to execution.
Seen in 4 reports
-
Review third-party components: outdated Swagger UI, mermaid diagrams, bundled libraries and shared widgets. These often have known DOM-based issues and can affect many sites. Test configuration parameters and diagram features where user content is rendered.
Seen in 4 reports
-
Retest fixes. A patched DOM-based XSS can often be bypassed, and reports show retesting to find a bypass of the fix. If a fix relies on an origin check, try domains that match a prefix or substring. If it relies on encoding, check other contexts.
Seen in 4 reports
-
Test redirect and return URL parameters carefully. These are common sources that flow into location assignment or HTML building. Check whether a javascript scheme or HTML is accepted, and whether the value is used in a client-side fetch or link attribute.
Seen in 4 reports
Guides and techniques
The best explainers, cheat sheets and technique posts on DOM-based XSS, from around the web.
-
DOM InvaderPortSwigger introduces DOM Invader, a browser tool for finding DOM XSS and prototype pollution sinks during testing.
portswigger.net
-
How to use Codex for Bug Bounty research: explore broadly, validate rigorouslyExplores using Codex agents for vulnerability hunting, with blind lab tests showing it can exploit DOM XSS and JWT flaws autonomously.
Methodology yeswehack.com
-
PimpMyCaido #1: Hunt client-side vulnerabilities with DOMLogger++Shows how DOMLogger++ with Caido monitors JavaScript sinks in real time to surface DOM XSS and prototype pollution.
yeswehack.com
-
How to use Claude Code for Bug Bounty: find fast, validate manuallyTests Claude Code against blind DOM XSS and request smuggling labs, finding it strong at recon but weak at final validation.
Methodology yeswehack.com
-
Inside the Script Block: JavaScript String, Template Literal, and JSON BreakoutsExplains how to break out of JavaScript strings, template literals and JSON inside script blocks to achieve XSS.
Technique kd-200.medium.com
Keep learning
Where this lesson fits, and what to read next.
Learning paths
The whole class
Related techniques
How this is made: our model read every listed DOM-based XSS report in the index (our own summary where we have one, otherwise the title and the platform's label), listed the patterns, and merged them. Each point was kept only if the reports it cites exist, are listed and belong here; payouts are computed from the data, not written by the model. Read the originals before relying on a point. Generated 26 Nov 2026 from 175 reports. All DOM-based XSS reports.