Update dependency dompurify to v3.4.13 [SECURITY] - #801
Open
renovate[bot] wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
3.4.12→3.4.13DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS
GHSA-55q2-fjhq-7xh7
More information
Details
Summary
During
IN_PLACEsanitization, a hook that removes an element can leave that element's detached descendants executable. A descendant image can retain its attacker-providedonloadhandler and fire aftersanitize()returns, even though the returned root is clean and the image remains disconnected from the document.Details
In DOMPurify 3.4.12,
_sanitizeElements()insrc/purify.ts:1862-1904runs thebeforeSanitizeElementsoruponSanitizeElementhook 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-walkIN_PLACEneutralization 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.
PoC
Load the published
dompurify@3.4.12dist/purify.jsbefore this script in Chromium:sanitize()returns with no handler execution and the returned root contains only the safediv. After the event loop advances, the original image remains disconnected but its retainedonloadchanges the page toXSS after sanitize.As the claim-matched control, use the same detached input with
ALLOWED_TAGS: ['div', '#text']and no hook. DOMPurify's ordinary removal path removes the original image's handler, the returned root is still<div>safe</div>, and the marker does not fire.Impact
In an application that uses
IN_PLACEwith 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
IN_PLACEplus 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.Suggested fix
Reuse the existing
_neutralizeSubtree(currentNode)helper before returning from both hook-detachment branches in_sanitizeElements(). Add regressions forbeforeSanitizeElementsanduponSanitizeElementthat retain a reference to a descendant resource element and verify that its event handler is removed after the hook detaches its ancestor.Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
cure53/DOMPurify (dompurify)
v3.4.13: DOMPurify 3.4.13Compare Source
IN_PLACEsanitization, thanks @koyokrownerDocumentduringIN_PLACE, thanks @AkshayjainGConfiguration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.