Advisory

GHSA-rp9w-3fw7-7cwq

Also known as: CVE-2026-49978

Summary

DOMPurify IN_PLACE Sanitization Bypass via Attached Shadow Root Inside <template>.content

Details

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

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2026-06-15 20:01 UTC
Modified
2026-09-10 03:50 UTC

Affected packages and fixes

dompurify

npm · All systems

Affected

  • introduced 0, fixed 3.4.7 (semver)

Fixed versions

3.4.7

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences