CVE-2021-23438: Mpath Type Confusion Vulnerability

MODERATE
Advisory Identifier: GHSA-p92x-r36w-9395
CVSS 5.6
CWE-843
Published
Advisory Summary

CVE-2021-23438 is a MODERATE (CVSS 5.6) type confusion vulnerability (CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')) affecting Mpath libraries in the npm ecosystem. The issue involves type confusion in mpath. Remediation is available by upgrading affected packages to version 0.8.4.

CVE-2021-23438 at a Glance

CVE Identifier CVE-2021-23438
GHSA Identifier GHSA-p92x-r36w-9395
Severity MODERATE
CVSS v3.1 Base Score 5.6
CWE Classification CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')
Affected Product Mpath
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.6

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

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

How to Fix CVE-2021-23438

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

mpath fixed: 0.8.4
npm install mpath@0.8.4
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 mpath

How to Check if You Are Affected

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

npm ls mpath

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

Note: The npm ls mpath 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-843: Access of Resource Using Incompatible Type ('Type Confusion'), where the product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type. In Mpath, 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

This affects the package mpath before 0.8.4. A type confusion vulnerability can lead to a bypass of CVE-2018-16490. In particular, the condition `ignoreProperties.indexOf(parts[i]) !== -1` returns `-1` if `parts[i]` is `['__proto__']`. This is because the method that has been called if the input is an array is `Array.prototype.indexOf()` and not `String.prototype.indexOf()`. They behave differently depending on the type of the input.

CVE-2021-23438 Affected Mpath Versions

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

References

Frequently Asked Questions

What is CVE-2021-23438?
CVE-2021-23438 is a security vulnerability in Mpath involving Type confusion in mpath under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion').
Which Mpath versions are affected?
Affected versions include releases prior to 0.8.4 across affected packages: mpath.
What version fixes CVE-2021-23438?
Upgrading to 0.8.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mpath affected?
Yes, mpath is affected in releases prior to 0.8.4. Upgrade your dependency to 0.8.4 or later.
What is the CVSS score of CVE-2021-23438?
CVE-2021-23438 has a CVSS v3.1 base score of 5.6 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2021-23438?
CVE-2021-23438 is classified under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion') (The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.).
How can I check npm dependencies for CVE-2021-23438?
Run the dependency tree command: 'npm ls mpath'. 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-p92x-r36w-9395",
  "modified" : "2023-09-07T18:41:16Z",
  "published" : "2021-09-02T22:02:25Z",
  "aliases" : [ "CVE-2021-23438" ],
  "summary" : "Type confusion in mpath",
  "details" : "This affects the package mpath before 0.8.4. A type confusion vulnerability can lead to a bypass of CVE-2018-16490. In particular, the condition `ignoreProperties.indexOf(parts[i]) !== -1` returns `-1` if `parts[i]` is `['__proto__']`. This is because the method that has been called if the input is an array is `Array.prototype.indexOf()` and not `String.prototype.indexOf()`. They behave differently depending on the type of the input.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mpath"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.8.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23438"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aheckmann/mpath/commit/89402d2880d4ea3518480a8c9847c541f2d824fc"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mongoosejs/mpath/commit/89402d2880d4ea3518480a8c9847c541f2d824fc"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/aheckmann/mpath"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1579548"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-MPATH-1577289"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-843" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-09-02T17:06:28Z",
    "nvd_published_at" : "2021-09-01T19:15:00Z"
  }
}