Simulations/DOM-Based XSS

DOM-Based XSS

Intermediate

The search page copies location.hash straight into innerHTML. The payload never touches the server — the sink is in the browser. Craft an HTML payload, watch it "execute", then switch to a safe sink.

Progress:
1
Pop a Script via the Hash
2
Steal the Session Cookie
3
Neutralize with textContent
⚡ URL fragment payload
https://shop.example.com/search#
🛡 Client-side fix
Render trace
Waiting for a fragment…

Challenges

1
Pop a Script via the Hash
Put an HTML payload after the # so the innerHTML sink parses and runs it.
hints
2
Steal the Session Cookie
Extend the payload so the injected handler reads document.cookie and exfiltrates it.
hints
3
Neutralize with textContent
Enable the sanitizer and resend an HTML payload — confirm it renders as inert text.
hints
How to fix DOM-based XSS
safe sinks, sanitizers, CSP, HttpOnly cookies

Frequently Asked Questions