/

CVE-2026-47423

Severity:

HIGH RISK

(8.2)

DOMPurify XSS Flaw (CWE-79) via selectedcontent Tag

CVE-2026-47423

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Client-Side Code Execution / XSS

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A cross-site scripting issue in DOMPurify 3.4.4 arises from allowing the non-standard <selectedcontent> element by default, which lets browsers re-clone unsafe markup after sanitization.

Under certain conditions, an attacker-controlled payload wrapped in <selectedcontent> can bypass sanitization and execute arbitrary JavaScript in a victim's browser.

Affected context

The vulnerability affects applications that rely on DOMPurify 3.4.4 to sanitize untrusted HTML, MathML, or SVG content before rendering it in a browser.

It is relevant where user-controlled or externally sourced HTML is sanitized and then inserted into the DOM, and where the <selectedcontent> element is preserved by the sanitizer.

Environments that assume DOMPurify completely neutralizes script injection may unknowingly render attacker-controlled content containing <selectedcontent> wrappers.

Exploit preconditions

  • Attack surface: Web front-end that displays sanitized, user-supplied HTML/markup.
  • Required access: Ability to submit or influence HTML content processed by DOMPurify (e.g., comments, rich text fields, embedded third-party content).
  • Trigger point: Application passes attacker-controlled content through DOMPurify 3.4.4 and then injects the sanitized result into the DOM.
  • Why exploitation is possible: DOMPurify allows <selectedcontent> by default, and certain browsers can re-clone or reconstruct the inner, unsanitized payload, reintroducing dangerous markup that DOMPurify was expected to remove.

Why this happens

The root cause lies in incomplete output neutralization in the sanitizer, aligning with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting).

DOMPurify 3.4.4 incorrectly treated the non-standard <selectedcontent> element as safe, allowing it to pass through filtering logic.

When browsers subsequently process this element, they may reconstruct the inner HTML in a way that bypasses DOMPurify's sanitization guarantees, enabling reintroduction of script or event-handler attributes that should have been removed.

Potential impact

  • Execution of attacker-controlled JavaScript in the victim's browser.
  • Session hijacking or theft of authentication tokens stored in accessible contexts.
  • Unauthorized actions on behalf of the user via cross-site request forgery-like interactions.
  • Content spoofing or defacement within the affected web application.
  • Exfiltration of sensitive data accessible to the current web context.

General mitigation guidance

Effective mitigation focuses on hardening sanitization behavior and minimizing trust in browser-side reconstruction:

  • Configure sanitizers to block or strip unknown or non-standard elements such as <selectedcontent>, not just known-dangerous tags.
  • Apply a default-deny, allow-list approach to permitted tags and attributes, and regularly review that allow-list against emerging browser behaviors.
  • Combine sanitization with strong output encoding when rendering untrusted content into HTML, attributes, URLs, or JavaScript contexts.
  • Isolate rich HTML content in constrained contexts (e.g., sandboxed iframes with restrictive policies) to reduce the blast radius of sanitizer bypasses.
  • Enforce the principle of least privilege for scriptable contexts, limiting what the executing page can access (cookies, storage, powerful APIs).

How teams detect issues like this

Detection typically involves a mix of code review and behavioral testing:

  • Review front-end and back-end code for reliance on DOMPurify (or similar libraries) where untrusted HTML is accepted and rendered.
  • Check sanitizer configuration for allow-list entries that include non-standard or rarely used elements such as <selectedcontent>.
  • Use automated security testing and fuzzing tools to inject crafted HTML payloads, including unusual elements and attributes, and observe post-sanitization DOM behavior.
  • Apply static analysis or linters that flag direct insertion of sanitized HTML into innerHTML or similar sinks without additional contextual encoding or isolation.
  • Integrate security-focused test cases into CI pipelines to validate that dangerous payloads cannot survive sanitization and DOM insertion.

Sources

SourceLink
github.comgithub.com/cure53/DOMPurify/commit/011b0c78f2a0f57ee54f5fcccb697a46ca6e63ea
github.comgithub.com/cure53/DOMPurify/releases/tag/3.4.5
github.comgithub.com/cure53/DOMPurify/security/advisories/GHSA-87xg-pxx2-7hvx

Frequently asked

questions

Yes. If a web application accepts user-supplied HTML or markup that is sanitized with DOMPurify 3.4.4 and displayed to other users, an attacker can exploit this remotely via crafted content containing <selectedcontent>.

The attacker typically needs the ability to provide or influence HTML content processed by the vulnerable sanitizer, such as posting comments, editing rich-text fields, or supplying third-party HTML fragments.

The safest pattern is to use a strict allow-list-based sanitizer configuration that rejects non-standard elements, coupled with contextual output encoding and, where feasible, isolating rich content in sandboxed frames or similarly constrained environments.

Regularly review and test sanitizer configurations, follow a default-deny approach to HTML elements and attributes, keep abreast of browser quirks that affect DOM reconstruction, and integrate automated security tests that attempt XSS via unusual or emerging markup constructs.

Find out what's already
exploitable in your codebase.