DOMPurify IN_PLACE Sanitization Bypass via Attached Shadow Root Inside <template>.content
- When
- Where
- Global (internet)
- Category
- cyber_advisory · npm
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](https://github.com/user-attachments/files/28275600/advisory.pdf) [poc.html](https://github.com/user-attachments/files/28275708/poc.html)
Sources
- GitHub Advisory Database ↗ · first seen 2026-06-15 20:01 UTC
Defaxon links out to the original reporting and never republishes article text.
Correlated events
Computed by the Defaxon correlation engine — linked by shared actors, co-location, and temporal proximity. Scored hypotheses, never causal claims.