Описание
pnpm has Windows-specific tarball Path Traversal
Summary
A path traversal vulnerability in pnpm's tarball extraction allows malicious packages to write files outside the package directory on Windows. The path normalization only checks for ./ but not .\. On Windows, backslashes are directory separators, enabling path traversal.
This vulnerability is Windows-only.
Details
1. Incomplete Path Normalization (store/cafs/src/parseTarball.ts:107-110)
A path like foo\..\..\.npmrc does NOT contain ./ and bypasses this check.
2. Platform-Dependent Behavior (fs/indexed-pkg-importer/src/importIndexedDir.ts:97-98)
- On Unix: Backslashes are literal filename characters (safe)
- On Windows: Backslashes are directory separators (exploitable)
PoC
- Create a malicious tarball with entry
package/foo\..\..\.npmrc - Host it or use as a tarball URL dependency
- On Windows:
pnpm install - Observe
.npmrcwritten outside package directory
Impact
- Windows pnpm users
- Windows CI/CD pipelines (GitHub Actions Windows runners, Azure DevOps)
- Can overwrite
.npmrc, build configs, or other files
Verified on pnpm main @ commit 5a0ed1d45.
Пакеты
pnpm
< 10.28.1
10.28.1
Связанные уязвимости
pnpm is a package manager. Prior to version 10.28.1, a path traversal vulnerability in pnpm's tarball extraction allows malicious packages to write files outside the package directory on Windows. The path normalization only checks for `./` but not `.\`. On Windows, backslashes are directory separators, enabling path traversal. This vulnerability is Windows-only. This issue impacts Windows pnpm users and Windows CI/CD pipelines (GitHub Actions Windows runners, Azure DevOps). It can lead to overwriting `.npmrc`, build configs, or other files. Version 10.28.1 contains a patch.
pnpm is a package manager. Prior to version 10.28.1, a path traversal ...
Уязвимость менеджера пакетов pnpm, связанная с неверным ограничением имени пути к каталогу с ограниченным доступом, позволяющая нарушителю записывать произвольные файлы