CVE-2026-41239
DOMPurify has a SAFE_FOR_TEMPLATES bypass in RETURN_DOM mode
In short
DOMPurify fails to remove template expressions (like {{...}}) when returning DOM objects instead of strings, allowing attackers to inject malicious code that gets executed by template frameworks like Vue 2.
Technical detail
The SAFE_FOR_TEMPLATES mode in DOMPurify versions 1.0.10–3.3.x improperly handles template syntax in RETURN_DOM and RETURN_DOM_FRAGMENT modes; an attacker can craft HTML with {{payload}} expressions that bypass sanitization and execute arbitrary code when processed by client-side template engines.
Summary generated and translated by AI from the official description.
DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. Starting in version 1.0.10 and prior to version 3.4.0, `SAFE_FOR_TEMPLATES` strips `{{...}}` expressions from untrusted HTML. This works in string mode but not with `RETURN_DOM` or `RETURN_DOM_FRAGMENT`, allowing XSS via template-evaluating frameworks like Vue 2. Version 3.4.0 patches the issue.
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N
Affected products
cure53 · DOMPurifyWant to know if your infrastructure is exposed to this?
Talk to TrueHacking →