Skip to content
Threat Brief

← All advisories

GHSA-mrv2-3pqr-j5jr

No CVE assigned yetLow 2.3No known exploitationFix available

DOMPurify IN_PLACE: hook that removes a parent or sibling leaves the detached subtree's event handlers armed (incomplete fix for GHSA-p98j-92pf-mc4p)

Record last updated

CVSS score

2.3

Low on a 0 to 10 scale

EPSS, chance of exploitation in 30 days

None

No EPSS score available

CISA remediation deadline

None

Not in the KEV catalog

Description

### Summary The 3.4.16 fix for GHSA-p98j-92pf-mc4p only covers a hook that removes the node it was called for. If an `IN_PLACE` hook removes a different node, like the current node's parent or a sibling that has not been visited yet, that subtree is never walked or neutralized. Event handlers in it stay on the elements, and an ` ` that was already loading fires after `sanitize()` returns. The README says: "Nodes that a hook detaches from the tree ... are treated as removed. In IN_PLACE mode their subtree is neutralized inline, so an ` ` that was already loading when you built the live tree cannot fire after `sanitize()` returns." That does not hold when the detached node is not the hook's own node. ### Tested versions - 3.4.16 (latest) and main at 18f8f0e - also 3.4.15, 3.4.12 and 2.5.8 jsdom for the matrix below, and Chromium (Playwright) for the event actually firing. ### Details `src/purify.ts` line 2134 (`dist/purify.cjs.js` line 2009 in 3.4.16), `_handleHookDetachedNode()`: ```js if (currentNode === root || getParentNode(currentNode) !== null) { return false; } if (IN_PLACE) { _neutralizeSubtree(currentNode); } ``` It only checks whether `currentNode` lost its parent. When a…

Weakness: CWE-79, CWE-693

Patching and mitigation

Patch status
Fix available (source: GitHub Advisory Database)
Fix documented (source date)
Mitigation
None documented
Vendor guidance
github.com (opens in a new tab)

Affected products

VendorProductAffected versionsFixed inPer
npmdompurifyall versions up to and including 3.4.163.4.17GitHub Advisory Database

Timeline

  1. Patch

    Fix documented by GitHub Advisory Database

    Source: GitHub Advisory Database (opens in a new tab)

Vendor guidance and references