Summary
pnpm's handling of workspace configDependencies can allow a repository to supply and execute a custom install engine binary before normal command dispatch.
When a project declares pacquet or @pnpm/pacquet as a configuration dependency, pnpm may resolve and spawn a repository-controlled platform-specific binary, enabling unintended command execution in developer or CI environments.
Affected context
This vulnerability occurs in pnpm-based JavaScript/Node.js workspaces that use pnpm-workspace.yaml and permit projects to define configDependencies.
In affected versions, a repository can declare pacquet or @pnpm/pacquet as configuration dependencies, causing pnpm to treat them as install-engine opt-ins and load binaries from node_modules/.pnpm-config.
The issue is most relevant in scenarios where developers run pnpm install on untrusted or partially trusted repositories, or CI pipelines automatically execute workspace installs based on repository content.
Exploit preconditions
- Attack surface: Developer machines and CI runners executing
pnpm installor related commands in an affected workspace. - Required access: Ability to modify or control the repository, including
pnpm-workspace.yamland dependencies under version control (e.g., via pull request, compromised repo, or malicious template). - Trigger point: Running pnpm commands that process
configDependencies, causing pnpm to resolve@pacquet/<platform>-<arch>/pacquetfromnode_modules/.pnpm-config/<packageName>and spawn it. - Why exploitation is possible: pnpm implicitly trusts repository-declared configDependencies as install-engine opt-ins and executes the resolved binary with the privileges of the invoking user or CI service, without sufficient separation between configuration and execution.
Why this happens
The root cause is the implicit execution of repository-controlled binaries during configuration processing, rather than limiting configuration to declarative, non-executable data.
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), because the tool permits untrusted configuration to influence which binaries are executed, effectively giving attackers a path to spawn arbitrary commands.
It also aligns with CWE-494: Download of Code Without Integrity Check, as the install engine binary resolved from node_modules/.pnpm-config may lack robust authenticity validation, and CWE-829: Inclusion of Functionality from Untrusted Control Sphere, since functionality loaded from the repository-controlled workspace is treated as trusted infrastructure code.
Potential impact
- Malicious code execution on developer workstations during
pnpm install. - Compromise of CI runners, allowing attackers to read secrets, tamper with build artifacts, or pivot to other services.
- Silent modification of dependency trees, lockfiles, or generated assets to inject backdoors or supply-chain malware.
- Execution of arbitrary OS-level commands under the context of the developer or automated build user.
General mitigation guidance
Mitigation generally focuses on restricting the execution of repository-controlled configuration code and treating workspace metadata as untrusted input by default.
Secure patterns include:
- Ensuring that configuration mechanisms (like
configDependencies) do not implicitly permit the execution of binaries sourced from the repository without explicit, trusted opt-in. - Separating install engines or helper binaries from project-controlled directories, and validating the origin and integrity of any executable used as part of the package manager workflow.
- Reducing trust in repositories fetched from external sources by running installs in hardened, least-privilege environments and avoiding direct execution of workspace-provided tooling.
- Applying policy controls that forbid or closely review configuration entries that can influence which binaries are spawned during package installation.
How teams detect issues like this
Detection efforts can focus on:
- Static inspection of
pnpm-workspace.yamlforconfigDependenciesthat reference install engines or binaries, especiallypacquetor@pnpm/pacquet. - Code review checks and repository policies that flag any configuration capable of injecting or altering the install engine path.
- Security scanning of CI configuration to ensure that pnpm runs in isolated, ephemeral environments and does not trust workspace-provided binaries without validation.
- Monitoring installation logs and process creation events on developer and CI systems to detect unexpected execution from
node_modules/.pnpm-configor other repository-controlled locations.

