6.7medium
pnpm has symlink traversal in file:/git dependencies
- Severity
- 6.7medium CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.53% (higher than 46% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-m733-5w8f-5ggw
Description
pnpm is a package manager. Prior to version 10.28.2, when pnpm installs a `file:` (directory) or `git:` dependency, it follows symlinks and reads their target contents without constraining them to the package root. A malicious package containing a symlink to an absolute path (e.g., `/etc/passwd`, `~/.ssh/id_rsa`) causes pnpm to copy that file's contents into `node_modules`, leaking local data. The vulnerability only affects `file:` and `git:` dependencies. Registry packages (npm) have symlinks stripped during publish and are NOT affected. The issue impacts developers installing local/file dependencies andCI/CD pipelines installing git dependencies. It can lead to credential theft via symlinks to `~/.aws/credentials`, `~/.npmrc`, `~/.ssh/id_rsa`. Version 10.28.2 contains a patch.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| pnpm pnpm | < 10.28.2, before 10.28.2 | CVE List, NVD |
| pnpm (npm) | before 10.28.2 | GitHub Advisory Database |
All scores
| GitHub_M | 6.7medium CVSS:4.0 | 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 |
| GitHub | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N |
| GitHub | medium CVSS:4.0 | 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 |
| NVD | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N |
Classification
What each source says
CVE List
pnpm is a package manager. Prior to version 10.28.2, when pnpm installs a `file:` (directory) or `git:` dependency, it follows symlinks and reads their target contents without constraining them to the package root. A malicious package containing a symlink to an absolute path (e.g., `/etc/passwd`, `~/.ssh/id_rsa`) causes pnpm to copy that file's contents into `node_modules`, leaking local data. The vulnerability only affects `file:` and `git:` dependencies. Registry packages (npm) have symlinks stripped during publish and are NOT affected. The issue impacts developers installing local/file dependencies andCI/CD pipelines installing git dependencies. It can lead to credential theft via symlinks to `~/.aws/credentials`, `~/.npmrc`, `~/.ssh/id_rsa`. Version 10.28.2 contains a patch.
GitHub Advisory Database
Summary
When pnpm installs a file: (directory) or git: dependency, it follows symlinks and reads their target contents without constraining them to the package root. A malicious package containing a symlink to an absolute path (e.g., /etc/passwd, ~/.ssh/id_rsa) causes pnpm to copy that file's contents into node_modules, leaking local data.
Preconditions: Only affects file: and git: dependencies. Registry packages (npm) have symlinks stripped during publish and are NOT affected.
Details
The vulnerability exists in store/cafs/src/addFilesFromDir.ts. The code uses fs.statSync() and readFileSync() which follow symlinks by default:
const absolutePath = path.join(dirname, relativePath)
const stat = fs.statSync(absolutePath) // Follows symlinks!
const buffer = fs.readFileSync(absolutePath) // Reads symlink TARGET
There is no check that absolutePath resolves to a location inside the package directory.
PoC
# Create malicious package
mkdir -p /tmp/evil && cd /tmp/evil
ln -s /etc/passwd leaked-passwd.txt
echo '{"name":"evil","version":"1.0.0","files":["*.txt"]}' > package.json
# Victim installs
mkdir /tmp/victim && cd /tmp/victim
pnpm init && pnpm add file:../evil
# Leaked!
cat node_modules/evil/leaked-passwd.txt
Impact
- Developers installing local/file dependencies
- CI/CD pipelines installing git dependencies
- Credential theft via symlinks to
~/.aws/credentials,~/.npmrc,~/.ssh/id_rsa
Suggested Fix
Use lstatSync to detect symlinks and reject those pointing outside the package root in store/cafs/src/addFilesFromDir.ts.
NVD (es)
pnpm es un gestor de paquetes. Antes de la versión 10.28.2, cuando pnpm instala una dependencia 'file:' (directorio) o 'git:', sigue los enlaces simbólicos y lee el contenido de sus destinos sin restringirlos a la raíz del paquete. Un paquete malicioso que contiene un enlace simbólico a una ruta absoluta (por ejemplo, '/etc /passwd', '~/.ssh/id_rsa') hace que pnpm copie el contenido de ese archivo en 'node_modules', filtrando datos locales. La vulnerabilidad solo afecta a las dependencias 'file:' y 'git:'. Los paquetes de registro (npm) tienen los enlaces simbólicos eliminados durante la publicación y NO se ven afectados. El problema afecta a los desarrolladores que instalan dependencias locales/de archivo y a las tuberías de CI/CD que instalan dependencias de git. Puede conducir al robo de credenciales a través de enlaces simbólicos a '~/.aws/credentials', '~/.npmrc', '~/.ssh/id_rsa'. La versión 10.28.2 contiene un parche.
References
| https://github.com/pnpm/pnpm/security/advisories/GHSA-m733-5w8f-5ggw | exploit, vendor-advisory, web | |
| https://github.com/pnpm/pnpm/commit/b277b45bc35ae77ca72d7634d144bbd58a48b70f | patch, web | |
| https://github.com/pnpm/pnpm/releases/tag/v10.28.2 | release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-24056 | advisory | |
| https://github.com/pnpm/pnpm | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-24056 changed 2026-01-27 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-m733-5w8f-5ggw changed 2026-02-03 | CC-BY-4.0 |
| NVD | CVE-2026-24056 changed 2026-06-17 | Public domain |