CVEfocus › CVE database › CVE-2021-39134

CVE-2021-39134UNIX Symbolic Link (Symlink) Following in @npmcli/arborist

CVSS 8.2 HighEPSS 0.6% (higher than 42% of CVEs)Published 2021-08-31Updated 2024-08-04Assigner: GitHub_M

`@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.

CWE-61

What to do

Fixed builds are available from Alpine, Debian, npm: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

18Fixed
4Fix pending
20Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.04npmNot affected
vulnerable_code_not_present
Ubuntu 25.10npmNot affected
vulnerable_code_not_present
Ubuntu 24.04npmNot affected
vulnerable_code_not_present
Ubuntu 22.04npmNot affected
vulnerable_code_not_present
Ubuntu 20.04npmFix pendingUBUNTU-CVE-2021-39134
Ubuntu 18.04npmFix pendingUBUNTU-CVE-2021-39134
Ubuntu 16.04npmFix pendingUBUNTU-CVE-2021-39134
Ubuntu 14.04npmFix pendingUBUNTU-CVE-2021-39134
Debian 14npmFixed7.24.0+ds-2DEBIAN-CVE-2021-39134
Debian 13npmFixed7.24.0+ds-2DEBIAN-CVE-2021-39134
Debian 12npmFixed7.24.0+ds-2DEBIAN-CVE-2021-39134
Red Hat Enterprise Linux 9nodejsNot affected
Red Hat Enterprise Linux 9nodejs-docsNot affected
Red Hat Enterprise Linux 9nodejs-full-i18nNot affected
Red Hat Enterprise Linux 9nodejs-libsNot affected
Red Hat Enterprise Linux 9npmNot affected
Red Hat Enterprise Linux 8nodejsNot affected
Red Hat Enterprise Linux 8nodejs-develNot affected
Red Hat Enterprise Linux 8nodejs-docsNot affected
Red Hat Enterprise Linux 8nodejs-full-i18nNot affected
Red Hat Enterprise Linux 8nodejs-libsNot affected
Red Hat Enterprise Linux 8nodejs-nodemonNot affected
Red Hat Enterprise Linux 8nodejs-packagingNot affected
Red Hat Enterprise Linux 8nodejs-packaging-bundlerNot affected
Red Hat Enterprise Linux 8npmNot affected
Red Hat Enterprise Linux 8v8-12.4-develNot affected
Red Hat Enterprise Linux 8v8-13.6-develNot affected
Alpine Linux 3.24nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.23nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.22nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.21nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.20nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.19nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.18nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.17nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.16nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.15nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.14nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.13nodejsFixed14.17.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.12nodejsFixed12.22.6-r0ALPINE-CVE-2021-39134
Alpine Linux 3.11nodejsFixed12.22.6-r0ALPINE-CVE-2021-39134
npm library@npmcli/arboristFixed2.8.2GHSA-2h3h-q99f-3fhc

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.