Skip to main content

DOMPurify EUVDEUVD-2026-140252

| CVE-2026-140391 MEDIUM
Cross-site Scripting (XSS) (CWE-79)
5.1
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit crafted markup to app
  2. Delivery
    Markup stored and sanitized with SAFE_FOR_TEMPLATES
  3. Exploit
    Clean string assigned to innerHTML
  4. Execution
    Braces merge into live {{...}} on reparse
  5. Persist
    Template engine compiles and evaluates expression
  6. Impact
    Attacker JavaScript runs in victim origin

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Three conditions must all hold in the consuming application: (1) DOMPurify is invoked with SAFE_FOR_TEMPLATES: true (a non-default, protective option used for its documented purpose); (2) the sanitized string is written into the DOM through an HTML sink such as innerHTML; and (3) a template engine that compiles existing DOM - confirmed with Vue 3 in-DOM templates and AngularJS 1.8.3, and likely other mustache-style engines - then evaluates that DOM. The attacker only needs to supply markup passed to sanitize(). Limiting factors: exploitation does not work against DOMPurify's default configuration (SAFE_FOR_TEMPLATES is off by default), requires the specific sink-plus-template-engine pipeline, and requires a victim to view the page (UI:A); applications that do not use SAFE_FOR_TEMPLATES or do not compile sanitized DOM with a client-side template engine are not affected.

Impact

This is a genuine but conditional risk, best characterized as medium severity (CVSS 4.0 base 5.1) rather than a top-tier emergency. The 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:A) shows a network-reachable, low-complexity, unauthenticated flaw, but impact is confined to subsequent-system confidentiality and integrity (SC:L/SI:L) with no availability impact and no direct impact to the DOMPurify component itself (VC:N/VI:N/VA:N) - consistent with a stored/client-side XSS whose damage lands in the victim's browser session, not the sanitizer. The decision signals are moderate and internally consistent: SSVC records Exploitation=poc (not active), Automatable=no, and Technical Impact=partial, and the vuln.today priority is 'this_month' - i.e. patch on a normal cycle, not act_now. No CISA KEV listing and no EPSS score were supplied, so widespread or automated exploitation is not evidenced. The most important caveat is applicability, not signal conflict: exploitation is gated on a specific application configuration (SAFE_FOR_TEMPLATES: true feeding an innerHTML sink that a DOM-compiling template engine then evaluates), so a 'network/unauthenticated' CVSS reading overstates reach for the majority of DOMPurify deployments that do not use that combination. Where that combination exists, the PoC is deterministic across Chromium 156, Firefox 157 and WebKit 27.2, making it a real, prioritizable issue for affected apps.

Exploit ScenarioDerived

An attacker submits crafted HTML (a comment, profile field, or rich-text message) to an application that sanitizes it with DOMPurify's SAFE_FOR_TEMPLATES: true, then inserts the 'clean' string into the page via innerHTML where Vue 3 or AngularJS compiles the resulting DOM. The sanitized output contains no literal {{ or }}, but on reparse the split braces merge into a live {{...}} expression that the template engine evaluates, running attacker JavaScript in the origin for every user who views the content. A full working proof-of-concept (nested-form and orphaned-end-tag variants, verified against Vue 3.5.45 and AngularJS 1.8.3) is published in the GHSA advisory, so publicly available exploit code exists.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.5% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Dec 02, 2026

Template-expression smuggling in DOMPurify before 3.4.18 allows attacker-supplied markup to reassemble into a live {{...}} expression after sanitization, defeating the SAFE_FOR_TEMPLATES protection and yielding JavaScript execution in the victim's browser. Exploitation is conditional and unauthenticated at the sanitizer layer: the consuming application must enable SAFE_FOR_TEMPLATES: true (off by default), write the returned string into an HTML sink such as innerHTML, and then have a DOM-compiling template engine such as Vue 3 in-DOM templates or AngularJS 1.8.3 evaluate that DOM; a victim must then view the page (UI:A). SSVC records exploitation status as PoC and the upstream advisory publishes a working proof-of-concept verified on Chromium, Firefox and WebKit, but there is no CISA KEV entry, and the independent assessment rates this a conditional medium-severity risk (CVSS 4.0 base 5.1) rather than a top-tier emergency.

RemediationAI

Vendor-released patch: upgrade dompurify to 3.4.18 or later (npm: dompurify@3.4.18), which is the complete fix per the upstream advisory GHSA-qm7q-q8h9-jg8q. Where an upgrade cannot be shipped immediately, the practical compensating control is to break the third exploitation condition rather than to tune the sanitizer: do not hand SAFE_FOR_TEMPLATES-sanitized strings to a template engine for DOM compilation - render them as inert text, or build the output with createElement/textContent or a non-compiling binding so Vue/AngularJS never evaluates braces in the inserted markup - at the cost of losing in-DOM template interpolation inside untrusted content. Applications that do not actually need SAFE_FOR_TEMPLATES can leave it disabled (its default), which removes the bypass surface entirely but also removes the mustache hardening it was providing, so those must not later feed sanitized markup into a mustache engine. A defensive check in the consuming code is to reparse the sanitized string and reject or reserialize output where adjacent text fragments contain split braces, accepting the added parsing cost per sanitization. Note that the two scrub passes in the affected releases cannot be trusted as a boundary: output that contains no literal {{ or }} can still become an expression after the browser reparses it.

