/

CVE-2026-41673

Severity:

HIGH RISK

(7.5)

Unbounded XML Recursion (CWE-674) in xmldom Parser

CVE-2026-41673

Deferred

Vulnerability type

Category:

Resource Exhaustion / Unbounded Recursion

CWE:

CWE-674, CWE-776

Impact:

Denial of Service via process crash

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

xmldom's JavaScript DOM implementation performs several recursive traversals without enforcing a maximum depth, allowing extremely deep XML structures to exhaust the call stack.

When an application parses or walks attacker-controlled XML, a maliciously nested DOM tree can trigger a RangeError and crash the process, turning XML input into a denial-of-service vector.

Affected context

This vulnerability manifests in Node.js or browser-based applications that rely on xmldom or @xmldom/xmldom to parse and manipulate XML documents.

It becomes relevant when XML content can be influenced by external input—such as API requests, uploaded files, or integration feeds—and the resulting DOM tree is traversed using the library's recursive helpers.

In such contexts, extremely deep or intentionally nested XML structures can drive the recursion into stack exhaustion, especially in environments where input size or structural complexity is not constrained.

Exploit preconditions

  • Attack surface: XML parsing and DOM manipulation endpoints (e.g., HTTP APIs, file upload handlers, message processors) that use xmldom.
  • Required access: Ability to supply or influence XML input consumed by the parser (remote or local, depending on the application design).
  • Trigger point: Construction and recursive traversal of a deeply nested DOM tree during parsing or subsequent processing.
  • Why exploitation is possible: Recursive functions in lib/dom.js operate without a depth limit or structural guard, allowing attacker-controlled nesting depth to exceed the call stack capacity and raise a RangeError.

Why this happens

The core issue aligns with CWE-674: Uncontrolled Recursion and is closely related to CWE-776: Improper Restriction of Recursive XML Expansion.

xmldom's DOM traversal routines rely on naive recursion that assumes reasonable tree depth and does not enforce explicit limits or iterative alternatives.

When parsing highly nested XML, each additional level of the tree consumes another frame on the call stack until the environment's recursion limit is breached, resulting in a runtime exception and process termination.

Abstractly, this pattern reflects a failure to treat nested or attacker-influenced data structures as potentially adversarial, leaving resource exhaustion unchecked.

Potential impact

  • Application may crash with a RangeError: Maximum call stack size exceeded.
  • Service availability could be degraded or fully disrupted, leading to denial of service.
  • Scheduled background jobs or XML-driven workflows can be halted or repeatedly restarted.
  • Error-handling and monitoring systems may be flooded with crash events and stack traces.

General mitigation guidance

Effective mitigation focuses on limiting recursion depth and constraining XML structure complexity before or during parsing.

Common defensive patterns include:

  • Enforcing maximum depth and node-count limits on XML inputs, rejecting documents that exceed safe thresholds.
  • Preferring iterative traversal strategies over unbounded recursion when walking DOM trees.
  • Introducing configurable guards in parsing and processing logic to detect and abort on excessively nested or complex structures.
  • Applying input validation and normalization steps that flatten or simplify XML before deep processing.
  • Running XML-handling components with robust fault isolation (e.g., worker processes) so that crashes do not take down the entire service.

How teams detect issues like this

Organizations can detect similar recursion-based exhaustion risks through:

  • Static analysis rules that flag recursive functions operating on untrusted or externally sourced data without explicit limits.
  • Code review checklists that require depth bounds or defensive parsing patterns for XML and other nested formats.
  • Runtime monitoring for repeated RangeError exceptions and process restarts in XML-heavy components.
  • Policy enforcement that mandates safe XML processing libraries or wrappers with resource controls for services exposed to untrusted input.

Sources

SourceLink
github.comgithub.com/xmldom/xmldom/commit/17678a2a73ecbd1a2da90f3d47dc23da9cef81aa
github.comgithub.com/xmldom/xmldom/commit/291257493cb0eb6980eda83b162a9c4e6d7d2597
github.comgithub.com/xmldom/xmldom/commit/2d6d6916ed8a4c223db1f6d7560ab4544c465b0f
github.comgithub.com/xmldom/xmldom/commit/430357c7b6333108856e917bf2367afe5ceb6f8a
github.comgithub.com/xmldom/xmldom/commit/4845ef109221df0890825de2822fbe77afba3afe
github.comgithub.com/xmldom/xmldom/commit/8834218c85ac2a4d757b9587c9028e67c2f7b6c3
github.comgithub.com/xmldom/xmldom/commit/8b7cfd1491314abdc347261921d7334ff15f7112
github.comgithub.com/xmldom/xmldom/commit/b0620383abc1df067f3ce1014c43ae1bc1161eeb
github.comgithub.com/xmldom/xmldom/commit/e6edcab6bef5bcdba0b220bb35442aa72f452b84
github.comgithub.com/xmldom/xmldom/releases/tag/0.8.13
github.comgithub.com/xmldom/xmldom/releases/tag/0.9.10
github.comgithub.com/xmldom/xmldom/security/advisories/GHSA-2v35-w6hq-6mfw
access.redhat.comaccess.redhat.com/errata/RHSA-2026:26234
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-41673
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2467630
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-41673.json

Frequently asked

questions

Yes, if a remote user can submit or control XML documents that your application parses with xmldom, they can craft deeply nested structures to induce a crash.

The attacker needs the ability to influence XML input—through an API request, file upload, message, or any other channel that feeds data into the xmldom parser or DOM traversal.

Combine structural limits with safer traversal: enforce maximum nesting and size on XML inputs, and replace or guard recursive DOM walkers with bounded or iterative approaches that fail fast on pathological trees.

Treat all complex, nested input formats as potentially adversarial: adopt secure parsing libraries that expose resource controls, add depth and size validation around XML handling, and include recursion and resource-exhaustion checks in design reviews and automated testing.

Find out what's already
exploitable in your codebase.