Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

DOMPurify: `CUSTOM_ELEMENT_HANDLING` bypasses `afterSanitizeElements` for allowed custom elements.

0
Low
Published: 07/21/2026 (07/21/2026, 19:41:07 UTC)
Source: GCVE Database
Product: dompurify

Description

DOMPurify 3.4.11 has a vulnerability involving the CUSTOM_ELEMENT_HANDLING configuration where allowed custom elements bypass the afterSanitizeElements hook. This causes sensitive attributes to be preserved on these custom elements while they are stripped from normal elements. Although DOMPurify itself does not directly allow executable payloads at sanitize time, the preserved attributes can lead to second-order XSS when re-injected into HTML sinks later. The issue arises from early return logic in the sanitization flow that skips further sanitization steps for allowed custom elements. This vulnerability is fixed in versions 3.4.12 and later.

CVSS v4.0

Attack Vector
Network
Attack Complexity
High
Attack Requirements
None
Privileges Required
None
User Interaction
Active
Vuln. Confidentiality
None
Vuln. Integrity
None
Vuln. Availability
None
Subsq. Confidentiality
Low
Subsq. Integrity
Low
Subsq. Availability
None
CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N

Affected software

npmghsa
dompurify
Affected versions
<3.4.12

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

AILast updated: 07/22/2026, 00:56:04 UTC

Technical Analysis

The vulnerability in DOMPurify 3.4.11 stems from an inconsistency in the sanitization hook policy related to CUSTOM_ELEMENT_HANDLING. When a custom element is allowed via the tagNameCheck configuration, the sanitization function _sanitizeDisallowedNode returns early, skipping the afterSanitizeElements hook and other sanitization checks such as namespace validation and fallback-tag mXSS checks. This results in sensitive attributes not being removed from allowed custom elements, unlike normal elements. While the sanitized attribute values remain inert initially, they can become exploitable if the custom element later injects these values into an HTML sink like innerHTML, enabling a second-order XSS vector. The flaw is due to control flow that bypasses critical sanitization steps for allowed custom elements. The affected versions are all prior to 3.4.12.

Potential Impact

Sensitive attributes that would normally be stripped from elements during sanitization are preserved on allowed custom elements due to the bypass of the afterSanitizeElements hook. This preservation does not directly enable immediate XSS at sanitize time, but it creates a second-order XSS risk if the custom element later injects these attributes into an HTML sink such as innerHTML. The vulnerability thus weakens the security guarantees of DOMPurify in applications relying on afterSanitizeElements to enforce attribute removal on all elements, potentially leading to client-side code injection.

Mitigation Recommendations

A fix is available in DOMPurify version 3.4.12 and later. Users should upgrade to version 3.4.12 or newer to ensure that the afterSanitizeElements hook and other sanitization checks are properly applied to allowed custom elements. Until upgraded, applications should be cautious about relying solely on afterSanitizeElements for security policy enforcement on custom elements. No vendor advisory indicates that no action is required or that the issue is otherwise mitigated.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
GHSA-c2j3-45gr-mqc4
Osv Schema Version
1.4.0
Aliases
[]
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: 07/22/2026, 00:56:04 UTC

Last updated: 07/22/2026, 01:35:57 UTC

Views: 4

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses