Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-xpqm-wm3m-f34h

Опубликовано: 26 янв. 2026
Источник: github
Github: Прошло ревью
CVSS3: 6.5

Описание

pnpm scoped bin name Path Traversal allows arbitrary file creation outside node_modules/.bin

Summary

A path traversal vulnerability in pnpm's bin linking allows malicious npm packages to create executable shims or symlinks outside of node_modules/.bin. Bin names starting with @ bypass validation, and after scope normalization, path traversal sequences like ../../ remain intact.

Details

The vulnerability exists in the bin name validation and normalization logic:

1. Validation Bypass (pkg-manager/package-bins/src/index.ts)

The filter allows any bin name starting with @ to pass through without validation:

.filter((commandName) => encodeURIComponent(commandName) === commandName || commandName === '' || commandName[0] === '@' // <-- Bypasses validation )

2. Incomplete Normalization (pkg-manager/package-bins/src/index.ts)

function normalizeBinName (name: string): string { return name[0] === '@' ? name.slice(name.indexOf('/') + 1) : name } // Input: @scope/../../evil // Output: ../../evil <-- Path traversal preserved!

3. Exploitation (pkg-manager/link-bins/src/index.ts:288)

The normalized name is used directly in path.join() without validation.

PoC

  1. Create a malicious package:
{ "name": "malicious-pkg", "version": "1.0.0", "bin": { "@scope/../../.npmrc": "./malicious.js" } }
  1. Install the package:
pnpm add /path/to/malicious-pkg
  1. Observe .npmrc created in project root (outside node_modules/.bin).

Impact

  • All pnpm users who install npm packages
  • CI/CD pipelines using pnpm
  • Can overwrite config files, scripts, or other sensitive files

Verified on pnpm main @ commit 5a0ed1d45.

Пакеты

Наименование

pnpm

npm
Затронутые версииВерсия исправления

< 10.28.1

10.28.1

EPSS

Процентиль: 8%
0.0003
Низкий

6.5 Medium

CVSS3

Дефекты

CWE-23

Связанные уязвимости

CVSS3: 6.5
nvd
8 дней назад

pnpm is a package manager. Prior to version 10.28.1, a path traversal vulnerability in pnpm's bin linking allows malicious npm packages to create executable shims or symlinks outside of `node_modules/.bin`. Bin names starting with `@` bypass validation, and after scope normalization, path traversal sequences like `../../` remain intact. This issue affects all pnpm users who install npm packages and CI/CD pipelines using pnpm. It can lead to overwriting config files, scripts, or other sensitive files. Version 10.28.1 contains a patch.

CVSS3: 6.5
debian
8 дней назад

pnpm is a package manager. Prior to version 10.28.1, a path traversal ...

CVSS3: 6.5
fstec
19 дней назад

Уязвимость менеджера пакетов pnpm, связанная с неверным ограничением имени пути к каталогу, позволяющая нарушителю записывать произвольные файлы

EPSS

Процентиль: 8%
0.0003
Низкий

6.5 Medium

CVSS3

Дефекты

CWE-23