Quick answers
- Is CVE-2018-7408 exploited in the wild?
- No. Junglewise Threat Intelligence has no report of CVE-2018-7408 being exploited in the wild.
- How severe is CVE-2018-7408?
- Low severity, with a CVSS score of 3, published 13 May 2022.
- Which products and versions are affected?
- npm (npm) SEMVER:introduced=0,fixed=5.7.1.
- Is there a fix for CVE-2018-7408?
- Yes. npm (npm): upgrade to 5.7.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is CVE-2018-7408 attacked?
- It is attacked with local access, in a software library.
- Am I affected by CVE-2018-7408?
- Check whether you run npm (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
- npm (npm): upgrade to 5.7.1 or later
npm install npm@5.7.1
Technical details
This is a privilege escalation and arbitrary filesystem modification vulnerability (CWE-732: Incorrect Permission Assignment for Critical Resource) in npm 5.7.0's "correctMkdir" implementation. When npm runs with sudo (elevated privileges) but under a non-root user context, the flawed mkdir logic recursively changes ownership of directories up the filesystem tree, including critical system paths like /etc, /usr, and /boot. The vulnerability requires local access and sudo privilege delegation, but no additional user interaction. An unprivileged user with sudo access can trigger unintended chown operations on system directories, corrupting the filesystem and disabling binaries. The issue was introduced in a pre-release (5.7.0) and fixed in version 5.7.1.
Affected products
- npm, Inc. npm 5.7.0 (pre-release); fixed in 5.7.1
Identifiers
- CVE-2018-7408
- GHSA-ph34-pc88-72gc
Timeline
- 2018-02-22: disclosed: Issue reported on GitHub
- 2018-02-22: patched: Fix committed; version 5.7.1 released
- 2022-05-13: advisory: GHSA-ph34-pc88-72gc published