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
- Create a malicious package:
{
"name": "malicious-pkg",
"version": "1.0.0",
"bin": {
"@scope/../../.npmrc": "./malicious.js"
}
}
- Install the package:
pnpm add /path/to/malicious-pkg
- Observe
.npmrccreated 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.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| npm package | pnpm | < 10.28.1 | 10.28.1 |
References
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N- Weakness (CWE)
CWE-23- Platform
- npm
- Package
pnpm- Disclosed
- 26.01.2026
- Updated
- 11.10.2026 10:22
Sources and licenses
OSV / GitHub Advisory Database - GHSA-xpqm-wm3m-f34h - CC BY 4.0
Vulnerability history: pnpm
All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 32
- First → latest
- 03.2022 09.2026
- Without a fix
- 0
- Exploited in attacks
- 0
Severity breakdown
- High 18
- Medium 14
Disclosures per year
- 2022: 1
- 2023: 1
- 2024: 1
- 2025: 1
- 2026: 28
-
pnpm scoped bin name Path Traversal allows arbitrary file creation outside node_modules/.bin this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.