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

High 8.2 Published Updated

Attackers can write arbitrary files to any filesystem location via symlink confusion on case-insensitive systems, affecting npm users.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2021-39134?

CVE-2021-39134 is a high-severity path traversal vulnerability in Oracle Graalvm, published on 31 Aug 2021. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official 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, 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.

Weakness: CWE-178, CWE-61

Which versions are affected by CVE-2021-39134?

2 open source packages ship an affected version, including @npmcli/arborist. It affects 3 products.

PackageAffectedFixed in
@npmcli/arborist npmAll versions2.8.2
@npmcli/arborist npmAll versions2.8.2

Products include Npmjs Arborist, Oracle Graalvm, Siemens Sinec Infrastructure Network Services.

How do I fix CVE-2021-39134?

Upgrade @npmcli/arborist to 2.8.2 or later.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2021-39134 being exploited?

There is no known exploitation of CVE-2021-39134 in the wild and no public exploit code.

All Oracle Graalvm vulnerabilities

Sources

Also known as ALPINE-CVE-2021-39134, CLEANSTART-2026-IC69554, CLEANSTART-2026-OW30917, DEBIAN-CVE-2021-39134, GHSA-2h3h-q99f-3fhc, UBUNTU-CVE-2021-39134.

Is CVE-2021-39134 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free