CVE-2018-7408: Npm Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-ph34-pc88-72gc
CVSS 7.8
CWE-732
Published
Advisory Summary

CVE-2018-7408 is a HIGH (CVSS 7.8) remote code execution vulnerability (CWE-732: Incorrect Permission Assignment for Critical Resource) affecting Npm libraries in the npm ecosystem. The issue involves incorrect permission assignment for critical resource in npm. Remediation is available by upgrading affected packages to version 5.7.1.

CVE-2018-7408 at a Glance

CVE Identifier CVE-2018-7408
GHSA Identifier GHSA-ph34-pc88-72gc
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-732: Incorrect Permission Assignment for Critical Resource
Affected Product Npm
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.8

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

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

How to Fix CVE-2018-7408

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

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

How to Check if You Are Affected

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

npm ls npm

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

Note: The npm ls npm 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-732: Incorrect Permission Assignment for Critical Resource, where the product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors. In Npm, 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

An issue was discovered in an npm 5.7.0 2018-02-21 pre-release (marked as "next: 5.7.0" and therefore automatically installed by an "npm upgrade -g npm" command, and also announced in the vendor's blog without mention of pre-release status). It might allow local users to bypass intended filesystem access restrictions because ownerships of /etc and /usr directories are being changed unexpectedly, related to a "correctMkdir" issue.

CVE-2018-7408 Affected Npm Versions

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

References

Frequently Asked Questions

What is CVE-2018-7408?
CVE-2018-7408 is a security vulnerability in Npm involving Incorrect Permission Assignment for Critical Resource in NPM under CWE-732: Incorrect Permission Assignment for Critical Resource.
Which Npm versions are affected?
Affected versions include releases prior to 5.7.1 across affected packages: npm.
What version fixes CVE-2018-7408?
Upgrading to 5.7.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is npm affected?
Yes, npm is affected in releases prior to 5.7.1. Upgrade your dependency to 5.7.1 or later.
What is the CVSS score of CVE-2018-7408?
CVE-2018-7408 has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2018-7408?
CVE-2018-7408 is classified under CWE-732: Incorrect Permission Assignment for Critical Resource (The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.).
How can I check npm dependencies for CVE-2018-7408?
Run the dependency tree command: 'npm ls npm'. 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-ph34-pc88-72gc",
  "modified" : "2022-06-28T23:53:12Z",
  "published" : "2022-05-13T01:53:21Z",
  "aliases" : [ "CVE-2018-7408" ],
  "summary" : "Incorrect Permission Assignment for Critical Resource in NPM",
  "details" : "An issue was discovered in an npm 5.7.0 2018-02-21 pre-release (marked as \"next: 5.7.0\" and therefore automatically installed by an \"npm upgrade -g npm\" command, and also announced in the vendor's blog without mention of pre-release status). It might allow local users to bypass intended filesystem access restrictions because ownerships of /etc and /usr directories are being changed unexpectedly, related to a \"correctMkdir\" issue.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "npm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.7.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-7408"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/npm/issues/19883"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/npm/commit/74e149da6efe6ed89477faa81fef08eee7999ad0"
  }, {
    "type" : "PACKAGE",
    "url" : "github.com/npm/cli"
  }, {
    "type" : "WEB",
    "url" : "http://blog.npmjs.org/post/171169301000/v571"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-732" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-28T23:53:12Z",
    "nvd_published_at" : "2018-02-22T18:29:00Z"
  }
}