CVE-2026-140391: DOMPurify before 3.4.18 SAFE_FOR_TEMPLATES Bypass Leading to XSS
DOMPurify before 3.4.18 contains a SAFEFORTEMPLATES bypass that allows attackers to smuggle template expressions past sanitization using nested form elements or orphaned end tags. When the sanitized output is reparsed via innerHTML, split braces merge into live {{...}} expressions that Vue or AngularJS evaluate, executing attacker JavaScript in victims' browsers.
Affected Software
Event History
Frequently Asked Questions
Which applications are exposed to exploitation?
Applications using DOMPurify before 3.4.18 are exposed when they use SAFE_FOR_TEMPLATES, insert sanitized attacker-controlled output through innerHTML, and subsequently allow Vue or AngularJS to process that output.
What does an attacker need to exploit this issue?
An attacker needs a way to supply markup that reaches DOMPurify sanitization. They can use nested form elements or orphaned end tags to cause split braces to merge into a live {{...}} template expression after innerHTML reparses the sanitized output.
Is user interaction required?
Yes. The supplied vector indicates user interaction is required, and successful exploitation results in attacker JavaScript executing in a victim's browser.
What version should be used to remediate the issue?
Upgrade DOMPurify to version 3.4.18 or later. The issue affects versions before 3.4.18.