DOMPurify vulnerabilities
17 known CVE vulnerabilities in DOMPurify, translated and rated.
- CVE-2026-75838Medium
DOMPurify before 3.4.13 contains a cross-site scripting vulnerability in IN_PLACE sanitization where element-removal hooks fail to neutralize detached subtrees. Attackers can supply HTML with event handlers on descendant elements that execute after sanitization completes, even though the returned root appears clean.
- CVE-2026-66010Medium
DOMPurify before version 3.4.12 fails to execute the afterSanitizeElements hook for custom elements allowed via CUSTOM_ELEMENT_HANDLING.tagNameCheck, allowing attributes to bypass application security policies. Attackers can preserve sensitive attributes on custom elements that later re-inject them into innerHTML sinks, creating second-order XSS gadgets.
- CVE-2026-65914Medium
DOMPurify before version 3.3.2 has a mutation-XSS vulnerability when sanitized HTML is reinserted into special parsing contexts using innerHTML with wrappers like script, xmp, iframe, noembed, noframes, or noscript. Attackers can craft payloads with closing sequences that break out of the wrapper context during reparsing, reactivating dangerous markup with event handlers to execute JavaScript.
- CVE-2026-65913Medium
DOMPurify before version 3.3.2 contains a prototype pollution vulnerability in USE_PROFILES mode. Attackers can set Array.prototype properties like onclick to true, causing DOMPurify to accept event handlers as allowed attributes, leading to DOM-based XSS.
- CVE-2026-65912Medium
DOMPurify before version 3.3.2 contains a URI validation bypass vulnerability when ADD_ATTR is provided as a predicate function via EXTRA_ELEMENT_HANDLING.attributeCheck. Attackers can supply a predicate that accepts specific attribute and tag combinations to bypass URI-safe validation, allowing unsafe protocols like javascript: to survive sanitization, leading to DOM-based XSS when the link is activated.
- CVE-2026-65911Medium
In DOMPurify through version 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 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.
- CVE-2026-65904Medium
DOMPurify through 3.3.3 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.
- CVE-2026-65903Medium
DOMPurify before version 3.4.0 contains a logic error in the ADD_TAGS function where short-circuit evaluation allows forbidden tags to bypass FORBID_TAGS restrictions. Attackers can craft input containing tags listed in FORBID_TAGS that are also added via ADD_TAGS function, causing them to be retained in sanitized output.
- CVE-2026-65902Medium
DOMPurify before version 3.4.7 (affected versions <= 3.4.5) 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.
- CVE-2026-65901Medium
DOMPurify through version 3.4.6 contains a cross-site scripting vulnerability in IN_PLACE mode that trusts attacker-controlled nodeName on live non-form nodes. Attackers can supply hostile live DOM objects with real script children whose observable nodeName is clobbered to appear as allowed elements, causing scripts to execute when the sanitized tree is inserted into a live document.
- CVE-2026-65900Medium
DOMPurify versions 3.0.0 to before 3.4.8, when configured with SAFE_FOR_TEMPLATES and a DOM output mode, fail to strip template expressions inside <template> elements. The final scrub pass does not process template.content, so expressions may survive and be evaluated by a downstream template engine.
- CVE-2026-65899Medium
DOMPurify 3.0.0 before version 3.4.9 does not reset the retained Trusted Types policy when clearConfig() is called, so a DOMPurify instance reused across trust boundaries stays bound to a previously supplied TRUSTED_TYPES_POLICY. A later caller that requests RETURN_TRUSTED_TYPE output receives a TrustedHTML object created by the old (potentially unsafe) policy rather than a clean default, which can lead to script execution at a Trusted Types sink. Passing TRUSTED_TYPES_POLICY: null on the later call also does not clear the retained policy.
- CVE-2026-65898High
DOMPurify before 3.4.11 fails to clone the ALLOWED_ATTR allowlist when setConfig() is used with an uponSanitizeAttribute hook, allowing the hook to permanently mutate the shared allowlist. Attackers can register a hook that conditionally allows dangerous attributes like onerror for trusted elements, then submit untrusted content that inherits the polluted allowlist and executes event handlers as stored XSS.
- CVE-2026-49978Medium
DOMPurify prior to 3.4.7 has an IN_PLACE sanitization vulnerability that skips shadow DOM content inside <template>.content. Attackers can inject HTML with event handlers, JavaScript URLs, or scripts that execute when the sanitized template is cloned and inserted.
- CVE-2026-49459Medium
Vulnerability in DOMPurify before version 3.4.6 allows event-handler attributes to be preserved on an attacker-controlled <form> root when using DOMPurify.sanitize(root, { IN_PLACE: true }), enabling XSS attacks.
- CVE-2026-49458Medium
DOMPurify prior to version 3.4.6 incorrectly handles same-origin foreign-realm DOM nodes with IN_PLACE: true, bypassing sanitization and allowing executable markup to survive.
- CVE-2026-47423High
DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. In 3.4.4, DOMPurify allowed selectedcontent by default, allowing browsers to re-clone an XSS payload after sanitization so that unsanitized markup inside <selectedcontent> is returned. This issue is fixed in version 3.4.5.

