CVE-2026-49978: DOMPurify IN_PLACE Sanitization Bypass via Attached Shadow Root Inside <template>.content

Published Jun 15, 2026
·
Updated

DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. Prior to 3.4.7, DOMPurify INPLACE sanitization could skip shadow contents attached to an element inside <template>.content, allowing attacker-controlled markup such as event handlers, JavaScript URLs, or scripts to survive and execute when an application cloned and inserted the sanitized template. This issue is fixed in version 3.4.7.

Other sources

If the HTML you give it contains a <template> element, and inside that template there's an element with a shadow DOM attached to it, DOMPurify quietly skips over the shadow contents. Whatever the attacker put in there - an image with an onerror handler, a link with a javascript: URL, even a full script - survives untouched. The moment the application uses that template the way templates are meant to be used (cloning it and inserting the result into the page), the malicious payload comes along and runs as if it had never been sanitized. From there an attacker gets everything XSS normally gets them: session cookies, stored tokens, the ability to act as the user, and the ability to leave persistent payloads behind for the next person who visits.

advisory.pdf

poc.html

GitHub

Affected Software

2 affected componentsFixes available
npm/dompurify<=3.4.6
3.4.7
Cure53 DOMPurify<3.4.7

Event History

Jun 15, 2026
Advisory Published
via GitHub·08:01 PM
Data Sourced
via GitHub·08:01 PM
DescriptionWeaknessAffected Software
Jul 14, 2026
CVE Published
via MITRE·08:02 PM
Data Sourced
via MITRE·08:02 PM
DescriptionWeakness
Data Sourced
via NVD·09:17 PM
RemedyDescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-49978?

CVE-2026-49978 has a severity rating of 71.

2

What type of vulnerability is CVE-2026-49978?

CVE-2026-49978 is classified as a Cross-Site Scripting (XSS) vulnerability.

3

How does CVE-2026-49978 occur?

CVE-2026-49978 occurs when HTML containing a <template> element with a shadow DOM is processed by DOMPurify.

4

What are the potential exploits of CVE-2026-49978?

Exploits of CVE-2026-49978 may include injecting scripts through images with onerror handlers or malicious links.

5

How do I fix CVE-2026-49978?

To fix CVE-2026-49978, ensure that shadow DOM contents are properly sanitized by updating to a patched version of DOMPurify.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203