Skip to content
OpenAdvisories
High · 8.2 CVE-2021-39135 EUVD-2021-1724GHSA-gmw6-94gg-2rc2

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

Published Aug 31, 2021 · Updated Aug 4, 2024 · Assigned by GitHub_M

Description

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

Affected products

VendorProductAffectedFixed
npm arborist < 2.8.2 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 npm 7.24.0+ds-2 —
Debian 13 npm 7.24.0+ds-2 —
Debian 12 npm 7.24.0+ds-2 —
ReleasePackageFixed inAdvisory
Ubuntu 20.04 LTS npm No fix yet —
Ubuntu 14.04 LTS npm No fix yet —
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 18.04 LTS npm No fix yet —
Ubuntu Pro 16.04 LTS npm No fix yet —
ReleasePackageFixed inAdvisory
SLES 15 SP3 nodejs12 12.22.7-4.22.1 SUSE-SU-2021:3940-1
SLES 15 SP3 nodejs14 14.18.1-15.21.2 SUSE-SU-2021:3964-1
SLES 15 SP2 nodejs12 12.22.7-4.22.1 SUSE-SU-2021:3940-1
SLES 15 SP2 nodejs14 14.18.1-15.21.2 SUSE-SU-2021:3964-1
SLES 12 nodejs12 12.22.9-1.38.1 SUSE-SU-2022:0101-1
SLES 12 nodejs14 14.18.1-6.18.2 SUSE-SU-2021:3886-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed nodejs14 14.18.1-1.1 openSUSE-SU-2024:11616-1
openSUSE Leap 15.3 nodejs12 12.22.7-4.22.1 openSUSE-SU-2021:3940-1
openSUSE Leap 15.3 nodejs14 14.18.1-15.21.2 openSUSE-SU-2021:3964-1
openSUSE Leap 15.2 nodejs12 12.22.7-lp152.3.21.1 openSUSE-SU-2021:1574-1
openSUSE Leap 15.2 nodejs14 14.18.1-lp152.17.1 openSUSE-SU-2021:1552-1
ReleasePackageFixed inAdvisory
Alpine v3.24 nodejs 14.17.6-r0 —
Alpine v3.23 nodejs 14.17.6-r0 —
Alpine v3.22 nodejs 14.17.6-r0 —
Alpine v3.21 nodejs 14.17.6-r0 —
Alpine v3.20 nodejs 14.17.6-r0 —
Show 9 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Alpine v3.19 nodejs 14.17.6-r0 —
Alpine v3.18 nodejs 14.17.6-r0 —
Alpine v3.17 nodejs 14.17.6-r0 —
Alpine v3.16 nodejs 14.17.6-r0 —
Alpine v3.15 nodejs 14.17.6-r0 —
Alpine v3.14 nodejs 14.17.6-r0 —
Alpine v3.13 nodejs 14.17.6-r0 —
Alpine v3.12 nodejs 12.22.6-r0 —
Alpine v3.11 nodejs 12.22.6-r0 —

Affected packages

EcosystemPackageAffectedFixedRecord
npm @npmcli/arborist < 2.8.2 2.8.2 GHSA-gmw6-94gg-2rc2

Advisories 13

References