Executive brief
DOMPurify is a popular library used to clean HTML and prevent malicious code from running in web applications. A flaw was found where certain custom HTML elements could bypass security checks designed to strip out dangerous attributes. If an application uses these custom elements and later processes their data, an attacker could potentially execute malicious scripts (Cross-Site Scripting), leading to unauthorized actions or data theft.
Technical details
A logic flaw in DOMPurify's `_sanitizeDisallowedNode` function causes an early return when a custom element is validated via `CUSTOM_ELEMENT_HANDLING.tagNameCheck`. This early return bypasses subsequent sanitization steps in `_sanitizeElements`, specifically the execution of the `afterSanitizeElements` hook. If an application relies on this hook to enforce security policies (such as stripping sensitive attributes), those attributes will be preserved on custom elements. While the attributes remain inert during the initial sanitization, they can serve as second-order XSS gadgets if the application later re-injects the preserved attribute values into a dangerous sink like `innerHTML`. The issue is fixed in version 3.4.12.
Affected products
- cure53 DOMPurify < 3.4.12
Timeline
- 2026-07-11: advisory: GitHub Security Advisory GHSA-c2j3-45gr-mqc4 published
- 2026-07-24: disclosed: CVE-2026-66010 published to NVD