CVE-2026-65902

DOMPurify before 3.4.7 Hook Mutation Pollution via allowedTags

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

Analysis

AI-generated

Technical impact

DOMPurify before version 3.4.7 passes references to its internal DEFAULT_ALLOWED_TAGS and DEFAULT_ALLOWED_ATTR sets to the uponSanitizeElement and uponSanitizeAttribute hooks when no explicit configuration is supplied. A hook that mutates these fields permanently widens the default allow‑lists for the lifetime of the DOMPurify instance, so subsequent sanitize calls inherit the widened defaults. Because removeAllHooks(), clearConfig(), and providing a fresh configuration do not reset the state, attacker payloads that use poisoned tag or attribute names survive sanitization. This flaw is an input‑validation weakness identified as CWE‑501 and allows an attacker to inject a tag or attribute that remains after sanitization and can lead to client‑side script execution. The impact is a cross‑site scripting vulnerability that can persist across multiple calls within the same runtime.

Affected Systems

All applications that embed any DOMPurify <=3.4.5 library, especially those that rely on the default configuration, or that register custom hooks that may alter DEFAULT_ALLOWED_TAGS or DEFAULT_ALLOWED_ATTR. The issue does not affect versions 3.4.6 or later, which have been patched to prevent mutation of the default sets.

Risk and Exploitability

The likely attack vector is any client‑side context where an attacker‑controlled hook can be registered—such as a malicious plugin, a compromised script bundle, or a user‑supplied component that directly calls DOMPurify. Once the default lists are mutated, all future sanitizations, even with default settings, will accept the poisoned tags, leading to persistent cross‑site scripting. The CVSS score of 5.3 indicates moderate severity; the EPSS score of less than 1% suggests exploitation is currently unlikely, and the vulnerability is not listed in CISA KEV. However, any environment that allows hook registration presents a potential attack surface.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade to DOMPurify 3.4.7 or later, where the default list mutation bug has been fixed.
  • If an upgrade is not immediately available, avoid using hooks that modify DEFAULT_ALLOWED_TAGS or DEFAULT_ALLOWED_ATTR and create a fresh DOMPurify instance before each sanitization request.
  • Review any custom hook logic for inadvertent mutation of the global allow‑lists and ensure that hooks only read from, not write to, the defaults.

Generated by OpenCVE AI on October 29, 2026 at 23:06 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-76mc-f452-cxcm DOMPurify: Hook mutation of `data.allowedTags` / `data.allowedAttributes` permanently pollutes `DEFAULT_ALLOWED_TAGS` / `DEFAULT_ALLOWED_ATTR`
History
Type Values Removed Values Added
Description DOMPurify before 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. 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.
Type Values Removed Values Added
Metrics ssvc

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

Type Values Removed Values Added
Description DOMPurify before 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.
Title DOMPurify before 3.4.7 Hook Mutation Pollution via allowedTags
First Time appeared Cure53
Cure53 dompurify
Weaknesses CWE-501
CPEs cpe:2.3:a:cure53:dompurify:*:*:*:*:*:*:*:*
Vendors & Products Cure53
Cure53 dompurify
References
Metrics cvssV3_1

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

cvssV4_0

{'score': 5.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
VulnCheck
Published
Updated
Oct 29, 2026, 9:16 PM
Reserved
Jul 23, 2026, 11:03 AM
Status
Modified
Published
Jul 23, 2026, 2:18 PM
Modified
Oct 29, 2026, 9:17 PM