Finding

DOM-based XSS sink fed by URL/location data

errorWebsite securityxss-dom/xss_domGenerated from the catalogue

This page is generated from the scanner's own catalogue. A fuller explanation — how to check it yourself, and fixes for common platforms — is being written.

In short

An inline <script> block combines a dangerous sink (such as document.write, .innerHTML, eval, or jQuery .html()) with a user-controlled source (such as location.hash, document.URL, document.cookie, or postMessage) in the same script. This is a DOM-based XSS pattern (CWE-79): if attacker-influenced data reaches that sink unsanitized, the attacker's own script runs in the victim's browser session, letting them steal cookies or credentials, hijack the session, or rewrite the page for anyone who opens a crafted link. Detection is substring-based and can include false positives.

How to fix it

Sanitize URL/location data before use, prefer textContent over innerHTML, and avoid eval/document.write.

Fix it with your coding agent

Prompt for Claude Code, Cursor or Codex

An Ingati scan of my website reported “DOM-based XSS sink fed by URL/location data” (finding xss-dom/xss_dom, severity error). Find where this comes from in this codebase or the server configuration, fix it, and explain what you changed. The scanner's guidance: Sanitize URL/location data before use, prefer `textContent` over `innerHTML`, and avoid `eval`/`document.write`. Then tell me how to confirm the fix, so the next scan shows it as fixed.

How Ingati finds it

This is one of the Website security checks, and it runs on every scan. When Ingati finds the problem, your report lists it as error, with where it was found and what the scanner saw. Later scans show it as fixed once it is gone.

Ingati checks this and thousands of other things on every scan.

Start scanning