Skip to main content
VulnerabilityPublished

DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS

Affects dompurifySource GCVE Database

0

CVSS 5.1 Medium : upgrade to 3.4.13 when convenient.

Data as of 8 Aug 2026, 15:44 UTC

CVSS 4.0 base score
5.1Medium
How severe the flaw is on the 0–10 CVSS scale.
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:N

What to do

Upgrade dompurify to 3.4.13.

Affected software

ProductAffectedFixed in
npmdompurifyAffected
  • <3.4.13
Fixed in
  • 3.4.13

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

Community reviews

Loading reviews…