CVE-2026-24056
JSON

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 packageVersionsReported by
pnpm pnpm< 10.28.2, before 10.28.2CVE List, NVD
pnpm (npm)before 10.28.2GitHub Advisory Database

All scores

GitHub_M6.7medium CVSS:4.0CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
GitHub6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
NVD6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N

Classification

CWE-22CWE-59

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

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

Sources

SourceRecordLicence
CVE ListCVE-2026-24056 changed 2026-01-27CVE Terms of Use
GitHub Advisory DatabaseGHSA-m733-5w8f-5ggw changed 2026-02-03CC-BY-4.0
NVDCVE-2026-24056 changed 2026-06-17Public domain