CVE-2022-21144: Libxmljs Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-773h-w45w-f2f9
CVSS 7.5
CWE-20
Published
Advisory Summary

CVE-2022-21144 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-20: Improper Input Validation) affecting Libxmljs libraries in the npm ecosystem. The issue involves denial of service vulnerability exists in libxmljs. Remediation is available by upgrading affected packages to version 0.19.8.

CVE-2022-21144 at a Glance

CVE Identifier CVE-2022-21144
GHSA Identifier GHSA-773h-w45w-f2f9
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-20: Improper Input Validation
Affected Product Libxmljs
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2022-21144

To remediate this vulnerability, upgrade all affected Libxmljs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

libxmljs fixed: 0.19.8
npm install libxmljs@0.19.8
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls libxmljs

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2022-21144, inspect your project dependencies using npm:

npm ls libxmljs

Analyze the terminal output to locate any version of Libxmljs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.19.8), your application is affected.

Note: The npm ls libxmljs command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Libxmljs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

libxmljs provides libxml bindings for v8 javascript engine. This affects all versions of package libxmljs. When invoking the libxmljs.parseXml function with a non-buffer argument the V8 code will attempt invoking the .toString method of the argument. If the argument's toString value is not a Function object V8 will crash.

CVE-2022-21144 Affected Libxmljs Versions

1 component(s)
Fixed Versions:
0.19.8
Product / Package Ecosystem Affected Versions Fixed Version
libxmljs
npm
< 0.19.8
0.19.8

References

Frequently Asked Questions

What is CVE-2022-21144?
CVE-2022-21144 is a security vulnerability in Libxmljs involving Denial of service vulnerability exists in libxmljs under CWE-20: Improper Input Validation.
Which Libxmljs versions are affected?
Affected versions include releases prior to 0.19.8 across affected packages: libxmljs.
What version fixes CVE-2022-21144?
Upgrading to 0.19.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is libxmljs affected?
Yes, libxmljs is affected in releases prior to 0.19.8. Upgrade your dependency to 0.19.8 or later.
What is the CVSS score of CVE-2022-21144?
CVE-2022-21144 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-21144?
CVE-2022-21144 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2022-21144?
Run the dependency tree command: 'npm ls libxmljs'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-773h-w45w-f2f9",
  "modified" : "2022-05-26T19:44:59Z",
  "published" : "2022-05-03T00:00:46Z",
  "aliases" : [ "CVE-2022-21144" ],
  "summary" : "Denial of service vulnerability exists in libxmljs",
  "details" : "libxmljs provides libxml bindings for v8 javascript engine. This affects all versions of package libxmljs. When invoking the libxmljs.parseXml function with a non-buffer argument the V8 code will attempt invoking the .toString method of the argument. If the argument's toString value is not a Function object V8 will crash.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "libxmljs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.19.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-21144"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/libxmljs/libxmljs/pull/594"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/libxmljs/libxmljs/commit/2501807bde9b38cfaed06d1e140487516d91379d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/libxmljs/libxmljs"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-LIBXMLJS-2348756"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-05-04T14:48:04Z",
    "nvd_published_at" : "2022-05-01T16:15:00Z"
  }
}