GitHub Advisoryadvisory · npm

GHSA-87xg-pxx2-7hvx DOMPurify XSS via selectedcontent re-clone

HIGH Published 2026-06-01 Modified 2026-06-01 Official page ↗
Aliases
CVE-2026-47423
Ecosystem
npm
Packages
dompurify
Severity
High
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N
Weaknesses
CWE-79
Reviewed
2026-06-01

Affected packages

• npm dompurify: >= 3.4.4, < 3.4.5 → fixed in 3.4.5

Description

Summary DOMPurify 3.4.4 allows `selectedcontent` by default, allowing a chain in which browsers "re-clone" an XSS payload after sanitization, effectively bypassing DOMPurify. Details The chain is as follows: 1. The browser parses the input and creates a `` clone from the selected `` 2. DOMPurify walks and sanitizes that generated clone. 3. DOMPurify reaches the original `` and removes `selected=javascript:1` 4. The browser refreshes the `` clone from the original `option`'s content. 5. The refreshed clone is in a subtree DOMPurify already walked, which DOMPurify doesn't go back to sanitize 6. The returned string contains unsanitized markup inside ``. PoC ```js const dirty = '' + '' + 'x' + ''; const clean = DOMPurify.sanitize(dirty); console.log(clean); document.body.innerHTML = clean; ``` Observed "sanitized" output in Chromium 148/WebKit 625: ```html xx ``` After reinsertion, the browser updates the live DOM and strips the handler from the displayed clone, but the `onerror` has already fired: ```html xx ``` Reproduced in Chromium and WebKit, but not Safari (not yet latest WebKit) or Firefox. Will likely change with browser support for `selectedcontent`. Impact This is a default-configuration DOMPurify sanitizer bypass resulting in XSS. Applications are impacted if they sanitize attacker-controlled HTML with DOMPurify 3.4.4 using the string-input path and then insert the returned string into the page, for example with innerHTML.

Related

Alias · CVE (1)

  • CVE-2026-47423 DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. vulnerability

Weakness · CWE (1)

  • CWE-79 Improper Neutralization of Input During Web Page Generation weakness

References