{"id":"CVE-2022-39353","published":"2022-11-02T00:00:00Z","modified":"2025-04-22T17:16:38Z","title":"xmldom allows multiple root nodes in a DOM","vendor":"xmldom","product":"xmldom","tier":"tail","description":{"text":"xmldom is a pure JavaScript W3C standard-based (XML DOM Level 2 Core) `DOMParser` and `XMLSerializer` module. xmldom parses XML that is not well-formed because it contains multiple top level elements, and adds all root nodes to the `childNodes` collection of the `Document`, without reporting any error or throwing. This breaks the assumption that there is only a single root node in the tree, which led to issuance of CVE-2022-39299 as it is a potential issue for dependents. Update to @xmldom/xmldom@~0.7.7, @xmldom/xmldom@~0.8.4 (dist-tag latest) or @xmldom/xmldom@>=0.9.0-beta.4 (dist-tag next). As a workaround, please one of the following approaches depending on your use case: instead of searching for elements in the whole DOM, only search in the `documentElement`or reject a document with a document that has more then 1 `childNode`.","provenance":"source","from":"CVE.org"},"cvss":{"score":9.4,"severity":"CRITICAL","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.01696,"percentile":0.77553,"provenance":"source"},"cwes":[{"id":"CWE-20","name":"Improper Input Validation"},{"id":"CWE-1288","name":"Improper Validation of Consistency within Input"}],"references":[{"url":"https://github.com/xmldom/xmldom/security/advisories/GHSA-crh6-fp67-6883","tags":[]},{"url":"https://github.com/jindw/xmldom/issues/150","tags":[]},{"url":"https://lists.debian.org/debian-lts-announce/2023/01/msg00000.html","tags":["mailing-list"]}],"priority":{"score":22.1,"factors":[{"name":"EPSS percentile","points":15.51},{"name":"CVSS severity","points":6.58}]},"vendorSlug":"xmldom","affectedVersions":[{"vendor":"xmldom","product":"xmldom","versions":["<= 0.6.0","< 0.7.7",">= 0.8.0, < 0.8.4",">= 0.9.0-beta.1, < 0.9.0-beta.4"]}],"ssvc":{"exploitation":"poc","automatable":"yes","technicalImpact":"partial","timestamp":"2025-04-22T15:39:20.618073Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"xmldom","vulnerableRanges":["<=0.6.0"],"patched":[],"from":["GHSA-crh6-fp67-6883"],"provenance":"source"},{"ecosystem":"npm","package":"@xmldom/xmldom","vulnerableRanges":["<0.7.7",">=0.8.0, <0.8.4",">=0.9.0-beta.1, <0.9.0-beta.4"],"patched":["0.7.7","0.8.4","0.9.0-beta.4"],"from":["GHSA-crh6-fp67-6883"],"provenance":"source"}],"summary":{"text":"The flaw is in xmldom, a pure JavaScript XML DOM Level 2 implementation's DOMParser, where non-well-formed XML containing multiple top-level elements is parsed without error and all root nodes are added to the Document's childNodes collection.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T07:08:21Z"},"euvd":{"id":"EUVD-2022-7316","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-xmldom-cve-2021-21366","parents":[{"from":"CVE-2021-32796","to":"CVE-2022-39353","relation":"successor","confidence":"high","kind":"lineage","evidence":[{"kind":"version-step","provenance":"source","package":"npm:@xmldom/xmldom","fromFixed":"0.7.0","toFixed":"0.7.7","daysApart":463},{"kind":"same-code","provenance":"machine","files":["lib/dom.js"],"commits":["https://github.com/xmldom/xmldom/commit/7b4b743917a892d407356e055b296dcd6d107e8b","https://github.com/xmldom/xmldom/commit/52a708360c35aa160fcca8621720d71fd0f95f1a","https://github.com/xmldom/xmldom/commit/7ff7c10ab2961703ac1752e95b4ff60ee4ee6643"],"basis":"shared function","functions":["needNamespaceDefine","serializeToString"]}]},{"from":"CVE-2021-21366","to":"CVE-2022-39353","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["lib/dom.js"],"commits":["https://github.com/xmldom/xmldom/commit/d4201b9dfbf760049f457f9f08a3888d48835135","https://github.com/xmldom/xmldom/commit/52a708360c35aa160fcca8621720d71fd0f95f1a","https://github.com/xmldom/xmldom/commit/7ff7c10ab2961703ac1752e95b4ff60ee4ee6643"],"basis":"shared function","functions":["serializeToString"]}]}],"children":[{"from":"CVE-2022-39353","to":"CVE-2026-83608","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["lib/dom.js"],"commits":["https://github.com/xmldom/xmldom/commit/52a708360c35aa160fcca8621720d71fd0f95f1a","https://github.com/xmldom/xmldom/commit/7ff7c10ab2961703ac1752e95b4ff60ee4ee6643","https://github.com/xmldom/xmldom/commit/57aec90ac57b4408ae7c5d1746bf2a693b5ed90e","https://github.com/xmldom/xmldom/commit/85f12eb4d14b44de33216cfb72b50af4d24e9fdd"],"basis":"shared function","functions":["_extends","serializeToString"]}]},{"from":"CVE-2022-39353","to":"CVE-2026-83613","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["lib/dom.js"],"commits":["https://github.com/xmldom/xmldom/commit/52a708360c35aa160fcca8621720d71fd0f95f1a","https://github.com/xmldom/xmldom/commit/7ff7c10ab2961703ac1752e95b4ff60ee4ee6643","https://github.com/xmldom/xmldom/commit/2c548f200cfec991cd5846627ef8f03542309213","https://github.com/xmldom/xmldom/commit/cfb09b5dbeb035fdfedc9f01e2bbaf226bf47cf3"],"basis":"shared function","functions":["_extends","_removeNamedNode"]}]}],"packageHistory":[{"cve":"CVE-2021-32796","published":"2021-07-27","fixed":"0.7.0","kev":false},{"cve":"CVE-2026-83619","published":"2026-09-01","fixed":"0.8.15","kev":false},{"cve":"CVE-2022-39353","published":"2022-11-02","fixed":"0.9.0-beta.4","kev":false},{"cve":"CVE-2026-34601","published":"2026-04-02","fixed":"0.9.9","kev":false},{"cve":"CVE-2026-41672","published":"2026-05-07","fixed":"0.9.10","kev":false},{"cve":"CVE-2026-41673","published":"2026-05-07","fixed":"0.9.10","kev":false}],"package":"npm:@xmldom/xmldom"}}