# CVE-2026-65899: cure53 DOMPurify state contamination in Trusted Types policy

Source: https://junglewise.ai/threats/cve-2026-65899-cure53-dompurify-state-contamination-in-trusted-types-policy  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-23. Updated: 2026-07-23  
License: CC BY 4.0 with a link back

CVE-2026-65899 · Severity: medium · CVSS 6.1 · Published 2026-07-23

DOMPurify is a popular library used to clean and sanitize HTML to prevent security vulnerabilities like Cross-Site Scripting (XSS). A flaw in how the library manages its internal configuration allows security settings from one task to "leak" into subsequent tasks if the library instance is reused. This could allow an attacker to bypass security filters and execute malicious scripts in a user's browser, particularly in complex web applications that share a single sanitizer across different components.

Technologies: [dompurify (npm)](https://junglewise.ai/threats/technologies/dompurify). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2026-65899 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-65899 being exploited in the wild.

**How severe is CVE-2026-65899?** Medium severity, with a CVSS score of 6.1, published 23 July 2026.

**Which products and versions are affected?** dompurify (npm) SEMVER:introduced=0,fixed=3.4.9.

**Is there a fix for CVE-2026-65899?** Yes. dompurify (npm): upgrade to 3.4.9 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-65899 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-65899?** Check whether you run dompurify (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- dompurify (npm): upgrade to 3.4.9 or later

  ```sh
  npm install dompurify@3.4.9
  ```


## Technical details

A state contamination vulnerability exists in DOMPurify versions 3.0.0 through 3.4.8 due to the 'clearConfig()' method failing to reset the internal 'trustedTypesPolicy' and 'emptyHTML' variables. When a DOMPurify instance is reused across different trust boundaries, a previously set 'TRUSTED_TYPES_POLICY' remains active even after a configuration reset. If a subsequent caller requests 'RETURN_TRUSTED_TYPE' output, they receive a 'TrustedHTML' object generated by the stale, potentially unsafe policy instead of a clean default. This can lead to Cross-Site Scripting (XSS) at a Trusted Types sink. The issue is fixed in version 3.4.9 by ensuring the Trusted Types state is properly cleared during configuration resets.

## Affected products

- cure53 DOMPurify 3.0.0 to 3.4.8

## Identifiers

- CVE-2026-65899
- GHSA-vxr8-fq34-vvx9

## Timeline

- 2026-06-10: advisory: GitHub Security Advisory GHSA-vxr8-fq34-vvx9 published
- 2026-07-23: disclosed: CVE-2026-65899 published to NVD
- 2026-07-23: patched: Fix identified in version 3.4.9

## References

- [https://github.com/cure53/DOMPurify/commit/825e617753ac1169306a542d3174a77f717a0cf6](https://github.com/cure53/DOMPurify/commit/825e617753ac1169306a542d3174a77f717a0cf6)
- [https://github.com/cure53/DOMPurify/security/advisories/GHSA-vxr8-fq34-vvx9](https://github.com/cure53/DOMPurify/security/advisories/GHSA-vxr8-fq34-vvx9)
- [https://www.vulncheck.com/advisories/dompurify-before-trusted-types-policy-state-contamination](https://www.vulncheck.com/advisories/dompurify-before-trusted-types-policy-state-contamination)

## Related threats

- [DOMPurify SAFE_FOR_TEMPLATES bypass in shadow root content](https://junglewise.ai/threats/dompurify-safe-for-templates-bypass-split-template-expressions-survive-c23665cf)
- [DOMPurify IN_PLACE event handler bypass when hook removes parent or sibling](https://junglewise.ai/threats/dompurify-in-place-hook-that-removes-a-parent-or-sibling-leaves-the-3ea5d18f)
- [DOMPurify SMIL attributeName=href guard bypass in XHTML mode](https://junglewise.ai/threats/dompurify-smil-attributename-href-guard-is-skipped-when-parser-media-15a5efd2)
- [DOMPurify IN_PLACE mode XSS via rawtext element text content](https://junglewise.ai/threats/dompurify-in-place-returns-a-force-removed-rawtext-root-whose-text-16d9ac9e)
- [DOMPurify DOM XSS in IN_PLACE mode with afterSanitize hooks](https://junglewise.ai/threats/dompurify-in-place-node-removing-aftersanitize-hook-leaves-detached-3087e7fd)
