Sep 1, 2026·5 min read·12 visits
A path traversal vulnerability in pacquet allows unauthenticated remote code execution or file writes outside the workspace boundary via a crafted lockfile when using the --trust-lockfile parameter.
A directory traversal vulnerability exists in pacquet, the Rust port of pnpm. When executing an install with the --trust-lockfile flag enabled, a crafted pnpm-lock.yaml file bypasses resolution-policy verification. This allows an attacker to inject path traversal sequences into package names or versions, leading to symbolic links being written outside the workspace directory.
The package manager pacquet, which serves as the Rust-based port of pnpm, contains a directory traversal vulnerability. This flaw resides in the processing pipeline of the project lockfile (pnpm-lock.yaml) during dependency materialization.
Under normal execution, the package manager resolves, downloads, and structures dependencies inside a local virtual store, historically located at node_modules/.pnpm. If a user executes an installation with the --trust-lockfile configuration flag, the system skips standard resolution-policy checks.
An attacker who can influence the lockfile contents can inject path traversal sequences such as ../ into package dependency aliases, names, or version properties. Because of the missing validation, the tool performs unsafe path constructions, writing symbolic links outside the project boundary.
The vulnerability stems from three interrelated software weaknesses: improper pathname limitation (CWE-22) in the dependency name parser, unsafe join operations on the filesystem, and a security verification bypass triggered by CLI optimizations.
First, pacquet parses dependency names and version identifiers from the importers, packages, and snapshots blocks of pnpm-lock.yaml. Historically, the parsing functions failed to validate these strings against typical registry naming standards, which disallow directory traversal tokens. Consequently, malicious input like ../../escaped-link@1.0.0 was successfully serialized into internal memory representations.
Second, the virtual directory layouter and hoisting subsystems used raw pathname joins. Specifically, routines in create_symlink_layout.rs joined local store paths directly with the unvalidated dependency string using std::path::Path::join. This API does not prevent directory breakouts if the right-hand operand contains absolute paths or parent directory indicators.
Third, the flag --trust-lockfile skips lockfile validation. In vulnerable versions, structural safety checks on dependency names were incorrectly bound inside the policy verification process. Disabling policy verification disabled all name checks, removing the final layer of input sanitization.
Prior to the fix, the virtual store layout engine performed raw string conversions and path concatenation without verifying the bounds of the destination folder.
// Vulnerable pattern in create_symlink_layout.rs
let target_name_str = target.name.to_string();
let alias_name_str = alias_name.to_string();
symlink_package(
&layout.slot_dir(&target).join("node_modules").join(&target_name_str),
&virtual_node_modules_dir.join(&alias_name_str),
)If either target_name_str or alias_name_str is manipulated to contain path traversal components, the resulting directories resolve outside of the restricted virtual store.
The official fix in commit 51300fd41c5e4c8f47635108e373cc3d1f324fa7 implements a containment-checking helper function safe_join_modules_dir to secure filesystem sinks. It also extracts a separate validation pass verify_lockfile_dependency_names that runs unconditionally during frozen installations.
// Patched logic in install_frozen_lockfile.rs
pacquet_lockfile_verification::verify_lockfile_dependency_names(lockfile)
.map_err(InstallFrozenLockfileError::LockfileVerification)?;This validator systematically rejects any dependency alias or key containing parent directory traversals, registry delimiters, or reserved directory names such as node_modules or .bin before creating any files on disk.
To execute this attack, an adversary must commit a crafted pnpm-lock.yaml file to a repository and convince a victim developer or continuous integration (CI) workflow to execute an installation with --trust-lockfile.
The attacker crafts the lockfile by injecting a path traversal sequence into the packages and snapshots sections, mapping a targeted dependency alias to an out-of-bounds destination. The snippet below illustrates a malicious lockfile structure designed to target parent pathways:
lockfileVersion: '9.0'
importers:
.:
dependencies:
'@pnpm.e2e/hello-world-js-bin':
specifier: 1.0.0
version: 1.0.0
packages:
'@pnpm.e2e/hello-world-js-bin@1.0.0':
resolution: {integrity: sha512-AAAAAAAAAAAAAAAA...}
'../../escaped-link@1.0.0':
resolution: {integrity: sha512-AAAAAAAAAAAAAAAA...}
snapshots:
'@pnpm.e2e/hello-world-js-bin@1.0.0': {}
'../../escaped-link@1.0.0': {}When pacquet install --frozen-lockfile --trust-lockfile is executed, the layout builder processes the malicious package entry. Due to skipped policy checks, the engine executes the raw path join using the string ../../escaped-link@1.0.0. The operating system then creates a symlink in the parent workspace directory, permitting arbitrary directory writes or execution redirection.
The impact of this path traversal is significant, particularly in automated environments and shared developer workstations. Although exploiting this vulnerability requires the presence of a modified lockfile and specific CLI arguments, the potential consequences of successful exploitation are substantial.
First, because the vulnerability allows the creation of symbolic links outside the directory structure of the project, an attacker can manipulate files in sensitive directories relative to the workspace. This can be used to overwrite configurations or hijack command executors.
Second, in CI/CD pipelines, this flaw can bypass repository isolation. A malicious pull request can modify the lockfile, breakout of the build directory, and read or write files across the runner's shared filesystem, exposing secrets, API keys, or deployment tokens.
Lastly, combined with local dependency resolution mechanics, the symbolic links can point to executable binaries in other system paths. This provides an attacker with a vector to achieve remote code execution (RCE) on the developer host or CI agent.
To remediate this vulnerability, upgrade pnpm and the underlying pacquet binaries to a version that includes the structural lockfile verification patch in commit 51300fd41c5e4c8f47635108e373cc3d1f324fa7.
If patching is not immediately feasible, you can prevent exploitation by disabling the --trust-lockfile configuration flag across all build and local scripts. Enforcing strict lockfile verification ensures that standard resolution-policy checkers flag anomalous structure variations.
Additionally, integrate static lockfile linter rules into CI pipelines. Pre-commit hooks can scan pnpm-lock.yaml files for any relative path segments (../ or ..\) inside package keys and snapshot definitions to prevent malicious changes from being merged into the master branch.
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
pnpm (pacquet) pnpm | Prior to Commit 51300fd41c5e4c8f47635108e373cc3d1f324fa7 | Commit 51300fd41c5e4c8f47635108e373cc3d1f324fa7 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-22 |
| Attack Vector | Local/Network via Crafted Lockfile |
| CVSS v3.1 Score | 8.1 |
| Exploit Status | poc |
| Affected Flag | --trust-lockfile |
| Impact | Arbitrary Symlink Creation & File Write Outside Project Directory |
| Fix Commit | 51300fd41c5e4c8f47635108e373cc3d1f324fa7 |
The product 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 product 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.
CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).
CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.
An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.
CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.
CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.
The Natural Language Toolkit (NLTK) versions 3.6 through 3.10.3 contain an algorithmic complexity vulnerability in the LegalitySyllableTokenizer.tokenize method. When processing tokens composed of continuous runs of vowels, an unguarded string reversal and set membership lookup loop executes in quadratic time relative to the input token length. Remote attackers capable of submitting arbitrary text to applications utilizing this tokenizer can trigger sustained single-core CPU exhaustion and application-level denial of service.