Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. dompurify
  4. ›
  5. GHSA-76mc-f452-cxcm

GHSA-76mc-f452-cxcm: DOMPurify: Hook mutation of `data.allowedTags` / `data.allowedAttributes` permanently pollutes `DEFAULT_ALLOWED_TAGS` / `DEFAULT_ALLOWED_ATTR`

June 15, 2026

The data.allowedTags and data.allowedAttributes fields passed to uponSanitizeElement and uponSanitizeAttribute hooks are direct references to the library’s live ALLOWED_TAGS / ALLOWED_ATTR sets. For sanitize calls that don’t supply an explicit cfg.ALLOWED_TAGS / cfg.ALLOWED_ATTR array, those live sets are themselves direct references to the module-level DEFAULT_ALLOWED_TAGS / DEFAULT_ALLOWED_ATTR constants. A hook that mutates these fields — a natural-looking pattern for “allow X for this iteration” — permanently writes new entries into the default constants for the DOMPurify instance’s lifetime. Every subsequent sanitize call that doesn’t override the config inherits the widened defaults, so an attacker payload that uses the poisoned tag/attribute name survives sanitization. removeAllHooks(), clearConfig(), and even passing a fresh cfg: {} do not recover; only constructing a new DOMPurify instance does.

The maintainer’s existing defense at src/purify.ts:696-700 explicitly clones DEFAULT_ALLOWED_TAGS before mutating it via cfg.ADD_TAGS (array form), demonstrating awareness of this exact class. The hook path remained uncovered.

References

  • github.com/advisories/GHSA-76mc-f452-cxcm
  • github.com/cure53/DOMPurify/security/advisories/GHSA-76mc-f452-cxcm

Code Behaviors & Features

Detect and mitigate GHSA-76mc-f452-cxcm with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 3.4.7

Fixed versions

  • 3.4.7

Solution

Upgrade to version 3.4.7 or above.

Impact 6.1 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Learn more about CVSS

Weakness

  • CWE-501: Trust Boundary Violation
  • CWE-693: Protection Mechanism Failure

Source file

npm/dompurify/GHSA-76mc-f452-cxcm.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 23 Jun 2026 12:24:55 +0000.