Description
DOMPurify through 3.3.3 fails to sanitize DOM elements passed via IN_PLACE mode when the element originates from a different window/realm (e.g., an iframe's contentDocument). A cross-realm instanceof check in the private _isNode() function returns false for foreign-realm nodes, causing DOMPurify to stringify the element (yielding '[object HTMLDivElement]'), silently reset IN_PLACE to false, and return the unsanitized element unchanged with any XSS payloads intact.
Published: 2026-07-23
Score: 2.3 Low
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

DOMPurify, a widely used client‑side sanitization library, contains a bug in versions up to and including 3.3.3 that fails to sanitize DOM elements when they are passed to the internal IN_PLACE mode from a different JavaScript realm, such as an iframe’s contentDocument. The private _isNode() function performs a cross‑realm instanceof check that returns false for foreign‑realm nodes, causing the element to be stringified as "[object HTMLDivElement]" and the IN_PLACE flag to be silently reset. Consequently, the function returns the unsanitized element unchanged, allowing any embedded XSS payload to remain active and execute in the host page. This flaw effectively disables DOMPurify’s core protection against client‑side script injection, opening the door for attackers to run arbitrary JavaScript in the victim’s context.

Affected Systems

DOMPurify provided by cure53, versions up to and including 3.3.3. Any deployment that uses IN_PLACE mode with DOM nodes originating from another window or iframe is susceptible.

Risk and Exploitability

The CVSS score of 2.3 indicates a low overall impact, and an EPSS score of less than 1% suggests a correspondingly low likelihood of exploitation in the wild. The flaw is not listed in the CISA KEV catalog. The likely attack vector involves an attacker controlling or injecting content into an iframe or foreign realm and then passing that DOM element to DOMPurify in IN_PLACE mode. Because the vulnerability requires direct manipulation of the DOM from a separate window, it may limit the ease of exploitation, but any environment that relies on DOMPurify for security is advised to address the issue promptly.

Generated by OpenCVE AI on August 3, 2026 at 21:31 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Check the official DOMPurify repository or website for the latest release that addresses the IN_PLACE cross‑realm sanitization issue, and upgrade your library to that version.
  • Avoid using IN_PLACE mode with DOM nodes that originate from a different window or iframe. If DOMPurify must process such nodes, clone or serialize them into the same execution realm before calling DOMPurify.
  • Validate that any content passed into DOMPurify originates from the same JavaScript realm as the library instance, and modify your code to enforce this restriction or remove legacy paths that bypass the sanitization logic.

Generated by OpenCVE AI on August 3, 2026 at 21:31 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Fri, 24 Jul 2026 22:00:00 +0000

Type Values Removed Values Added
Description DOMPurify through 3.3.3 fails to sanitize DOM elements passed via IN_PLACE mode when the element originates from a different window/realm (e.g., an iframe's contentDocument). A cross-realm instanceof check in the private _isNode() function returns false for foreign-realm nodes, causing DOMPurify to stringify the element (yielding '[object HTMLDivElement]'), silently reset IN_PLACE to false, and return the unsanitized element unchanged with any XSS payloads intact. The vendor considers this an edge case outside DOMPurify's threat model and, at time of publication, no fix was planned. DOMPurify through 3.3.3 fails to sanitize DOM elements passed via IN_PLACE mode when the element originates from a different window/realm (e.g., an iframe's contentDocument). A cross-realm instanceof check in the private _isNode() function returns false for foreign-realm nodes, causing DOMPurify to stringify the element (yielding '[object HTMLDivElement]'), silently reset IN_PLACE to false, and return the unsanitized element unchanged with any XSS payloads intact.
Title DOMPurify before 3.4.4 Cross-Site Scripting via IN_PLACE mode DOMPurify through 3.3.3 Cross-Site Scripting via IN_PLACE mode

Thu, 23 Jul 2026 21:45:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Thu, 23 Jul 2026 13:30:00 +0000

Type Values Removed Values Added
Description DOMPurify through 3.3.3 fails to sanitize DOM elements passed via IN_PLACE mode when the element originates from a different window/realm (e.g., an iframe's contentDocument). A cross-realm instanceof check in the private _isNode() function returns false for foreign-realm nodes, causing DOMPurify to stringify the element (yielding '[object HTMLDivElement]'), silently reset IN_PLACE to false, and return the unsanitized element unchanged with any XSS payloads intact. The vendor considers this an edge case outside DOMPurify's threat model and, at time of publication, no fix was planned.
Title DOMPurify before 3.4.4 Cross-Site Scripting via IN_PLACE mode
First Time appeared Cure53
Cure53 dompurify
Weaknesses CWE-754
CPEs cpe:2.3:a:cure53:dompurify:*:*:*:*:*:*:*:*
Vendors & Products Cure53
Cure53 dompurify
References
Metrics cvssV3_1

{'score': 4.7, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N'}

cvssV4_0

{'score': 2.3, 'vector': 'CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N'}


Subscriptions

Cure53 Dompurify
cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-07-24T21:35:25.747Z

Reserved: 2026-07-23T11:03:13.093Z

Link: CVE-2026-65904

cve-icon Vulnrichment

Updated: 2026-07-23T15:46:07.477Z

cve-icon NVD

Status : Analyzed

Published: 2026-07-23T14:18:06.063

Modified: 2026-07-28T15:51:19.363

Link: CVE-2026-65904

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-03T21:45:03Z

Weaknesses
  • CWE-754

    Improper Check for Unusual or Exceptional Conditions