pentesting, updated
Testing for DOM-based cross site scripting
Check whether client-side JavaScript takes attacker-controlled input and writes it into the DOM unsafely, without ever reaching the server.
Goal
Confirm untrusted sources (URL, location, document.referrer, postMessage) never reach a dangerous sink (innerHTML, eval, document.write) unsanitized.
How to test
Search the page’s JS for dangerous sinks and trace what feeds them:
curl -s https://example.com/app.js | grep -nE "innerHTML|document\.write|eval\(|location\.(hash|search)"
Then try a URL-fragment payload (never sent to the server, so this is the one class server-side logs won’t show):
https://example.com/page#<img src=x onerror=alert(1)>
What to look for
The payload executing from a source the server never saw — the fragment (#...) is the classic proof it’s a client-side-only sink.
References
- OWASP WSTG-CLNT-01 — Testing for DOM-Based Cross Site Scripting.