CVE-2018-7408: Npm Remote Code Execution Vulnerability
HIGHCVE-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
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).
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 install npm@5.7.1
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
CVE-2018-7408 Affected Npm Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
npm
|
npm |
< 5.7.1
|
5.7.1
|
References
Frequently Asked Questions
What is CVE-2018-7408?
Which Npm versions are affected?
What version fixes CVE-2018-7408?
Is npm affected?
What is the CVSS score of CVE-2018-7408?
What CWE is associated with CVE-2018-7408?
How can I check npm dependencies for CVE-2018-7408?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}