NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · npm

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

mediumCVSS 4.0 5.1GHSA-rp9w-3fw7-7cwq

If the HTML you give it contains a 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.

Published Jun 15, 2026

Affected packages

dompurify

Ecosystem
npm
Affected
<= 3.4.6
Fixed in
3.4.7
Check
npm ls dompurify

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

If the HTML you give it contains a 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

Credited to GameZoneHacker.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology

More npm vulnerabilities

All npm entries