Analyze web applications for DOM-based Cross-Site Scripting (XSS) vulnerabilities. Use this skill whenever the user needs to find, understand, or exploit DOM XSS issues in JavaScript code, HTML pages, or web applications. Trigger on requests about DOM vulnerabilities, JavaScript injection, unsafe sinks, source-to-sink data flow, or any XSS-related security testing.
Instrucciones de origen · Vista previa de solo lectura
name
dom-xss-analysis
description
Analyze web applications for DOM-based Cross-Site Scripting (XSS) vulnerabilities. Use this skill whenever the user needs to find, understand, or exploit DOM XSS issues in JavaScript code, HTML pages, or web applications. Trigger on requests about DOM vulnerabilities, JavaScript injection, unsafe sinks, source-to-sink data flow, or any XSS-related security testing.
DOM XSS Analysis
A skill for identifying and exploiting DOM-based Cross-Site Scripting vulnerabilities in web applications.
What is DOM XSS?
DOM vulnerabilities occur when data from attacker-controlled sources flows unsafely to sinks without proper validation or sanitization. This enables script execution in the victim's browser context.
Sources: Inputs attackers can manipulate (URLs, cookies, web messages, localStorage)
Sinks: Dangerous endpoints that execute or render content (eval(), innerHTML, location.href)
Follow how source data moves through the application:
Find where source data is read
Track variable assignments and transformations
Identify where the data reaches a sink
Check if sanitization occurs between source and sink
Step 3: Identify Sinks
Search for dangerous sink functions:
// Use grep or IDE search for:eval(
innerHTML =
outerHTML =
location.href =
location.assign(
location.replace(
setTimeout(
setInterval(
document.write(
Step 4: Test for Vulnerabilities
Once you identify a potential source-to-sink flow, test with payloads:
// Basic XSS test
<script>alert(1)</script>
// For innerHTML (script tags may be blocked)
<img src=x onerror=alert(1)>
<svg onload=alert(1)>
// For URL sinks
javascript:alert(1)
// For eval/Function sinks
alert(1)//
Common Attack Patterns
Open Redirect
Vulnerability: Attacker-controlled data written to navigation sinks
// If you control the start of the URL:
location.href = userInput; // userInput = "javascript:alert(1)"// Or redirect to attacker site:
location.href = userInput; // userInput = "https://evil.com"
Cookie Manipulation
Vulnerability: Attacker-controlled data written to document.cookie
Some sanitizers only block <script> tags but allow event handlers:
// If only script tags are removed:
<img src=x onerror=alert(1)> // Still works!
<svg onload=alert(1)> // Still works!
<body onload=alert(1)> // Still works!