CVE-2026-24131: pnpm has Path Traversal via arbitrary file permission modification

Published Jan 26, 2026
·
Updated

Summary When pnpm processes a package's directories.bin field, it uses path.join() without validating the result stays within the package root. A malicious npm package can specify "directories": {"bin": "../../../../tmp"} to escape the package directory, causing pnpm to chmod 755 files at arbitrary locations.

Note: Only affects Unix/Linux/macOS. Windows is not affected (fixBin gated by EXECUTABLESHEBANGSUPPORTED).

Details Vulnerable code in pkg-manager/package-bins/src/index.ts:15-21:

typescript if (manifest.directories?.bin) { const binDir = path.join(pkgPath, manifest.directories.bin) // NO VALIDATION const files = await findFiles(binDir) // ... files outside package returned, then chmod 755'd }

The bin field IS protected with isSubdir() at line 53, but directories.bin lacks this check.

PoC bash Create malicious package mkdir /tmp/malicious-pkg echo '{"name":"malicious","version":"1.0.0","directories":{"bin":"../../../../tmp/target"}}' > /tmp/malicious-pkg/package.json

Create sensitive file mkdir -p /tmp/target echo "secret" > /tmp/target/secret.sh chmod 600 /tmp/target/secret.sh # Private

Install pnpm add file:/tmp/malicious-pkg

Check permissions ls -la /tmp/target/secret.sh # Now 755 (world-readable)

Impact - Supply-chain attack via npm packages - File permissions changed from 600 to 755 (world-readable) - Affects non-dotfiles in predictable paths (dotfiles excluded by tinyglobby default)

Suggested Fix Add isSubdir validation for directories.bin paths in pkg-manager/package-bins/src/index.ts, matching the existing validation in commandsFromBin():

typescript if (manifest.directories?.bin) { const binDir = path.join(pkgPath, manifest.directories.bin) if (!isSubdir(pkgPath, binDir)) { return [] // Reject paths outside package } // ... }

Other sources

pnpm is a package manager. Prior to version 10.28.2, when pnpm processes a package's directories.bin field, it uses path.join() without validating the result stays within the package root. A malicious npm package can specify "directories": {"bin": "../../../../tmp"} to escape the package directory, causing pnpm to chmod 755 files at arbitrary locations. This issue only affects Unix/Linux/macOS. Windows is not affected (fixBin gated by EXECUTABLESHEBANGSUPPORTED). Version 10.28.2 contains a patch.

MITRE

Affected Software

2 affected componentsFixes available
npm/pnpm<10.28.2
10.28.2
PNPM Pnpm Node.js<10.28.2

Event History

Jan 26, 2026
Advisory Published
via GitHub·09:29 PM
Data Sourced
via GitHub·09:29 PM
DescriptionWeaknessAffected Software
CVE Published
via MITRE·10:03 PM
Data Sourced
via MITRE·10:03 PM
DescriptionWeakness
Data Sourced
via NVD·10:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Feb 27, 58104
Event
via FIRST·07:47 AM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-24131?

CVE-2026-24131 has been rated as a high-severity vulnerability due to its potential impact on file system security.

2

How do I fix CVE-2026-24131?

To mitigate CVE-2026-24131, upgrade pnpm to version 10.28.2 or later immediately.

3

What type of vulnerability is CVE-2026-24131?

CVE-2026-24131 is a path traversal vulnerability that allows unauthorized access to arbitrary file paths.

4

What applications are affected by CVE-2026-24131?

CVE-2026-24131 affects all versions of pnpm prior to 10.28.2.

5

How does CVE-2026-24131 affect pnpm users?

CVE-2026-24131 can potentially allow malicious packages to execute code outside of their intended directory, posing security risks.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203