/

CVE-2026-59195

Severity:

HIGH RISK

(8.2)

Path Traversal (CWE-22) via pnpm config symlink names

CVE-2026-59195

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Filesystem access and potential data manipulation via symlink-based path traversal

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

pnpm's handling of config dependency names in env lockfile sections can be abused to perform path traversal when creating symlinks under node_modules/.pnpm-config.

If a malicious repository provides a crafted pnpm-lock.yaml with traversal-shaped names, pnpm may create symlinks pointing outside the intended directory, potentially exposing or overwriting files.

Affected context

This vulnerability arises during pnpm install in projects that consume lockfiles from potentially untrusted or shared repositories.

It affects environments where the env-lockfile document in pnpm-lock.yaml can be modified by an attacker, and where pnpm resolves config dependency names directly into filesystem paths for symlink creation under node_modules/.pnpm-config.

The risk is more pronounced in CI pipelines, multi-user development setups, or when building third-party projects without reviewing their lockfiles.

Exploit preconditions

  • Attack surface: pnpm install execution that processes pnpm-lock.yaml with env-lockfile configuration.
  • Required access: Ability to commit or otherwise provide a crafted pnpm-lock.yaml to the target environment (e.g., via a malicious git repository or artifact).
  • Trigger point: Running pnpm commands that read the env lockfile configDependencies and create symlinks under node_modules/.pnpm-config.
  • Why exploitation is possible: pnpm uses config dependency names directly when constructing symlink paths, without enforcing strict normalization or rejection of traversal sequences, allowing paths to escape the intended directory.

Why this happens

The underlying bug is an improper validation of filesystem paths derived from user-controlled data, corresponding to CWE-22: Path Traversal.

pnpm treats config dependency names in the env lockfile as trusted identifiers and uses them directly to build symlink locations, failing to sanitize or constrain sequences such as ../ that can move outside the target directory.

This pattern reflects a broader class of issues where application-level path construction does not enforce a safe root, allowing attackers to influence where files or symlinks are created relative to the project filesystem.

Potential impact

  • Symlink creation that points outside node_modules/.pnpm-config into sensitive directories.
  • Potential overwriting or tampering with files that pnpm or other tools later consume.
  • Leakage of filesystem structure or data if symlinks expose unintended paths.
  • Interference with build or deployment pipelines by redirecting configuration loads.

General mitigation guidance

Mitigation centers on enforcing strict path handling and distrust of lockfile-sourced identifiers.

Secure patterns include:

  • Normalizing and validating all paths derived from configuration names before symlink creation, rejecting traversal segments and absolute paths.
  • Constraining symlink targets to a predefined base directory and enforcing checks to ensure constructed paths remain within that boundary.
  • Treating lockfiles as untrusted input when they originate from external repositories, applying validation layers or policies before installation.
  • Running build and install processes with least filesystem privileges so that even misdirected symlinks cannot affect high-value locations.

How teams detect issues like this

Detection typically involves examination of both code and runtime artifacts:

  • Static analysis rules that flag concatenation of configuration-derived strings into filesystem paths without normalization or boundary checks.
  • Code review checklists that specifically ask whether any path components come from lockfiles, environment configuration, or other user-controlled sources, and whether those are validated.
  • CI policies that scan pnpm-lock.yaml and similar artifacts for suspicious traversal patterns in configuration names before running installs.
  • File system monitoring in sensitive environments to detect unexpected symlink creation in or near build directories, optionally aided by automated security tooling.

Sources

SourceLink
github.comgithub.com/pnpm/pnpm/security/advisories/GHSA-qrv3-253h-g69c

Frequently asked

questions

Exploitability is tied to who controls the pnpm-lock.yaml. If you run pnpm install on code from untrusted or semi-trusted repositories, a malicious lockfile can be used to trigger the path traversal behavior.

An attacker needs the ability to influence the lockfile you consume, typically via a repository, package source, or shared project. Actual exploitation occurs when your environment runs pnpm install on that crafted project.

The safest pattern is to strictly validate and normalize any paths derived from configuration names, ensuring they remain within intended directories and rejecting traversal sequences or absolute paths before creating symlinks or files.

Adopt defensive path-handling practices: treat configuration and lockfile data as untrusted, enforce canonical path checks against a safe root, integrate static and policy-based checks for path construction, and run build tooling with minimized filesystem privileges.

Find out what's already
exploitable in your codebase.