Affected VersionsENISA

DOMPurify 0 <3.4.18

Affected Packages

npm dompurify fix: 3.4.18

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

DOMPurify is a client-side (and jsdom-compatible server-side) HTML sanitizer built on the browser's own parser: it walks the parsed DOM, strips disallowed nodes and attributes, then serializes the tree back to a string. The SAFE_FOR_TEMPLATES option is a protective mustache-hardening feature that runs the regex set in src/regexp.ts (notably MUSTACHE_EXPR = /{{[\w\W]*|^[\w\W]*}}/g) in two places - once per text node during the walk and once over the final serialized string - on the assumption that "no braces in any text node" plus "no braces in the serialized output" equals "no expression after the consumer parses the string again". That assumption is wrong because serialization is not parse-inverse. In variant one, a nested <form> payload produces three separate text nodes ('{', '{...}', '}') that contain no '{{' or '}}' and survive both scrubs; on reparse the HTML parser ignores the inner <form> start tag because the form element pointer is already set, so the fragments merge into one text node holding a live expression. In variant two, the ^[\w\W]*}} branch of MUSTACHE_EXPR is applied to markup rather than text, slicing start tags off the serialized string while leaving orphaned </i> and </b> end tags; those are dropped on reparse and the braces merge again. The same regex-over-markup behaviour can also strip a closing </form> tag. The root cause class is CWE-79 (cross-site scripting) compounded by CWE-1336 (template injection): the sanitizer's guarantee is expressed against a parse tree that differs from the tree the consumer builds, so client-side template engines that compile already-parsed DOM (confirmed with Vue 3 in-DOM templates and AngularJS 1.8.3) evaluate attacker-authored expressions.

Know when Dompurify gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (VulnCheck) PRIMARY 5.1 MEDIUM
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
vuln.today AI 6.1 MEDIUM

Unauthenticated attacker-supplied markup (PR:N) that executes only when a victim views the page (UI:R); XSS escapes the sanitizer into the app context (S:C) with limited confidentiality and integrity impact and no availability impact.

3.1 AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Active
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
None
Subsequent system: Confidentiality
Low
Subsequent system: Integrity
Low
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch available
Dec 01, 2026 - 16:02 EUVD
CVE Published
Dec 01, 2026 - 14:29 cve.org
MEDIUM 5.1

DescriptionCVE.org

DOMPurify before 3.4.18 contains a SAFE_FOR_TEMPLATES bypass that allows attackers to smuggle template expressions past sanitization using nested form elements or orphaned end tags. When the sanitized output is reparsed via innerHTML, split braces merge into live {{...}} expressions that Vue or AngularJS evaluate, executing attacker JavaScript in victims' browsers.

Threat Intelligence Overview

EPSS Score
0.5%
Top 55% exploitable
Prevalence
High
one of the most widely used client-side HTML sanitizers, though vulnerable config is narrower
Threat Intel
1
1 sources
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.5%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

27
Low Medium High Critical
KEV: 0
EPSS: +1
CVSS: +26
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

CVE-2024-47875 MEDIUM POC
6.1 Oct 11

DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. Rated medium severity (CVSS 6

CVE-2020-26870 MEDIUM POC
6.1 Oct 07

Cure53 DOMPurify before 2.0.17 allows mutation XSS. Rated medium severity (CVSS 6.1), this vulnerability is remotely exp

CVE-2019-16728 MEDIUM POC
6.1 Sep 24

DOMPurify before 2.0.1 allows XSS because of innerHTML mutation XSS (mXSS) for an SVG element or a MATH element, as demo

CVE-2024-48910 CRITICAL
9.8 Oct 31

DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. Rated critical severity (CVSS

CVE-2026-65914 MEDIUM POC
5.3 Jul 23

Mutation-XSS in DOMPurify before 3.3.2 enables JavaScript execution in victim browsers when sanitized output is re-inser

CVE-2026-65902 MEDIUM POC
5.3 Jul 23

Hook mutation pollution in DOMPurify <= 3.4.5 allows persistent bypass of HTML sanitization defaults when application-in

CVE-2026-65899 MEDIUM POC
5.1 Jul 23

Trusted Types policy state contamination in DOMPurify 3.0.0-3.4.8 allows a previously supplied TRUSTED_TYPES_POLICY to s

CVE-2026-65913 MEDIUM POC
5.1 Jul 23

Prototype pollution in DOMPurify's USE_PROFILES mode enables DOM-based XSS by causing the sanitizer to accept event hand

CVE-2026-65912 MEDIUM POC
5.1 Jul 23

URI validation bypass in DOMPurify 3.3.1 and earlier allows `javascript:` protocol payloads to survive HTML sanitization

CVE-2026-65900 MEDIUM POC
5.1 Jul 23

SAFE_FOR_TEMPLATES bypass in DOMPurify 3.0.0-3.4.7 allows template expressions such as ${evil}, {{evil}}, and <%evil%> t

CVE-2026-65901 MEDIUM POC
5.1 Jul 23

Cross-site scripting in DOMPurify 3.4.6 and earlier enables script execution when the library's IN_PLACE sanitization mo

CVE-2026-65898 MEDIUM POC
5.1 Jul 23

Stored XSS is achievable in applications using DOMPurify's setConfig() API combined with an uponSanitizeAttribute hook t

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy