/

CVE-2026-55700

Severity:

HIGH RISK

(7.1)

Path Traversal (CWE-22) in pnpm Stage Download Logic

CVE-2026-55700

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22, CWE-73

Impact:

Arbitrary File Overwrite

Severity:

HIGH RISK

(7.1)

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

A path traversal vulnerability in pnpm's stage download command allowed registry-controlled package metadata to influence local filenames.

Under certain conditions, a crafted package manifest could escape the intended download directory and overwrite other reachable files, posing a risk to systems that consume untrusted packages.

Affected context

This vulnerability arises when pnpm is used to download packages whose manifest fields (such as name and version) are not fully trusted or validated.

It specifically impacts workflows invoking pnpm stage download, where the local destination path is derived from registry-supplied metadata. The issue is more significant in environments that process third-party or community packages at scale, or where pnpm runs with elevated file system privileges and has access to sensitive directories.

Exploit preconditions

  • Attack surface: Package ingestion pipeline using pnpm stage download and reading manifests from a remote registry or other untrusted source.
  • Required access: Ability to publish or modify package manifests (including name and version) that pnpm will download, or control a registry that feeds pnpm.
  • Trigger point: Execution of pnpm stage download on a crafted package; the tool computes a filesystem path using unvalidated name/version fields and writes the downloaded contents.
  • Why exploitation is possible: The code trusted the package metadata when constructing local filenames, without enforcing strict normalization or validating the resolved path against the intended download directory, so traversal sequences could redirect writes to unintended locations.

Why this happens

The underlying bug is a classic path traversal issue mapped to CWE-22 and related to external control of file names or paths (CWE-73). The implementation derived a local filename directly from registry-controlled fields (package name and version) and then used that filename to form the destination path.

Without robust validation, sanitization, or enforcement that the final resolved path remained under the designated download directory, malicious metadata could include directory traversal tokens or crafted patterns. This allowed an attacker-controlled manifest to influence where files were written, breaking assumptions about the isolation of the download directory and enabling overwrite of other reachable files on the host.

Potential impact

  • An attacker-controlled package may overwrite arbitrary files reachable by the pnpm process within the same filesystem hierarchy.
  • Critical configuration or script files used by build or deployment tooling could be replaced, potentially altering subsequent execution flows.
  • Local cache or lock files may be corrupted, leading to subtle supply-chain manipulation or denial of service in CI/CD pipelines.
  • In environments where pnpm runs with elevated privileges, file overwrites may facilitate further compromise depending on what files can be targeted.

General mitigation guidance

Effective mitigation focuses on decoupling untrusted metadata from filesystem paths and enforcing strict path safety checks.

General patterns include:

  • Deriving local filenames from controlled, normalized identifiers rather than directly from registry-supplied fields.
  • Validating and sanitizing any path components influenced by external input, rejecting traversal sequences and illegal characters.
  • Verifying that the final resolved destination path is still inside the intended working or download directory before performing write operations.
  • Running package management and build tooling with least privilege, limiting the set of directories they can modify.
  • Incorporating defense-in-depth controls such as filesystem permissions and sandboxing to reduce the impact of any path-related flaw.

How teams detect issues like this

High-level detection approaches for similar vulnerabilities include:

  • Static analysis rules that flag uses of untrusted input in path construction, especially when combined with file write operations.
  • Code review practices that look for direct concatenation of user or registry-supplied strings into filenames or directory paths, and verify that canonicalization checks are in place.
  • Security policies that require normalization and boundary validation (e.g., ensuring paths remain under a specific root) for any file operation derived from external data.
  • Automated tooling—such as secure coding linters or SAST platforms—configured to detect CWE-22 and CWE-73 patterns in build and package management codebases.

Sources

SourceLink
github.comgithub.com/pnpm/pnpm/pull/12303
github.comgithub.com/pnpm/pnpm/security/advisories/GHSA-v23m-ccfg-pq9h

Frequently asked

questions

It can be exploited remotely as part of the package supply chain, provided an attacker can publish or modify a package manifest consumed by pnpm. The actual file overwrite occurs on the system where pnpm stage download runs.

The attacker needs control over the package metadata used by pnpm—typically the ability to upload or manipulate a package in a registry, or intercept and modify manifests in transit. They do not need shell access to the target system, but they rely on pnpm being invoked there.

Ensure that file paths are constructed from trusted, normalized sources and that any influence from external data is strictly sanitized. Always validate the canonicalized final path against a designated base directory before performing writes, and reject operations that attempt to leave that boundary.

Adopt secure coding standards around filesystem operations, including mandatory path normalization and boundary checks, and integrate static analysis to detect path traversal patterns. Combine this with least-privilege execution for build and package tools, and regular security reviews of code handling package metadata and other external inputs.

Find out what's already
exploitable in your codebase.