CVE-2026-49978

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

Published Jul 14, 2026 CVSS 4.0 · 6.3 Medium EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical impact

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 a <template>.content, allowing attacker‑controlled markup such as event handlers, JavaScript URLs, or scripts to survive sanitization. When an application clones and inserts the sanitized template, the embedded malicious code can execute, resulting in arbitrary JavaScript execution. This flaw is a CWE‑79 vulnerability due to improper neutralization of input during page generation. This issue is fixed in version 3.4.7.

Affected Systems

The affected product is DOMPurify, managed by the cure53 CNA. All releases older than 3.4.7 are vulnerable, including versions 3.4.6 and earlier. No other vendors or products are listed in the advisory.

Risk and Exploitability

The CVSS score is 6.3, indicating moderate severity. The EPSS score is below 1%, suggesting a low probability of exploitation at this time, and the vulnerability is not listed in the CISA KEV catalog. The likely attack vector requires an attacker to supply malicious markup containing an attached shadow root within a <template> element, rely on an application that performs IN_PLACE sanitization followed by cloning and insertion of the template, and then trigger the embedded code. Because the flaw bypasses sanitization of the shadow root, the contained script or event handlers can execute when the template is rendered.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade DOMPurify to at least version 3.4.7
  • If upgrading is not immediately possible, avoid cloning or inserting sanitized templates that contain attached shadow roots; instead, strip or detach shadow roots before calling DOMPurify IN_PLACE sanitization
  • As a temporary workaround, manually remove any remaining script tags, event handler attributes, and JavaScript URLs from the sanitized content before it is inserted into the page

Generated by OpenCVE AI on July 31, 2026 at 05:05 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-rp9w-3fw7-7cwq DOMPurify IN_PLACE Sanitization Bypass via Attached Shadow Root Inside <template>.content
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Cure53
Cure53 dompurify
Vendors & Products Cure53
Cure53 dompurify
Type Values Removed Values Added
References
Metrics threat_severity

None

cvssV3_1

{'score': 8.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N'}

threat_severity

Important

Type Values Removed Values Added
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.
Title DOMPurify IN_PLACE Sanitization Bypass via Attached Shadow Root Inside <template>.content
Weaknesses CWE-79
References
Metrics cvssV4_0

{'score': 6.3, 'vector': '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'}

Weaknesses
  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jul 21, 2026, 2:59 PM
Reserved
Jun 2, 2026, 6:30 PM
Status
Analyzed
Published
Jul 14, 2026, 9:17 PM
Modified
Oct 24, 2026, 9:10 PM
Severity
Important
Public date
Jul 14, 2026, 8:02 PM