thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Application & OT Security · Intermediate

DOM-Based Cross-Site Scripting

XSS that occurs entirely in client-side JavaScript when it writes untrusted data from a source into a dangerous sink.

Definition

Sources include location.hash and document.referrer; sinks include innerHTML, document.write and eval. The server may never see the payload, so server-side filters and some scanners miss it. Defenses include safe DOM APIs (textContent), Trusted Types, framework escaping and CSP.

Example

Script writes location.hash into innerHTML, executing markup in the URL fragment.

Exam tip

DOM XSS is a client-side source-to-sink flaw; server-side encoding alone may not fix it.

Related terms