Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. dompurify
  4. ›
  5. GHSA-c2j3-45gr-mqc4

GHSA-c2j3-45gr-mqc4: DOMPurify: `CUSTOM_ELEMENT_HANDLING` bypasses `afterSanitizeElements` for allowed custom elements.

July 21, 2026 (updated October 2, 2026)

There is a possible hook-policy inconsistency in DOMPurify 3.4.11 involving CUSTOM_ELEMENT_HANDLING.

When a custom element is allowed via CUSTOM_ELEMENT_HANDLING.tagNameCheck, it appears that the element does not go through afterSanitizeElements in the same way as a normal element. As a result, an application that relies on afterSanitizeElements as a security policy layer to strip sensitive attributes from all elements may see those attributes removed from normal elements but preserved on allowed custom elements.

This does not appear to be a direct DOMPurify XSS or a case where DOMPurify directly allows executable payloads. The preserved value is still inert at sanitize time. The issue becomes relevant when the allowed custom element later re-injects that attribute value into an HTML sink such as innerHTML, creating a second-order XSS gadget.

References

  • github.com/advisories/GHSA-c2j3-45gr-mqc4
  • github.com/cure53/DOMPurify/commit/a9ca1e537422319a557a9a2aa61f003b23b4a197
  • github.com/cure53/DOMPurify/pull/1537
  • github.com/cure53/DOMPurify/releases/tag/3.4.12
  • github.com/cure53/DOMPurify/security/advisories/GHSA-c2j3-45gr-mqc4
  • nvd.nist.gov/vuln/detail/CVE-2026-66010
  • www.vulncheck.com/advisories/dompurify-before-hook-bypass-via-custom-element-handling

Code Behaviors & Features

Detect and mitigate GHSA-c2j3-45gr-mqc4 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 3.4.12

Fixed versions

  • 3.4.12

Solution

Upgrade to version 3.4.12 or above.

Impact 4.2 MEDIUM

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

Learn more about CVSS

Weakness

  • CWE-184: Incomplete List of Disallowed Inputs
  • CWE-693: Protection Mechanism Failure
  • CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Source file

npm/dompurify/GHSA-c2j3-45gr-mqc4.yml

Spotted a mistake? Edit the file on GitLab.

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

Page generated Sun, 08 Nov 2026 00:16:17 +0000.