xmldom Uncontrolled Recursion DoS Vulnerability
The xmldom library is vulnerable to a denial-of-service (DoS) attack due to uncontrolled recursion in XML serialization leading to application crashes.
The xmldom library is susceptible to a denial-of-service (DoS) vulnerability due to uncontrolled recursion in XML serialization. Seven recursive traversals within lib/dom.js lack depth limits, causing a RangeError: Maximum call stack size exceeded and crashing the application when processing deeply nested XML documents. Publicly disclosed on 2026-04-06, the vulnerability impacts multiple functions, including normalize(), XMLSerializer.serializeToString(), and others related to DOM manipulation. This issue arises from the library’s pure-JavaScript recursive implementation of DOM operations, which exhausts the call stack. Exploitation requires no authentication or special options, affecting applications that process attacker-controlled XML using vulnerable xmldom versions ( < 0.8.13, >= 0.9.0 and < 0.9.10, and <= 0.6.0).
Attack Chain
- An attacker crafts a malicious XML document with deeply nested elements.
- The vulnerable application receives and parses the crafted XML document using
DOMParser.parseFromString(). - The application subsequently calls one of the affected DOM operations, such as
normalize(),serializeToString(),getElementsByTagName(), orcloneNode(true). - The affected function initiates a recursive traversal of the deeply nested XML structure within
lib/dom.js. - Each level of nesting consumes a JavaScript call stack frame.
- The recursive calls continue until the JavaScript engine’s call stack is exhausted.
- A
RangeError: Maximum call stack size exceededexception is thrown. - The application crashes due to the uncaught exception, leading to a denial of service.
Impact
Successful exploitation results in a denial-of-service condition. Any service parsing attacker-controlled XML with a vulnerable version of xmldom can be crashed by a single crafted payload. This can lead to failed request processing. In deployments where uncaught exceptions terminate the worker or process, the impact can extend beyond a single request and disrupt service availability more broadly. Tests show that stack exhaustion occurs with nesting depths between 5,000 and 10,000 levels depending on the operation.
Recommendation
- Upgrade
@xmldom/xmldomto version >= 0.8.13 or >= 0.9.10 to remediate CVE-2026-41673. - If upgrading is not immediately feasible, consider implementing input validation to limit the nesting depth of XML documents processed by applications using
xmldom. - Monitor application logs for
RangeError: Maximum call stack size exceededexceptions originating fromlib/dom.js, which could indicate exploitation attempts.
Detection coverage 2
Detect Excessive XML Nesting Depth via Process Crash
highDetects process crashes due to stack exhaustion while processing XML, potentially indicating a DoS attack using xmldom.
Detect Deeply Nested XML Structures
lowDetects XML documents with an excessively deep nesting level, which could indicate a potential DoS attack.
Detection queries are kept inside the platform. Get full rules →