CVE-2026-47423 Overview
CVE-2026-47423 is a cross-site scripting (XSS) sanitizer bypass in DOMPurify, a widely used DOM-only XSS sanitizer for HTML, MathML, and SVG. In version 3.4.4, DOMPurify allowed the <selectedcontent> element by default. Browsers re-clone content inside <selectedcontent> after DOMPurify performs sanitization, which reintroduces unsanitized markup into the returned output. Attackers can craft payloads that survive sanitization and execute in the browser context of the target user. The issue is resolved in DOMPurify 3.4.5. The weakness is classified as [CWE-79] Improper Neutralization of Input During Web Page Generation.
Critical Impact
Applications using DOMPurify 3.4.4 to sanitize untrusted HTML remain exposed to stored or reflected XSS, enabling session theft, account takeover, and arbitrary script execution in the victim's browser.
Affected Products
- DOMPurify 3.4.4 (with default configuration)
- Web applications embedding DOMPurify 3.4.4 for HTML sanitization
- Frameworks and libraries bundling DOMPurify 3.4.4 as a transitive dependency
Discovery Timeline
- 2026-07-14 - CVE-2026-47423 published to the National Vulnerability Database (NVD)
- 2026-07-16 - Last updated in NVD database
Technical Details for CVE-2026-47423
Vulnerability Analysis
DOMPurify sanitizes untrusted HTML by parsing it into a DOM tree, walking the tree, and removing elements or attributes that are not on an allowlist. In version 3.4.4, the <selectedcontent> element was included in the default allowlist. <selectedcontent> is a newer HTML element whose contents are cloned by the browser from an associated <option> at render time. Because the browser re-clones the DOM subtree after DOMPurify has already finished traversing it, sanitized-away nodes can be reintroduced into the rendered document. Any script-bearing markup positioned inside <selectedcontent> bypasses sanitization and executes in the origin of the hosting application.
Root Cause
The root cause is a mismatch between DOMPurify's static tree walk and the browser's runtime cloning behavior for <selectedcontent>. The sanitizer assumes the DOM it inspects is the DOM the browser will render. For <selectedcontent>, that assumption breaks because the element's subtree is recomputed by the user agent after DOMPurify returns. Version 3.4.5 addresses the flaw by removing <selectedcontent> from the default allowlist.
Attack Vector
Exploitation requires an attacker to deliver malicious HTML to a site that sanitizes user-supplied content with DOMPurify 3.4.4 and renders the result in the DOM. Typical entry points include comment fields, chat messages, rich-text notes, or profile fields. User interaction is required to load or view the rendered content. Successful exploitation runs attacker JavaScript with the privileges of the current user session and can pivot to credential theft, CSRF, or further site compromise.
// Security patch metadata change in dist/purify.cjs.d.ts
-/*! @license DOMPurify 3.4.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.4/LICENSE */
+/*! @license DOMPurify 3.4.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.5/LICENSE */
import { TrustedTypePolicy, TrustedTypesWindow, TrustedHTML } from 'trusted-types/lib/index.js';
Source: GitHub Commit 011b0c7
Detection Methods for CVE-2026-47423
Indicators of Compromise
- Presence of <selectedcontent> tags in stored user-supplied HTML fields or CDN-cached pages.
- Client-side error telemetry or Content Security Policy (CSP) violation reports referencing inline script execution from user-generated content regions.
- Unexpected outbound requests from browser sessions to attacker-controlled domains shortly after rendering sanitized content.
Detection Strategies
- Perform a software composition analysis (SCA) scan of application dependencies and flag any resolved version of DOMPurify equal to 3.4.4.
- Grep source repositories and built artifacts for the string DOMPurify 3.4.4 in bundled license headers to identify transitive inclusions.
- Add a server-side validation pass that rejects or strips <selectedcontent> from stored HTML until upgrades complete.
Monitoring Recommendations
- Enable and review CSP violation reports for script-src and inline-script violations on pages that render user content.
- Monitor web application firewall (WAF) logs for POST bodies containing <selectedcontent> markup targeting rich-text endpoints.
- Alert on anomalous session token usage patterns that could indicate XSS-driven session theft.
How to Mitigate CVE-2026-47423
Immediate Actions Required
- Upgrade DOMPurify to version 3.4.5 or later across all applications, including transitive dependencies pulled through frameworks and UI libraries.
- Invalidate any cached HTML output produced by DOMPurify 3.4.4 to prevent stored payloads from continuing to reach end users.
- Audit user-generated content stores for existing <selectedcontent> payloads and remove or re-sanitize them with the patched version.
Patch Information
The fix is available in DOMPurify 3.4.5, released by Cure53. Patch details are documented in GitHub Security Advisory GHSA-87xg-pxx2-7hvx and the GitHub Release 3.4.5 notes. The corrective commit is 011b0c7, which removes <selectedcontent> from the default allowlist.
Workarounds
- Explicitly forbid <selectedcontent> via the FORBID_TAGS option when instantiating DOMPurify if upgrading is not immediately possible.
- Deploy a strict Content Security Policy that disallows inline scripts and restricts script-src to trusted origins.
- Add a WAF rule to strip or block requests containing <selectedcontent> in HTML submission endpoints.
# Update DOMPurify via npm to the patched release
npm install dompurify@3.4.5
# Or with yarn
yarn add dompurify@3.4.5
# Verify installed version
npm ls dompurify
# Temporary mitigation in application code until upgrade is complete
# DOMPurify.sanitize(userInput, { FORBID_TAGS: ['selectedcontent'] });
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

