dom-xss

Audit JavaScript for DOM XSS tainted data flow from sources to sinks.

6|1|Updated Mar 9, 2026
One-click install
npx skills add https://github.com/securityfortech/hacking-skills --skill dom-xss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dom-xss
Source: https://github.com/securityfortech/hacking-skills/tree/main/skills/web/client-side/dom-xss
Command: npx skills add https://github.com/securityfortech/hacking-skills --skill dom-xss

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses DOM-based Cross-Site Scripting (XSS), a vulnerability where client-side JavaScript mishandles attacker-controlled data, leading to arbitrary code execution without server interaction.

Core Features & Use Cases

  • Vulnerability Detection: Identifies JavaScript code that reads from controllable DOM sources (e.g., location.hash, document.referrer) and writes to dangerous sinks (e.g., innerHTML, eval).
  • Exploitation Scenarios: Provides examples of how DOM XSS can be exploited through various sinks and data sources.
  • Fix Patterns: Offers concrete solutions like using textContent instead of innerHTML, sanitizing input with DOMPurify, and implementing Content Security Policy (CSP).
  • Use Case: A security analyst uses this skill to audit a web application's JavaScript code, pinpointing specific instances where user input from URL parameters is directly rendered into the page's HTML, thus preventing a potential XSS attack.

Quick Start

Audit the provided JavaScript code for DOM-based XSS vulnerabilities by checking for tainted data flow from DOM sources to dangerous sinks.

Frequently Asked Questions about dom-xss

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect DOM-based XSS vulnerabilities in JavaScript code?

Detect DOM-based XSS by auditing JavaScript for tainted data flow from controllable DOM sources like location.hash to dangerous sinks like innerHTML. You can perform this analysis through manual review using browser DevTools or automated scanning.

What are common DOM sources and sinks that lead to cross-site scripting?

Common DOM XSS sources include location.hash, document.referrer, and URL parameters, while dangerous sinks include innerHTML, eval, and event handlers. Analyzing data flow between these sources and sinks identifies client-side execution risks.

How do I prevent DOM XSS when dynamically generating content from URL parameters?

Prevent DOM XSS when dynamically generating content by using safe alternatives like textContent instead of innerHTML, sanitizing inputs with DOMPurify, and implementing a strict Content Security Policy (CSP) to block unauthorized script execution.

Can I use Burp Suite DOM Invader to audit client-side routing for XSS?

Yes, you can use Burp Suite DOM Invader for automated analysis of client-side routing and dynamic content generation. It helps identify tainted data paths from DOM sources to execution sinks without requiring manual DevTools inspection.

Why does DOM-based XSS not require server interaction to execute?

DOM-based XSS executes without server interaction because the vulnerability resides entirely in client-side JavaScript. The browser's DOM is modified directly using attacker-controlled data from sources like document.referrer, bypassing server-side validation.

Are there limitations to detecting DOM XSS with manual browser DevTools review?

Manual DevTools review is limited by the complexity of client-side routing and dynamic event handlers. It requires tracing tainted data flow through extensive JavaScript, making automated tools like Burp Suite DOM Invader necessary for comprehensive vulnerability detection.