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

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

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. Learn more about Dependency Scanning →

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 Sat, 08 Aug 2026 00:18:07 +0000.