Executive brief
DOMPurify is a security library used by web applications to clean user-provided content and prevent malicious scripts from running. A flaw in how the library handles specific HTML template elements allows attackers to bypass security filters and execute unauthorized JavaScript in a user's browser. This could lead to account takeover, theft of sensitive session data, or unauthorized actions performed on behalf of the user.
Technical details
A Cross-Site Scripting (XSS) vulnerability exists in DOMPurify when using the IN_PLACE sanitization mode. The sanitizer fails to inspect shadow contents attached to elements located inside <template>.content fragments. An attacker can craft malicious markup containing event handlers or JavaScript URLs within these shadow roots that survive the sanitization process. When the application subsequently clones and inserts the sanitized template into the DOM, the malicious payload executes. This issue is resolved in version 3.4.7 by hardening the handling of Shadow Roots during IN_PLACE operations.
Affected products
- cure53 DOMPurify < 3.4.7
Timeline
- 2026-05-27: patched: Version 3.4.7 released
- 2026-05-27: advisory: GitHub Security Advisory GHSA-rp9w-3fw7-7cwq published
- 2026-07-14: disclosed: CVE-2026-49978 published to NVD