6.3medium
DOMPurify IN_PLACE Sanitization Bypass via Attached Shadow Root Inside <template>.content
- Severity
- 6.3medium CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.33% (higher than 28% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-rp9w-3fw7-7cwq
Description
DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. Prior to 3.4.7, DOMPurify IN_PLACE 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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| cure53 DOMPurify | < 3.4.6, before 3.4.7 | CVE List, NVD |
| dompurify (npm) | before 3.4.7 | GitHub Advisory Database |
All scores
| GitHub_M | 6.3medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N |
| NVD | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. Prior to 3.4.7, DOMPurify IN_PLACE 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.
GitHub Advisory Database
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.
NVD (es)
DOMPurify es un saneador de cross-site scripting exclusivo para DOM para HTML, MathML y SVG. Antes de la versión 3.4.7, el saneamiento IN_PLACE de DOMPurify podría omitir el contenido en la sombra adjunto a un elemento dentro de [template].content, permitiendo que el marcado controlado por el atacante, como controladores de eventos, URLs de JavaScript o scripts, sobreviviera y se ejecutara cuando una aplicación clonaba e insertaba la plantilla saneada. Este problema está solucionado en la versión 3.4.7.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-49978 changed 2026-07-21 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-rp9w-3fw7-7cwq changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-49978 changed 2026-10-24 | Public domain |