CVE-2026-116804 is a cross-site scripting (XSS) vulnerability in DOMPurify versions 3.4.4 through 3.4.16. It involves a bypass of the SAFE_FOR_TEMPLATES feature that allows attackers to preserve template expressions in attached shadow roots when using certain return modes. This enables attackers to split expressions across text nodes separated by disallowed elements, which merge after removal and are evaluated by downstream template engines, leading to XSS.
DOMPurify versions before 3.4.17 contain a cross-site scripting (XSS) vulnerability. This flaw occurs when an IN_PLACE hook removes a parent or sibling node, leaving attacker-controlled event handlers active in detached subtrees. As a result, malicious handlers such as img onerror can execute after the sanitize() function returns, causing DOM-based XSS.
DOMPurify versions before 3.4.17 contain a cross-site scripting (XSS) vulnerability. This flaw allows attackers to bypass the SMIL attributeName=href guard when parsing application/xhtml+xml content. The vulnerability arises because the function transformCaseFunc does not lowercase attribute names, enabling crafted SVG elements with animate or set tags using attributeName="href" and javascript: URLs to execute scripts upon user interaction.
A vulnerability in DOMPurify when configured with SAFE_FOR_TEMPLATES and a DOM-returning mode allows template expressions split across text nodes in attached shadow roots to survive sanitization. This occurs because the post-walk safety net does not recurse into shadow roots, enabling attackers who supply DOM nodes with shadow roots to inject expressions that are later evaluated by template engines. Exploitation requires specific non-default configurations and attacker control over DOM nodes with attached shadow roots. The vulnerability is fixed in version 3.4.17.
DOMPurify versions prior to 3.4.17 have a vulnerability in the IN_PLACE sanitization mode where hooks that remove a parent or sibling node leave detached subtrees with active event handlers unneutralized. This allows event handlers such as <img onerror> to fire after sanitize() returns, potentially leading to DOM-based XSS. The issue arises because the sanitization process only neutralizes the node directly removed by the hook, not other detached nodes like parents or siblings. This behavior breaks the expected guarantee that detached subtrees are neutralized inline in IN_PLACE mode.
DOMPurify versions prior to 3.4.13 contain a vulnerability in the IN_PLACE sanitization mode where a hook that removes an element can leave detached descendant elements executable. This allows an attacker who can supply HTML to execute JavaScript via retained event handlers on detached subtrees after sanitization completes. The issue arises because the sanitization process skips neutralizing the subtree of a detached node when a hook removes it, leaving event handlers intact on disconnected elements.
DOMPurify versions before 3.4.12 have a vulnerability where the afterSanitizeElements hook is not executed for custom elements allowed via CUSTOM_ELEMENT_HANDLING.tagNameCheck. This allows attributes on these custom elements to bypass security policies, potentially enabling second-order cross-site scripting (XSS) attacks by preserving sensitive attributes that are later re-injected into innerHTML sinks.
In DOMPurify through 3.3.3, function predicates supplied via ADD_ATTR or ADD_TAGS to DOMPurify.sanitize() persist in internal state (EXTRA_ELEMENT_HANDLING) across subsequent sanitize() calls on the same instance. If a later call on the same instance provides ADD_ATTR or ADD_TAGS as an array rather than a function, the previously set function handler is neither cleared nor overwritten, so it continues to approve attacker-controlled attributes or tags. This can allow dangerous event-handler attributes or forbidden tags (bypassing FORBID_TAGS) to survive sanitization, resulting in cross-site scripting. The vendor (Cure53) considers this an edge case outside DOMPurify's threat model; the referenced advisory lists 3.4.0 as the patched version.
DOMPurify before 3.4.4 fails to sanitize DOM elements passed via IN_PLACE mode when the element originates from a different window/realm (e.g., an iframe's contentDocument). A cross-realm instanceof check in the private _isNode() function returns false for foreign-realm nodes, causing DOMPurify to stringify the element (yielding '[object HTMLDivElement]'), silently reset IN_PLACE to false, and return the unsanitized element unchanged with any XSS payloads intact.
DOMPurify before 3.4.7 passes direct references to the module-level DEFAULT_ALLOWED_TAGS and DEFAULT_ALLOWED_ATTR sets to the uponSanitizeElement and uponSanitizeAttribute hooks via data.allowedTags / data.allowedAttributes when sanitize is called without an explicit cfg.ALLOWED_TAGS / cfg.ALLOWED_ATTR array. A hook that mutates these fields permanently widens the default allow-lists for the lifetime of the DOMPurify instance, so all subsequent default-config sanitize calls inherit the widened defaults and attacker payloads using the poisoned tag/attribute name survive sanitization. removeAllHooks(), clearConfig(), and passing a fresh cfg do not recover the state; only constructing a new DOMPurify instance does.
DOMPurify 3.4.11 has a hook-policy inconsistency involving the CUSTOM_ELEMENT_HANDLING configuration. Allowed custom elements bypass the afterSanitizeElements hook, which may cause sensitive attributes to be preserved on these elements while being removed from normal elements. This can lead to a second-order XSS vulnerability if the custom element later injects these attributes into an HTML sink such as innerHTML. This is not a direct DOMPurify XSS but a potential security policy bypass. A fix is available in versions 3.4.12 and later.
DOMPurify versions prior to 2.4.2 are vulnerable to prototype pollution, which could allow an attacker to tamper with the prototype of base objects. This vulnerability has been assigned CVE-2024-48910 and is rated critical with a CVSS score of 9.1. The issue was fixed in version 2.4.2.
DOMPurify versions prior to 2.5.0 and versions from 3.0.0 up to but not including 3.1.3 are vulnerable to a nesting-based mutation cross-site scripting (mXSS) vulnerability (CVE-2024-47875). This vulnerability allows an attacker to inject malicious scripts by exploiting nested HTML structures. The issue has been fixed in versions 2.5.0 and 3.1.3. The vulnerability has a critical severity with a CVSS score of 10.0, indicating high impact on confidentiality, integrity, and availability if exploited.