CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-72R4-9C5J-MJ57

GHSA-72R4-9C5J-MJ57: Arbitrary File Deletion via Path Traversal in pnpm patch-remove

Alon Barad
Alon Barad
Software Engineer

Jun 27, 2026·5 min read·36 visits

Executive Summary (TL;DR)

The pnpm package manager failed to validate file paths in its 'patch-remove' routine. A malicious actor could exploit this by embedding directory traversal sequences in the project's configuration, leading to arbitrary file deletion when a user or CI/CD runner executed the command.

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.

Vulnerability Overview

The pnpm package manager is an alternative to npm and yarn designed for performance and efficient disk utilization through hard links and a content-addressable store. To support custom dependency modification, pnpm offers a native patching framework. This subsystem exposes an attack surface when processing localized configuration assets such as package.json files or workspace lockfiles.

Historically, the 'patch-remove' command enabled developers to reverse local dependency patches and clean up corresponding patch files. However, the mechanism lacked security boundaries between the local project folder and the host filesystem. This design flaw introduced a path-traversal vulnerability that allows arbitrary file deletion.

Classified under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory), the underlying issue stems from a lack of boundary validation during path resolution. An attacker who can influence configuration inputs can force the tool to clean up assets outside the designated directory structure, compromising filesystem integrity and causing denial-of-service conditions on vulnerable workstations and build runners.

Root Cause Analysis

The vulnerability is located in the core execution logic of the 'pnpm patch-remove' command. This utility is responsible for cleaning up local overrides configured within the 'patchedDependencies' block of the configuration. When executed, the command parses the workspace metadata to locate the patch files to delete. Prior to remediation, the application trusted the path strings provided in the configuration map directly without sanitization.

A typical 'patchedDependencies' configuration maps a target package to its localized patch file. Because the resolution routine accepted arbitrary string values, it did not verify that the resolved path remained inside the boundaries of the workspace's designated 'patches' folder. An attacker could introduce relative traversal sequences or absolute paths to target sensitive resources.

The system then executed a highly privilege-insensitive deletion routine using Node's 'fs.rm' with recursive and force options enabled. This API call resolved the user-controlled path relative to the workspace directory and deleted the target asset. Because no validation occurred, the utility deleted any host-accessible file or directory, bypassing structural folder boundaries.

Code-Level Analysis

The original vulnerable implementation resolved the target path and immediately invoked destructive file operations. To mitigate this, a subdirectory containment validation utility named 'isSubdirectory' was introduced to verify parent-child directory structures.

export function isSubdirectory (parentDir: string, childPath: string, pathUtils: PathUtils = path): boolean {
  const relativePath = pathUtils.relative(parentDir, childPath)
 
  return relativePath === '' || (
    relativePath !== '..' &&
    !relativePath.startsWith(`..${pathUtils.sep}`) &&
    !pathUtils.isAbsolute(relativePath)
  )
}

The utility uses relative path calculations to guarantee that the child path resides within the parent directory. The 'patch-remove' routine was also updated to validate the target's physical location against symbolic link attacks. By utilizing 'fs.realpath' to canonicalize paths, the system ensures that symbolic links cannot be abused to point outside the workspace.

const targetPath = path.resolve(ctx.lockfileDir, patchFile)
if (
  targetPath === ctx.patchesDir ||
  !isSubdirectory(ctx.patchesDir, targetPath)
) {
  throw new PnpmError('PATCH_FILE_OUTSIDE_PATCHES_DIR', `Patch file "${patchFile}" is outside the configured patches directory`)
}

Additionally, the recursive file deletion API was replaced with 'fs.unlink'. This prevents directory erasure if a target resolves to a folder structure, limiting the tool to deleting individual files and symbolic links.

Exploitation Methodology

Exploitation requires the manipulation of the workspace configuration. This is typically achieved by submitting a malicious pull request to a public repository or distributing a compromised configuration inside an open-source archive. The attacker injects a path traversal sequence into the 'patchedDependencies' structure within 'package.json'.

{
  "pnpm": {
    "patchedDependencies": {
      "target-package": "../../../../etc/passwd"
    }
  }
}

When a developer or an automated CI/CD pipeline runs the 'pnpm patch-remove target-package' command, the execution flow proceeds as follows:

  1. The command parses 'package.json' and reads the entry for 'target-package'.
  2. The system resolves the path '../../../../etc/passwd' relative to the workspace directory.
  3. The cleanup routine executes the file deletion against the resolved target.
  4. The target file is deleted, resulting in system modification or configuration destruction.

In automation environments, this primitive can be used to destroy credentials, configurations, or critical software dependencies to disrupt operations.

Threat Model and Impact Assessment

The primary impact of this vulnerability is arbitrary file deletion on the system hosting the pnpm process. The severity depends on the privileges of the user executing the 'pnpm' command. On local development workstations, this can lead to the loss of source code, configuration files, and authentication keys.

In continuous integration and continuous deployment (CI/CD) environments, the impact is significant. Automated pipelines often run with elevated permissions. If an attacker can trigger the vulnerability inside a build runner, they can destroy pipeline configurations, build assets, or deployment credentials. This results in pipeline denial of service or configuration tampering.

Because the vulnerability does not directly expose read capabilities, it represents a threat to data integrity and availability rather than confidentiality. However, deleting critical security controls can weaken a system's overall security posture.

