CVEfocus › CVE database › CVE-2021-39135

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

CVSS 8.2 HighEPSS 0.6% (higher than 41% 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 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.

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-39135
Ubuntu 18.04npmFix pendingUBUNTU-CVE-2021-39135
Ubuntu 16.04npmFix pendingUBUNTU-CVE-2021-39135
Ubuntu 14.04npmFix pendingUBUNTU-CVE-2021-39135
Debian 14npmFixed7.24.0+ds-2DEBIAN-CVE-2021-39135
Debian 13npmFixed7.24.0+ds-2DEBIAN-CVE-2021-39135
Debian 12npmFixed7.24.0+ds-2DEBIAN-CVE-2021-39135
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-39135
Alpine Linux 3.23nodejsFixed14.17.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.22nodejsFixed14.17.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.21nodejsFixed14.17.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.20nodejsFixed14.17.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.19nodejsFixed14.17.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.18nodejsFixed14.17.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.17nodejsFixed14.17.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.16nodejsFixed14.17.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.15nodejsFixed14.17.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.14nodejsFixed14.17.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.13nodejsFixed14.17.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.12nodejsFixed12.22.6-r0ALPINE-CVE-2021-39135
Alpine Linux 3.11nodejsFixed12.22.6-r0ALPINE-CVE-2021-39135
npm library@npmcli/arboristFixed2.8.2GHSA-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.

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.