Executive brief
libxmljs is a JavaScript library that parses XML documents. When the parseXml function receives unexpected input types, it can crash the Node.js process, causing service downtime. An attacker can trigger this crash remotely by sending malformed requests to applications using the library.
Technical details
The vulnerability exists in the parseXml (and parseHtml) functions of libxmljs, which fail to validate that input is a string or Buffer before processing. When non-buffer arguments are passed, the V8 engine attempts to invoke the argument's toString method; if that method is not a Function object, the process crashes. This is an input validation flaw (CWE-20). The attack requires network access to an application using the vulnerable library, with no authentication or user interaction needed. An attacker can achieve denial of service by causing the application's Node.js process to terminate. The fix was merged in March 2022 and released in version 0.19.8, which enforces type validation on input.
Affected products
- libxmljs libxmljs before 0.19.8
Timeline
- 2022-05-03: disclosed
- 2022-03-30: patched: Fix merged in PR #594