VDB

CVE-2021-39134

CVE-2021-39134 PUBLISHED CVSS 8.2 HIGH

UNIX Symbolic Link (Symlink) Following in @npmcli/arborist

Reported by github_m · Published August 31, 2021

@npmcli/arborist is fixed in 2.8.2 (npm)

`@npmcli/arborist`, the library that calculates dependency trees and manages the `node_modules` folder hierarchy for the npm command line interface, aims to guarantee that package dependency contracts will be met, and the extraction of package contents will always be performed into the expected folder. This is, in part, accomplished by resolving dependency specifiers defined in `package.json` manifests for dependencies with a specific name, and nesting folders to resolve conflicting dependencies. When multiple dependencies differ only in the case of their name, Arborist's internal data structure saw them as separate items that could coexist within the same level in the `node_modules` hierarchy. However, on case-insensitive file systems (such as macOS and Windows), this is not the case. Combined with a symlink dependency such as `file:/some/path`, this allowed an attacker to create a situation in which arbitrary contents could be written to any location on the filesystem. For example, a package `pwn-a` could define a dependency in their `package.json` file such as `"foo": "file:/some/path"`. Another package, `pwn-b` could define a dependency such as `FOO: "file:foo.tgz"`. On case-insensitive file systems, if `pwn-a` was installed, and then `pwn-b` was installed afterwards, the contents of `foo.tgz` would be written to `/some/path`, and any existing contents of `/some/path` would be removed. Anyone using npm v7.20.6 or earlier on a case-insensitive filesystem is potentially affected. This is patched in @npmcli/arborist 2.8.2 which is included in npm v7.20.7 and above.

Fixed versions

Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.

PackageEcosystemFixed in
@npmcli/arboristnpm2.8.2
sinec_infrastructure_network_servicessiemens1.0.1.1
arboristnpmjs2.8.2

Risk scores

CVSS 3.1
8.2
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N

Affected products

VendorProductVersions
npmarborist< 2.8.2
npmcliarborist0
npmarborist0
alpinenodejs0, 0

Timeline

  • Aug 31, 2021 CVE Published
  • Sep 1, 2021 EPSS Score (30 in total, the first dated here)
  • Feb 8, 2024 PoC Published
  • May 9, 2024 CVE Updated
  • Mar 9, 2026 Security Advisory (17 in total, the first dated here)
  • Jul 24, 2026 Coalition ESS Score
  • Nov 22, 2026 Distribution Patch (11 in total, the first dated here)

Query this with the API

The same record, from the CLI:

vulnetix vdb vuln CVE-2021-39134
vulnetix vdb fixes CVE-2021-39134

Or with curl, using the org id and key from your account page:

curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
  "https://api.vdb.vulnetix.com/v2/vuln/CVE-2021-39134/fixes/registry"

The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart

References

Look up in the Resolve Platform →
$ Lookup Community · 50/day Open Lookup ›