CVE-2021-39134: npm Arborist symlink following on case-insensitive filesystems

CVE-2021-39134 · Severity: low · CVSS 3.1 · Published 2021-08-31

A vulnerability in the npm package manager's dependency management library could allow a malicious package to overwrite files on a user's computer. This occurs on systems with case-insensitive file systems, such as Windows and macOS, when a package uses specially crafted names and symbolic links. An attacker could use this to gain unauthorized access to data or execute malicious code when a user installs a compromised package.

Technologies: npm (npm). Vendors: npm.

Quick answers

Is CVE-2021-39134 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2021-39134 being exploited in the wild.
How severe is CVE-2021-39134?
Low severity, with a CVSS score of 3.1, published 31 August 2021.
Which products and versions are affected?
@npmcli/arborist (npm) SEMVER:introduced=0,fixed=2.8.2; Arborist (npm) < 2.8.2; npm (npm) < 2.8.2.
Is there a fix for CVE-2021-39134?
Yes. @npmcli/arborist (npm): upgrade to 2.8.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2021-39134 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2021-39134?
Check whether you run @npmcli/arborist (npm), Arborist (npm) or 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

  • @npmcli/arborist (npm): upgrade to 2.8.2 or later
    npm install @npmcli/arborist@2.8.2

Technical details

A vulnerability exists in @npmcli/arborist, the library used by npm to manage node_modules, due to improper handling of case sensitivity and symbolic links (CWE-178, CWE-61). On case-insensitive filesystems (macOS/Windows), Arborist's internal data structures treated dependencies with names differing only by case as distinct entities. An attacker can exploit this by creating a package with a symlink dependency (e.g., 'foo') pointing to a sensitive system path, followed by another dependency with a case-variant name (e.g., 'FOO'). During installation, the second package's contents are extracted through the symlink, resulting in arbitrary file overwrite or creation. This is fixed in @npmcli/arborist 2.8.2 and npm 7.20.7.

Affected products

  • npm @npmcli/arborist < 2.8.2
  • npm npm < 7.20.7

Identifiers

  • CVE-2021-39134
  • GHSA-2h3h-q99f-3fhc

Timeline

  • 2021-08-31: disclosed
  • 2021-08-31: advisory
  • 2021-08-31: patched

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.