/

CVE-2026-82393

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in pnpm Dependency Manager

CVE-2026-82393

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22, CWE-73, CWE-94

Impact:

Arbitrary File Overwrite and Potential Code Execution

Severity:

HIGH RISK

(7.5)

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 allows a crafted tarball dependency to provide a scoped package name containing path separators. During installation, the unvalidated name can direct extracted files outside the intended node_modules directory, potentially overwriting attacker-selected files and enabling code execution.

Affected context

The vulnerability occurs during pnpm installation of a tarball dependency when its package.json manifest contains a scoped name with traversal-related path components. The issue is relevant when the package is processed by affected dependency-resolution and extraction logic, including installations performed with --ignore-scripts, because the unsafe path handling occurs independently of lifecycle script execution.

Exploit preconditions

  • Attack surface: Dependency installation and package extraction
  • Required access: Ability to cause a victim project or build environment to install a crafted tarball dependency
  • Trigger point: Dependency graph resolution and extraction of the package during pnpm install
  • Why exploitation is possible: Scoped package names are insufficiently validated before reaching filesystem path joins, allowing extraction paths to escape the intended dependency directory

Why this happens

The underlying bug is inconsistent validation of package names. The resolver rejects slash characters for unscoped names but permits them in scoped names, allowing a package manifest to carry path traversal components into later path-construction logic.

This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, because attacker-controlled path data can escape the expected extraction root. It is also related to CWE-73: External Control of File Name or Path and may result in CWE-94: Improper Control of Generation of Code, when overwritten files are later executed.

Potential impact

  • Arbitrary files outside node_modules may be overwritten
  • Shell startup files or Git hooks could be modified
  • Installed package code or build inputs may be replaced
  • Continuous integration environments could be compromised
  • Subsequent commands may execute attacker-controlled code
  • Build integrity, source repositories, or developer workstations could be affected

General mitigation guidance

Mitigation generally focuses on treating package metadata as untrusted input and enforcing a single, canonical extraction boundary.

Common defensive patterns include:

  • Validate package names and derived paths consistently for both scoped and unscoped packages
  • Reject path separators, traversal components, absolute paths, and other non-canonical path forms
  • Resolve candidate paths and verify that they remain beneath the intended extraction directory
  • Use secure archive extraction routines that enforce destination containment
  • Apply least privilege to package-manager, build, and CI processes
  • Separate dependency installation from sensitive host paths and credentials
  • Use lockfiles, trusted registries, dependency review, and artifact integrity controls to reduce malicious-package exposure
  • Treat --ignore-scripts as insufficient protection against filesystem-based package extraction flaws

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis of package-name validation and filesystem path-join logic
  • Code review checks for user-controlled values passed to archive extraction or path construction
  • Tests covering scoped names, separators, traversal components, absolute paths, and platform-specific path syntax
  • Runtime monitoring for package-manager writes outside approved dependency directories
  • File-integrity monitoring for unexpected changes to Git hooks, shell profiles, build scripts, and installed package files
  • Dependency policies that require approved registries, provenance, and review of tarball contents
  • Automated security review tools that flag archive extraction and path-containment weaknesses

Sources

SourceLink
github.comgithub.com/pnpm/pnpm/commit/51300fd41c5e4c8f47635108e373cc3d1f324fa7
github.comgithub.com/pnpm/pnpm/commit/78e29fe5583a1e5d69ea05e414eff310f78d5ed9
github.comgithub.com/pnpm/pnpm/pull/12872
github.comgithub.com/pnpm/pnpm/pull/12890
github.comgithub.com/pnpm/pnpm/releases/tag/v10.34.5
github.comgithub.com/pnpm/pnpm/releases/tag/v11.11.0
github.comgithub.com/pnpm/pnpm/security/advisories/GHSA-vq4v-j7r6-jq4m

Frequently asked

questions

It can be triggered through a dependency installation workflow if a project or build system is induced to consume a malicious tarball. Direct network reachability to the package manager is not necessarily required.

An attacker generally needs to publish, distribute, or otherwise influence a tarball dependency that the victim installs. The attacker does not necessarily need local write access to the victim's filesystem.

Enforce strict package-name validation and canonical path containment before extraction. Every derived path should be verified to remain within the intended dependency directory.

No. The described flaw occurs during dependency resolution and extraction, so it may permit file overwrites even when package lifecycle scripts are disabled.

Combine secure archive extraction, dependency provenance controls, lockfile review, least-privileged build environments, and monitoring for writes outside approved installation paths.

Find out what's already
exploitable in your codebase.