// For flags

CVE-2021-39134

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

Severity Score

7.8
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

0
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

-
*SSVC
Descriptions

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

"@npmcli/arborist", la librería que calcula los trees de dependencia y maneja la jerarquía de carpetas "node_modules" para la interfaz de línea de comandos de npm, presenta como objetivo garantizar que los contratos de dependencia de los paquetes se cumplan, y que la extracción de los contenidos de los paquetes sea llevada a cabo siempre en la carpeta esperada. Esto es conseguido, en parte, al resolver los especificadores de dependencia definidos en los manifiestos "package.json" para las dependencias con un nombre específico, y anidando las carpetas para resolver las dependencias conflictivas. Cuando las dependencias múltiples difieren sólo en el caso de su nombre, la estructura de datos interna de Arborist las veía como elementos separados que podían coexistir dentro del mismo nivel en la jerarquía "node_modules". Sin embargo, en los sistemas de archivos que no distinguen entre mayúsculas y minúsculas (como macOS y Windows), esto no es así. Combinado con una dependencia de symlink como "file:/some/path", esto permitía a un atacante crear una situación en la que se podían escribir contenidos arbitrarios en cualquier ubicación del sistema de archivos. Por ejemplo, un paquete "pwn-a" podría definir una dependencia en su archivo "package.json" como ""foo": "file:/some/path"". Otro paquete, "pwn-b" podría definir una dependencia como "FOO: "file:foo.tgz"". En los sistemas de archivos que no distinguen entre mayúsculas y minúsculas, si se instalara "pwn-a" y luego se instalara "pwn-b", el contenido de "foo.tgz" se escribiría en "/some/path", y cualquier contenido existente de "/some/path" se eliminaría. Cualquiera usando npm versiones v7.20.6 o anteriores en un sistema de archivos que no distinga entre mayúsculas y minúsculas está potencialmente afectado. Esto está parcheado en @npmcli/arborist 2.8.2 que se incluye en npm versiones v7.20.7 y superiores

*Credits: N/A
CVSS Scores
Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None
Attack Vector
Local
Attack Complexity
Medium
Authentication
None
Confidentiality
Partial
Integrity
Partial
Availability
Partial
* Common Vulnerability Scoring System
SSVC
  • Decision:-
Exploitation
-
Automatable
-
Tech. Impact
-
* Organization's Worst-case Scenario
Timeline
  • 2021-08-16 CVE Reserved
  • 2021-08-31 CVE Published
  • 2024-05-16 EPSS Updated
  • 2024-08-04 CVE Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
  • ---------- First Exploit
CWE
  • CWE-61: UNIX Symbolic Link (Symlink) Following
  • CWE-178: Improper Handling of Case Sensitivity
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Npmjs
Search vendor "Npmjs"
Arborist
Search vendor "Npmjs" for product "Arborist"
< 2.8.2
Search vendor "Npmjs" for product "Arborist" and version " < 2.8.2"
node.js
Affected
in Npmjs
Search vendor "Npmjs"
Npm
Search vendor "Npmjs" for product "Npm"
< 7.20.7
Search vendor "Npmjs" for product "Npm" and version " < 7.20.7"
-
Safe
Oracle
Search vendor "Oracle"
Graalvm
Search vendor "Oracle" for product "Graalvm"
20.3.3
Search vendor "Oracle" for product "Graalvm" and version "20.3.3"
enterprise
Affected
Oracle
Search vendor "Oracle"
Graalvm
Search vendor "Oracle" for product "Graalvm"
21.2.0
Search vendor "Oracle" for product "Graalvm" and version "21.2.0"
enterprise
Affected
Siemens
Search vendor "Siemens"
Sinec Infrastructure Network Services
Search vendor "Siemens" for product "Sinec Infrastructure Network Services"
< 1.0.1.1
Search vendor "Siemens" for product "Sinec Infrastructure Network Services" and version " < 1.0.1.1"
-
Affected