CVE-2021-39135UNIX 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 accomplished by extracting package contents into a project's `node_modules` folder. If the `node_modules` folder of the root project or any of its dependencies is somehow replaced with a symbolic link, it could allow Arborist to write package dependencies to any arbitrary location on the file system. Note that symbolic links contained within package artifact contents are filtered out, so another means of creating a `node_modules` symbolic link would have to be employed. 1. A `preinstall` script could replace `node_modules` with a symlink. (This is prevented by using `--ignore-scripts`.) 2. An attacker could supply the target with a git repository, instructing them to run `npm install --ignore-scripts` in the root. This may be successful, because `npm install --ignore-scripts` is typically not capable of making changes outside of the project directory, so it may be deemed safe. This is patched in @npmcli/arborist 2.8.2 which is included in npm v7.20.7 and above. For more information including workarounds please see the referenced GHSA-gmw6-94gg-2rc2.
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-39135 | |
| Ubuntu 18.04 | npm | Fix pending | UBUNTU-CVE-2021-39135 | |
| Ubuntu 16.04 | npm | Fix pending | UBUNTU-CVE-2021-39135 | |
| Ubuntu 14.04 | npm | Fix pending | UBUNTU-CVE-2021-39135 | |
| Debian 14 | npm | Fixed | 7.24.0+ds-2 | DEBIAN-CVE-2021-39135 |
| Debian 13 | npm | Fixed | 7.24.0+ds-2 | DEBIAN-CVE-2021-39135 |
| Debian 12 | npm | Fixed | 7.24.0+ds-2 | DEBIAN-CVE-2021-39135 |
| 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-39135 |
| Alpine Linux 3.23 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.22 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.21 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.20 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.19 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.18 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.17 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.16 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.15 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.14 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.13 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.12 | nodejs | Fixed | 12.22.6-r0 | ALPINE-CVE-2021-39135 |
| Alpine Linux 3.11 | nodejs | Fixed | 12.22.6-r0 | ALPINE-CVE-2021-39135 |
| npm library | @npmcli/arborist | Fixed | 2.8.2 | GHSA-gmw6-94gg-2rc2 |
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://www.npmjs.com/package/%40npmcli/arborist
- https://github.com/npm/arborist/security/advisories/GHSA-gmw6-94gg-2rc2
- 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.