Remediation and Defense-in-Depth

To address the vulnerability, users must update pnpm to a version containing the path verification patch. The fix was integrated into the main branch and backported to the version 10 release line.

For environments where immediate patching is not possible, the following defense-in-depth measures are recommended:

  1. Review all pull requests that modify configuration files, including 'package.json' and 'pnpm-lock.yaml', before running command-line utilities.
  2. Execute build tasks within isolated containers that restrict filesystem access, limiting the scope of any potential file deletion.
  3. Run development and CI/CD tools with the minimum necessary filesystem permissions to prevent access to sensitive directories.

Official Patches

pnpmPrimary containment fix commit
pnpmBackport commit for release/10

Fix Analysis (2)

Technical Appendix

CVSS Score
7.1/ 10

Affected Systems

pnpm command-line interface@pnpm/plugin-commands-patching node module@pnpm/patching.commands node module

Affected Versions Detail

Product
Affected Versions
Fixed Version
pnpm
pnpm
< 10.0.0 (and versions without the containment patch)v10.x (patched releases)
@pnpm/plugin-commands-patching
pnpm
< 10.0.0-
AttributeDetail
CWE IDCWE-22 (Improper Limitation of a Pathname to a Restricted Directory)
Attack VectorLocal / Context-dependent execution of malicious workspace files
CVSS Severity7.1 (High Severity Recommendation)
Exploit StatusConcept-proven (PoC verified in test cases)
Impact TypeArbitrary File and Folder Deletion
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1485Data Destruction
Impact
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as '..' that can resolve to a location outside of the directory.

Vulnerability Timeline

Initial fix commit published to main development branch
2026-06-12
Containment fix backported to release/10 branch
2026-06-18

References & Sources

  • [1]GitHub Security Advisory GHSA-72R4-9C5J-MJ57

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-59980
6.3

CVE-2026-59980: Uncontrolled Resource Consumption in python-hyper/hpack

CVE-2026-59980 is a CPU exhaustion vulnerability in python-hyper/hpack, where an unauthenticated remote attacker can trigger an infinite loop or high computational complexity overhead by sending a crafted HTTP/2 stream containing excessive variable-length integer continuation octets.

Amit Schendel
Amit Schendel
2 views•8 min read
•about 2 hours ago•CVE-2026-61816
7.5

CVE-2026-61816: Uncontrolled Resource Consumption and Algorithmic Complexity in zbateson/mail-mime-parser

The PHP email processing library zbateson/mail-mime-parser is vulnerable to multiple algorithmic complexity exploits. By submitting small, highly structured email payloads, remote, unauthenticated attackers can trigger high CPU utilization or out-of-memory states, causing an application-wide denial of service.

Alon Barad
Alon Barad
5 views•6 min read
•about 3 hours ago•CVE-2026-61815
7.2

CVE-2026-61815: Remote SMTP Header Injection via Unsanitized MIME Decoded Filenames in zbateson/mail-mime-parser

CVE-2026-61815 is a high-severity Carriage Return / Line Feed (CRLF) header injection vulnerability in the zbateson/mail-mime-parser library. Due to incomplete sanitization logic, encoded newline sequences within filenames and headers survive parsing and translate into literal CRLF control bytes. When applications process or forward these payloads, the library writes the unescaped control bytes directly into outbound SMTP metadata, allowing remote attackers to inject rogue headers or compromise message integrity.

Alon Barad
Alon Barad
5 views•6 min read
•about 4 hours ago•CVE-2026-59723
8.8

CVE-2026-59723: Cross-Origin WebSocket Hijacking in Cline Hub Dashboard Server

A critical Cross-Origin WebSocket Hijacking (CSWSH) vulnerability exists in the Cline Hub dashboard server (@cline/cline-hub) prior to version 3.0.30. By exploiting a complete lack of Origin header validation and an insecure default configuration where ROOM_SECRET is unset, an attacker can hijack the local WebSocket connection via a malicious website. This enables unauthorized arbitrary command execution through desktopCommand frames, leading to remote code execution on the host machine.

Alon Barad
Alon Barad
5 views•6 min read
•about 5 hours ago•CVE-2026-57170
7.8

CVE-2026-57170: Server-Side Template Injection Bypass in Compliance-Trestle Include Tags

Compliance-trestle is vulnerable to Server-Side Template Injection (SSTI) leading to arbitrary code execution due to an incomplete fix for CVE-2026-46439. While the original remediation removed recursive template rendering in the core system, custom include extensions ('mdsection_include' and 'md_clean_include') continued to compile and parse files via a standard, non-sandboxed Jinja2 environment. This allows attackers who can inject template expressions into OSCAL documents or markdown files to execute arbitrary python code when the custom template processing is executed. The issue has been patched in versions 4.1.0 and 3.12.4.

Amit Schendel
Amit Schendel
4 views•6 min read
•about 6 hours ago•CVE-2026-57171
7.7

CVE-2026-57171: Path Traversal and Arbitrary File Write in compliance-trestle

CVE-2026-57171 describes an incomplete fix of CVE-2026-46345 inside compliance-trestle. Sibling subcommands (catalog-generate, profile-generate, ssp-generate, create, and replicate) bypass path validation routines. An attacker can manipulate output parameters to perform arbitrary file writes and directory deletions.

Alon Barad
Alon Barad
4 views•5 min read