Skip to content

In-depth lesson · DOM-based XSS

Tips for beginners

Every point the DOM-based XSS reports back under this heading, best-backed first, each with the reports it is seen in.

Back to the lesson 1 to 13 of 13
  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. Consider browser differences. Some reports show payloads that were blocked by CSP or encoding in one browser executing in Internet Explorer or Edge. If a payload fails, retest in older browsers where defences may not apply, but only within the program's scope.

    Seen in 3 reports
  7. When you find a candidate, confirm real impact. Show that script runs on the affected origin and explain what an attacker could do, such as read data or act as the user. Reports that chain DOM-based XSS with clickjacking or CSRF, or escalate to account takeover, demonstrate stronger impact.

    Seen in 3 reports
  8. Check client-side frameworks and template engines. Put a simple expression in a parameter on a page that uses Angular and see whether it is evaluated. If it is, escalate carefully to confirm script execution. Also look at template helpers that build attributes or script contexts.

    Seen in 2 reports
  9. Check storage and clipboard flows. Values read from localStorage and rendered without escaping can give persistent DOM-based XSS. Clipboard data assigned to innerHTML is another path. Test whether content you can influence in one place is rendered unescaped elsewhere.

    Seen in 2 reports
  10. Avoid common mistakes. Do not report self-XSS without a way to make it affect another user, and do not report a payload that only runs in your own browser session. Check that the affected asset is in scope before spending time, and do not rely on a payload that requires unrealistic user interaction.

    Seen in 2 reports
  11. Check error pages and less obvious endpoints. A 50x error page and a form page on a subdomain have both had DOM-based XSS. These pages are often overlooked and may not receive the same scrutiny as main features.

    Seen in 2 reports
  12. Be precise in your report. State the source, the sink and the browser conditions, and include a clear demonstration of impact. Avoid hype and avoid claiming impact the evidence does not support. If the issue only affects a single user or requires unlikely conditions, say so.

    Seen in 2 reports
  13. Use reconnaissance to find sinks. Move from mapping the application to testing specific sinks such as innerHTML assignments, script loaders and location assignments. Reports show this approach leading to findings, and it helps you focus on places where data actually reaches a dangerous API.

    Seen in 1 report