DOMPurify: `CUSTOM_ELEMENT_HANDLING` bypasses `afterSanitizeElements` for allowed custom elements. (CVE-2026-66010)
Description
DOMPurify 3.4.11 has a hook-policy inconsistency involving the CUSTOM_ELEMENT_HANDLING configuration. Allowed custom elements bypass the afterSanitizeElements hook, which may cause sensitive attributes to be preserved on these elements while being removed from normal elements. This can lead to a second-order XSS vulnerability if the custom element later injects these attributes into an HTML sink such as innerHTML. This is not a direct DOMPurify XSS but a potential security policy bypass. A fix is available in versions 3.4.12 and later.
CVSS v4.0
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
In DOMPurify version 3.4.11, when a custom element is allowed via the CUSTOM_ELEMENT_HANDLING.tagNameCheck configuration, the element bypasses the afterSanitizeElements hook. The sanitization function _sanitizeDisallowedNode returns early for allowed custom elements, skipping subsequent sanitization steps including namespace validation and fallback-tag mXSS checks. As a result, sensitive attributes that would normally be stripped by afterSanitizeElements remain on these custom elements. While the preserved attribute values are inert during initial sanitization, they may be re-injected into HTML sinks later, creating a second-order XSS vector. This vulnerability is due to a control flow inconsistency in the sanitization logic and affects versions prior to 3.4.12.
Potential Impact
Applications relying on DOMPurify 3.4.11 with CUSTOM_ELEMENT_HANDLING to sanitize HTML and strip sensitive attributes may have those attributes preserved on allowed custom elements. This can lead to second-order cross-site scripting (XSS) if the custom elements later inject these attributes into HTML sinks such as innerHTML. The vulnerability does not allow direct execution of payloads during sanitization but creates a potential security bypass in the sanitization policy.
Mitigation Recommendations
A patch is available in DOMPurify version 3.4.12 that addresses this issue. Users should upgrade to version 3.4.12 or later to ensure that allowed custom elements are properly sanitized and the afterSanitizeElements hook is applied consistently. No additional mitigation is required if the update is applied.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-c2j3-45gr-mqc4
- Osv Schema Version
- 1.4.0
- Ecosystems
- ["npm"]
- Database Specific Severity
- LOW
- Cvss Version
- 4.0
Threat ID: 6a600ac39c2644c7f8fe33be
Added to database: 07/22/2026, 00:11:47 UTC
Last enriched: 10/03/2026, 18:24:55 UTC
Last updated: 10/03/2026, 18:24:55 UTC
Views: 155
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.