DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS
Affects dompurifySource GCVE Database
CVSS 5.1 Medium : upgrade to 3.4.13 when convenient.
Data as of 8 Aug 2026, 15:44 UTC
- Patch
- Available – fixed in 3.4.13
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:NWhat to do
Upgrade dompurify to 3.4.13.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| npmdompurify | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
A patch is available in DOMPurify version 3.4.13 that fixes this issue by ensuring the detached subtree is neutralized before returning from hook-detachment branches. Users should upgrade to version 3.4.13 or later. If upgrading is not immediately possible, avoid using the IN_PLACE configuration with hooks that remove elements until patched. The vendor advisory confirms a fix is available.
Description
DOMPurify versions prior to 3.4.13 contain a vulnerability in the IN_PLACE sanitization mode where a hook that removes an element can leave detached descendant elements executable. This allows an attacker who can supply HTML to execute JavaScript via retained event handlers on detached subtrees after sanitization completes. The issue arises because the sanitization process skips neutralizing the subtree of a detached node when a hook removes it, leaving event handlers intact on disconnected elements.
References
- github.com/cure53/DOMPurify/security/advisories/GHSA-55q2-fjhq-7xh7 (opens in a new tab)
- github.com/cure53/DOMPurify/pull/1557 (opens in a new tab)
- github.com/cure53/DOMPurify/commit/3067f7746769 (opens in a new tab)
- github.com/cure53/DOMPurify (opens in a new tab)
- github.com/cure53/DOMPurify/releases/tag/3.4.13 (opens in a new tab)