DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS
Published Aug 18, 2026 · Updated Oct 24, 2026 · Also known as GHSA-55q2-fjhq-7xh7
Original summary
Normalized public record · Updated Oct 24, 2026
DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS
Publisher and source text is retained separately from QFinch interpretation.
QFinch assessment
During INPLACE sanitization, a hook that removes an element can leave that element's detached descendants executable. A descendant image can retain its attacker-provided onload handler and fire after sanitize() returns, even though the returned root is clean and the image remains disconnected from the document.
Potential impact
In an application that uses INPLACE with the documented element-removal hook pattern, an attacker who can supply HTML can execute JavaScript in the integrating application's origin after the application sanitizes and renders that content. The required non-default configuration is INPLACE plus a hook that removes a containing element. The hook does not add or approve the event handler, and the dirty root never needs to be connected before sanitization.
Technical context
In DOMPurify 3.4.12, sanitizeElements() in src/purify.ts:1862-1904 runs the beforeSanitizeElements or uponSanitizeElement hook and returns immediately when the hook detached the current node. The return does not call neutralizeSubtree(currentNode). The detached subtree is not added to DOMPurify.removed, so the post-walk INPLACE neutralization cannot reach it. If the browser queued a resource event while the application constructed the detached dirty root, a descendant can therefore retain its handler and execute after sanitization. The hook only rejects the containing element and does not add or approve the event handler. DOMPurify's ordinary removal path de-arms the same queued event; only the hook-detachment early return skips the existing subtree neutralization.
Evidence: public source recordsAffected products
| Affected package, product or range | Fix status |
|---|---|
| Consult the referenced vendor advisory for affected versions. | Consult source advisory |
Matching a version is only one part of assessing exposure. QFinch has not assessed your environment on this public page.
Remediation
Apply the vendor-supported fixed release or mitigation, then verify the affected component is no longer reachable.
- Confirm the affected product and reachable code path exist in your environment.
- Apply the vendor-supported patch or mitigation from the primary advisory.
- Rescan the exact deployed revision and retain verification evidence.
Evidence coverage
- SSVC priority
- LOW
- Confidence
- Not available
- Aliases
- GHSA-55q2-fjhq-7xh7
Scores appear only when corresponding evidence exists. Missing data is never interpreted as zero risk.
Sources and record history
- Security advisory ↗
- VulnCheck Advisory: DOMPurify before 3.4.13 Cross-Site Scripting via IN_PLACE hook ↗
Record history
Published Aug 18, 2026 · Last refreshed Oct 24, 2026