Jun 27, 2026·4 min read·5 visits
Unsanitized 'name' and 'version' fields in downloaded package manifests allow arbitrary filesystem writes during 'pnpm stage download' operations.
A path traversal vulnerability in pnpm stage download allows malicious registries or compromised package manifests to overwrite arbitrary files on the victim's filesystem via unvalidated package name and version fields.
The pnpm stage download command fetches and stages tarballs from a designated package registry during staging operations. This process involves downloading a package tarball, extracting its embedded package.json manifest, and determining a local staging path to write the artifact. The attack surface is exposed to any network registry or upstream repository configured by the user.\n\nAn attacker who controls a registry or compromises an upstream package can supply a malicious manifest. By embedding directory traversal sequences in metadata fields, the attacker can hijack the target write location. This allows arbitrary file write or overwrite operations under the privileges of the active user executing the command.
The root cause of this vulnerability lies in the unvalidated trust placed in the version and name properties of the package manifest. During staging, pnpm extracts these fields to construct a local cache or staging filename. The application relies on normalizePackageName() to replace slashes and remove symbols, but it performs no validation on the version string.\n\nBecause the version field is untrusted input, an attacker hosting a malicious registry or publishing a compromised manifest can define a version containing traversal sequences. When path.resolve() dynamically resolves the absolute path using this unsanitized string, the resulting destination path escapes the designated download directory. This allows writing the tarball payload to an arbitrary location on the filesystem.
The vulnerable logic resolves the output directory and file write path using the package name and version fields directly:\n\ntypescript\nconst downloadDir = opts.dir ?? process.cwd()\nconst outputPath = path.resolve(downloadDir, filename)\nawait fs.writeFile(outputPath, tarballData)\n\n\nmermaid\ngraph LR\n Registry[\"Malicious Registry\"] -->|\"package.json name/version\"| PNPM[\"pnpm stage download\"]\n PNPM -->|\"Unsanitized path.resolve\"| PathConcat[\"outputPath: /sandbox/../../etc/cron.d/job\"]\n PathConcat -->|\"fs.writeFile\"| OS[\"File Written Outside Sandbox\"]\n\n\nTo patch this vulnerability in commit 65443f4bdf1f0db9c8c7dc58fee25252607e9234, the maintainers introduced strict validation checks on the derived filename. The fix utilizes standard validation libraries to enforce format rules on both the package name and version before deriving the filename. Package names are validated using validate-npm-package-name, and semantic versions are validated using the semver validator, which blocks path traversal characters like / or .. from passing. Additionally, the path resolution step now enforces that the parent directory of the final absolute output path strictly matches the intended download directory.
An attacker exploiting this vulnerability must control the package registry or intercept the package response to inject a crafted manifest. When the victim executes pnpm stage download, the client issues a request to the configured registry.\n\nThe registry responds with a package payload containing a crafted package.json. In this manifest, the version field is set to a relative traversal path, such as 1.0.0/../../../../etc/cron.d/malicious_job.\n\nUpon receiving this response, pnpm builds the destination path using the malicious string and writes the tarball. The tarball's binary content is written directly to the target system path, enabling potential local privilege escalation (LPE) or persistent execution when the system triggers the written file.
The integrity impact is rated as High because an attacker can overwrite arbitrary files accessible to the execution context. Depending on whether pnpm is run by a standard user or an administrative CI/CD service, the impact ranges from local source code modification to full system compromise.\n\nThe availability impact is Low because overwriting critical system configuration or executable files can cause system services to fail. The vulnerability holds a CVSS v3.1 score of 7.1, reflecting that network-level positioning is sufficient to initiate the attack, provided user interaction (running the command) is achieved.\n\nCurrently, there is no active exploitation reported in the wild, placing the EPSS score at a low baseline. However, the presence of public regression tests acts as a functional Proof-of-Concept, making rapid exploitation feasible if target conditions are met.
Users must update pnpm immediately to version 11.5.3 or higher. This release contains the complete structural and semantic verification mechanisms to block directory traversal payloads in both the package name and version fields.\n\nIf immediate patching is not possible, restrict network communication to trusted registries and verify that package registries employ robust metadata sanitization before distributing packages to downstream clients.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L| Product | Affected Versions | Fixed Version |
|---|---|---|
pnpm pnpm | < 11.5.3 | 11.5.3 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-22 |
| Attack Vector | Network |
| CVSS | 7.1 |
| EPSS | 0.00258 |
| Impact | High Integrity, Low Availability |
| Exploit Status | poc |
| KEV Status | Not Listed |
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
GHSA-WW5P-J6CJ-6MQQ is a technical credential exposure vulnerability in Nezha Dashboard prior to version 2.2.5. The vulnerability allows authenticated administrative users or actors possessing scoped read-only Personal Access Tokens (PATs) to exfiltrate plaintext third-party API credentials, secret keys, and webhook authorization headers due to a lack of data redaction during API object serialization.
GHSA-FR4H-3CPH-29XV is a high-severity path traversal vulnerability in pnpm and its Rust-based port pacquet. The flaw manifests when using the hoisted node-linker configuration, allowing an attacker to manipulate the lockfile to resolve relative traversal sequences or target reserved subdirectories, leading to arbitrary file write or execution hijacking.
A path traversal vulnerability in the pnpm package manager's 'patch-remove' command allows an attacker to delete arbitrary files outside the patches directory. By manipulating configuration files like package.json, an attacker can specify a traversal path that the application deletes recursively without validating the path's containment.
A high-severity path traversal vulnerability exists in the pnpm package manager. By crafting a malicious lockfile (pnpm-lock.yaml) with path traversal characters in the configDependencies block, an attacker can create arbitrary directories and symlinks outside the project's node_modules/.pnpm-config directory. This exploitation happens automatically during pnpm installation, even when executing with scripts disabled via the --ignore-scripts flag.
An arbitrary file write vulnerability exists in Gonic, a music streaming server implementing the Subsonic API. Due to an unreachable guard clause combined with missing path containment validation in the playlist storage engine, authenticated users can write playlist contents to arbitrary filesystem paths with overly permissive directory permissions.
An incomplete mitigation of a predecessor vulnerability (GHSA-xvp4-phqj-cjr3 / CVE-2026-35671) in phpMyFAQ leaves sister administrative API endpoints vulnerable to Insecure Direct Object Reference (IDOR). Specifically, the `editUser` and `updateUserRights` endpoints lack object-level access controls, permitting authenticated low-privilege administrators to escalate their privileges or hijack SuperAdmin accounts.