Executive brief
DOMPurify, a widely used library for cleaning HTML to prevent security attacks, contains a flaw in how it handles custom configuration settings. When specific security hooks are used alongside a persistent configuration, the library fails to properly isolate its internal list of allowed attributes. This allows an attacker to bypass security filters and execute malicious scripts (Cross-Site Scripting) in the browsers of other users, potentially leading to account takeover or data theft.
Technical details
A vulnerability exists in DOMPurify where the 'clone-guard' intended to prevent hook-based allowlist pollution is bypassed when using the persistent configuration API (setConfig). The root cause is that setConfig() sets a internal flag that causes subsequent sanitize() calls to skip the _parseConfig function where the allowlist cloning logic resides. Consequently, if an 'uponSanitizeAttribute' hook conditionally allows a dangerous attribute (like 'onerror') for a specific element, that attribute is permanently added to the shared global allowlist for the lifetime of the DOMPurify instance. An attacker can exploit this by submitting content that triggers the hook's condition, followed by malicious content that leverages the now-polluted allowlist to achieve stored Cross-Site Scripting (XSS). This issue is fixed in version 3.4.11.
Affected products
- cure53 DOMPurify < 3.4.11
Timeline
- 2026-06-17: advisory: GHSA-cmwh-pvxp-8882 published by cure53
- 2026-07-23: disclosed: NVD publication date