GHSA-c2j3-45gr-mqc4: DOMPurify: `CUSTOM_ELEMENT_HANDLING` bypasses `afterSanitizeElements` for allowed custom elements.
(updated )
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 →