CVE-2022-21144: libxmljs denial of service in parseXml

CVE-2022-21144 · Severity: low · CVSS 3.1 · Published 2022-05-03

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.

Technologies: libxmljs (npm). Vendors: npm.

Quick answers

Is CVE-2022-21144 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2022-21144 being exploited in the wild.
How severe is CVE-2022-21144?
Low severity, with a CVSS score of 3.1, published 3 May 2022.
Which products and versions are affected?
libxmljs (npm) SEMVER:introduced=0,fixed=0.19.8.
Is there a fix for CVE-2022-21144?
Yes. libxmljs (npm): upgrade to 0.19.8 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2022-21144 attacked?
It is attacked over the network.
Am I affected by CVE-2022-21144?
Check whether you run libxmljs (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • libxmljs (npm): upgrade to 0.19.8 or later
    npm install libxmljs@0.19.8

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

Identifiers

  • CVE-2022-21144
  • GHSA-773h-w45w-f2f9

Timeline

  • 2022-05-03: disclosed
  • 2022-03-30: patched: Fix merged in PR #594

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.