CVE-2026-49978
Analyzed Analyzed - Analysis Complete

DOM Clobbering via DOMPurify In-Place Sanitization

Vulnerability report for CVE-2026-49978, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-07-14

Last updated on: 2026-07-21

Assigner: GitHub, Inc.

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.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-07-14
Last Modified
2026-07-21
Generated
2026-08-04
AI Q&A
2026-07-15
EPSS Evaluated
2026-08-02
NVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
cure53 dompurify to 3.4.7 (exc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-79 The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

DOMPurify is a tool used to sanitize HTML, MathML, and SVG to prevent cross-site scripting (XSS) attacks. The vulnerability in versions prior to 3.4.7 involves a flaw in the IN_PLACE sanitization process.

Specifically, when DOMPurify sanitizes content inside a <template> element, it may skip sanitizing shadow contents attached to elements within <template>.content. This allows attacker-controlled markup, such as malicious event handlers, JavaScript URLs, or scripts, to remain intact after sanitization.

If an application clones and inserts the sanitized template, the malicious markup could execute, leading to potential XSS attacks.

The issue is fixed in DOMPurify version 3.4.7.

Detection Guidance

Detecting this vulnerability requires checking if your system or application uses a vulnerable version of DOMPurify (prior to 3.4.7) and if it employs IN_PLACE sanitization on templates containing shadow contents.

  • Identify applications using DOMPurify: Search your codebase or dependencies for references to DOMPurify. For example, in a Node.js environment, you can check package.json for the DOMPurify version: grep -r "dompurify" /path/to/project.
  • Check DOMPurify version: If DOMPurify is installed, verify its version. In Node.js, you can run: npm list dompurify or check the version in the package-lock.json or yarn.lock file.
  • Review code for IN_PLACE sanitization: Search for instances where DOMPurify.sanitize is called with the IN_PLACE option, particularly on templates containing shadow DOM content. Example search: grep -r "DOMPurify.sanitize.*IN_PLACE" /path/to/project.
  • Inspect template usage: Look for code that clones or inserts template.content, especially if shadow DOM is involved. Example search: grep -r "template.content" /path/to/project.

There are no network-based detection methods for this vulnerability, as it is a client-side code issue rather than a network-exploitable flaw.

Impact Analysis

This vulnerability can impact you in several ways if you are using an affected version of DOMPurify (prior to 3.4.7) in your web application:

  • Exposure to cross-site scripting (XSS) attacks: Attackers could inject malicious scripts or event handlers into your application, which may execute when sanitized templates are cloned and inserted.
  • Compromise of user data: If an attacker successfully exploits this vulnerability, they could steal sensitive user data, such as session cookies, credentials, or personal information.
  • Unauthorized actions: Malicious scripts could perform actions on behalf of users without their consent, such as making unauthorized requests or modifying application data.
  • Reputation damage: A successful XSS attack could harm your organization's reputation, leading to loss of user trust and potential legal consequences.

To mitigate these risks, you should update to DOMPurify version 3.4.7 or later.

Compliance Impact

This vulnerability can affect compliance with common standards and regulations in the following ways:

  • GDPR (General Data Protection Regulation): If this vulnerability leads to unauthorized access or disclosure of personal data, it could violate GDPR requirements for data protection and security. Organizations may face fines or legal action if they fail to protect user data adequately.
  • HIPAA (Health Insurance Portability and Accountability Act): For organizations handling protected health information (PHI), this vulnerability could result in unauthorized access to sensitive health data. Non-compliance with HIPAA security rules may lead to penalties and reputational damage.
  • PCI DSS (Payment Card Industry Data Security Standard): If your application processes payment card data, an XSS vulnerability could lead to non-compliance with PCI DSS requirements for securing cardholder data. This may result in fines or loss of payment processing capabilities.

To maintain compliance, organizations should address this vulnerability promptly by updating to the fixed version of DOMPurify and ensuring their applications are secure against XSS attacks.

Mitigation Strategies

To mitigate this vulnerability, follow these steps:

  • Upgrade DOMPurify to version 3.4.7 or later. This version includes the fix for the IN_PLACE sanitization issue with shadow contents in templates.
  • If upgrading is not immediately possible, avoid using the IN_PLACE sanitization option on templates containing shadow DOM content. Instead, use standard sanitization methods without IN_PLACE.
  • Review and audit your codebase for instances where DOMPurify.sanitize is called with IN_PLACE on templates, and refactor to use safer alternatives if necessary.
  • Ensure that any dynamic content inserted into the DOM, especially from untrusted sources, is properly sanitized using the latest version of DOMPurify.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-49978. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart