CVE-2021-39134UNIX Symbolic Link (Symlink) Following in @npmcli/arborist
`@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.
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
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.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.04 | npm | Not affected vulnerable_code_not_present | ||
| Ubuntu 25.10 | npm | Not affected vulnerable_code_not_present | ||
| Ubuntu 24.04 | npm | Not affected vulnerable_code_not_present | ||
| Ubuntu 22.04 | npm | Not affected vulnerable_code_not_present | ||
| Ubuntu 20.04 | npm | Fix pending | UBUNTU-CVE-2021-39134 | |
| Ubuntu 18.04 | npm | Fix pending | UBUNTU-CVE-2021-39134 | |
| Ubuntu 16.04 | npm | Fix pending | UBUNTU-CVE-2021-39134 | |
| Ubuntu 14.04 | npm | Fix pending | UBUNTU-CVE-2021-39134 | |
| Debian 14 | npm | Fixed | 7.24.0+ds-2 | DEBIAN-CVE-2021-39134 |
| Debian 13 | npm | Fixed | 7.24.0+ds-2 | DEBIAN-CVE-2021-39134 |
| Debian 12 | npm | Fixed | 7.24.0+ds-2 | DEBIAN-CVE-2021-39134 |
| Red Hat Enterprise Linux 9 | nodejs | Not affected | ||
| Red Hat Enterprise Linux 9 | nodejs-docs | Not affected | ||
| Red Hat Enterprise Linux 9 | nodejs-full-i18n | Not affected | ||
| Red Hat Enterprise Linux 9 | nodejs-libs | Not affected | ||
| Red Hat Enterprise Linux 9 | npm | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs-devel | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs-docs | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs-full-i18n | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs-libs | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs-nodemon | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs-packaging | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs-packaging-bundler | Not affected | ||
| Red Hat Enterprise Linux 8 | npm | Not affected | ||
| Red Hat Enterprise Linux 8 | v8-12.4-devel | Not affected | ||
| Red Hat Enterprise Linux 8 | v8-13.6-devel | Not affected | ||
| Alpine Linux 3.24 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.23 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.22 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.21 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.20 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.19 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.18 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.17 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.16 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.15 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.14 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.13 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.12 | nodejs | Fixed | 12.22.6-r0 | ALPINE-CVE-2021-39134 |
| Alpine Linux 3.11 | nodejs | Fixed | 12.22.6-r0 | ALPINE-CVE-2021-39134 |
| npm library | @npmcli/arborist | Fixed | 2.8.2 | GHSA-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.
- npm arborist: affected: < 2.8.2
References
- https://github.com/npm/arborist/security/advisories/GHSA-2h3h-q99f-3fhc
- https://www.npmjs.com/package/%40npmcli/arborist
- https://www.oracle.com/security-alerts/cpuoct2021.html
- https://cert-portal.siemens.com/productcert/pdf/ssa-389290.pdf
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.