CVE-2026-144292 — Dompurify — CWE-79 · CWE-1336
### Summary With `SAFE_FOR_TEMPLATES: true`, DOMPurify 3.4.18 returns a string that contains no `{{` or `}}`, yet becomes a live `{{…}}` expression as soon as it is assigned to `innerHTML`. A template engine that compiles that DOM (verified with Vue 3 in-DOM templates and AngularJS 1.8.3) evaluates the attacker's expression, giving arbitrary JavaScript execution. The attacker controls only the markup passed to `sanitize()`. The only configuration required is `SAFE_FOR_TEMPLATES: true`, which is a protective option used for its documented purpose. Reproduced on DOMPurify 3.4.18 (npm `latest`) in Chromium 156, Firefox 157 and WebKit 27.2. The plain `{{…}}` case is still scrubbed correctly, so this is a gap in the existing protection. ### Details SAFE_FOR_TEMPLATES is enforced in two places in `src/purify.ts`, and neither accounts for how the returned string is parsed a second time by the consumer. 1. Per text node, during the walk (around line 2122): ```ts /* Sanitize element content to be template-safe */ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) { const content = _stripTemplateExpressions(currentNode.textContent); ... ``` 2. After serialization, a tree scrub that only runs when the serialized output contains a marker (around line 2872): ```ts if ( SAFE_FOR_TEMPLATES && regExpTest(EXPRESSIONS.TMPL_MARKER_SERIALIZED, serializedHTML) ) { _scrubOwnCharacterData(body); serializedHTML = WHOLE_D
### Summary With `SAFE_FOR_TEMPLATES: true`, DOMPurify 3.4.18 returns a string that contains no `{{` or `}}`, yet becomes a live `{{…}}` expression as soon as it is assigned to `innerHTML`. A template engine that compiles that DOM (verified with Vue 3 in-DOM templates and AngularJS 1.8.3) evaluates the attacker's expression, giving arbitrary JavaScript execution. The attacker controls only the markup passed to `sanitize()`. The only configuration required is `SAFE_FOR_TEMPLATES: true`, which is a protective option used for its documented purpose. Reproduced on DOMPurify 3.4.18 (npm `latest`) in Chromium 156, Firefox 157 and WebKit 27.2. The plain `{{…}}` case is still scrubbed correctly, so this is a gap in the existing protection. ### Details SAFE_FOR_TEMPLATES is enforced in two places in `src/purify.ts`, and neither accounts for how the returned string is parsed a second time by the consumer. 1. Per text node, during the walk (around line 2122): ```ts /* Sanitize element content to be template-safe */ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) { const content = _stripTemplateExpressions(currentNode.textContent); ... ``` 2. After serialization, a tree scrub that only runs when the serialized output contains a marker (around line 2872): ```ts if ( SAFE_FOR_TEMPLATES && regExpTest(EXPRESSIONS.TMPL_MARKER_SERIALIZED, serializedHTML) ) { _scrubOwnCharacterData(body); serializedHTML = WHOLE_D
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CVE-2026-144292
CVSS 7.6/10 · HIGH · 03.12.2026
CWE: CWE-79, CWE-1336
Vector: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 WHAT IS THIS VULNERABILITY?
Cross-Site Scripting (XSS)
Summary: DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. Prior to 3.5.0, DOMPurify.sanitize() with SAFE_FOR_TEMPLATES can return attacker-controlled markup whose brace fragments remain separated during sanitization but become adjacent when nested form elements are reparsed through innerHTML. A template engine that compiles the reparsed DOM can evaluate the reconstructed…
⚡ ATTACK VECTOR
Network / Remote (AV:N) · no authentication required (PR:N) · user interaction required (UI:R) · low attack complexity (AC:L).
🌍 REAL WORLD IMPACT
All confidential data readable/stealable; data can be modified or deleted; reduced availability or partial DoS (A:L).
🛡️ REMEDIATION
→ Apply the vendor-released patch immediately.
→ Add CSP headers, HTML-encode all user input.
→ Pre-patch: put service behind VPN or apply IP allowlist.
→ Add WAF rule, create IDS alert for anomalous traffic.
⚠️ URGENCY
⚠️ This week (7 days) — High risk, anonymous remote.
────────────────────────────────────────
[Automated Technical Vulnerability & CVSS Vector Analysis]