Command Injection in @cyclonedx/cyclonedx-npm via --workspace Argument
A command injection vulnerability in @cyclonedx/cyclonedx-npm on Windows allows attackers to execute arbitrary commands by supplying malicious input to the --workspace argument.
CVE search metadata
CVE search record: CVE-2026-71538. KEV: no. Product: @cyclonedx/cyclonedx-npm (< 6.0.0). Brief: Command Injection in @cyclonedx/cyclonedx-npm via --workspace Argument. Brief link: https://feed.craftedsignal.io/briefs/2026-09-cyclonedx-npm-injection/
The npm package @cyclonedx/cyclonedx-npm is vulnerable to command injection on Windows systems. The vulnerability resides in how the CLI tool handles the --workspace argument. In the tool's fallback execution path, user-supplied input provided to the --workspace flag is passed directly to the system shell without sufficient sanitization or neutralization of shell metacharacters.
An attacker who can control or influence the value passed to the --workspace flag can inject shell metacharacters such as &, |, or > to break out of the intended command context. This allows for the execution of arbitrary OS commands with the privileges of the user running the CLI tool. This vulnerability was addressed in version 6.0.0 by moving away from the vulnerable fallback path and ensuring input is handled safely.
Impact
Successful exploitation allows for arbitrary command execution on the host machine. This can result in data exfiltration, unauthorized modification of files, or elevation of local privileges depending on the user's current environment. The impact is limited to Windows systems where the vulnerable fallback path is reachable.
Recommendation
- Upgrade the
@cyclonedx/cyclonedx-npmpackage to version 6.0.0 or later to apply the fix for CVE-2026-71538. - Audit build pipelines and development workflows that invoke this tool to ensure that user-supplied input is not being passed to the
--workspaceargument. - On Windows, if upgrading is not immediately feasible, restrict the use of the tool to trusted inputs only and consider setting the
npm_execpathenvironment variable to point to a known safenpm-cli.jsto potentially bypass the vulnerable fallback path.
Immediate actions
Upgrade @cyclonedx/cyclonedx-npm to 6.0.0 or later
Mitigations
Set npm_execpath environment variable to a valid npm-cli.js path
CVE-2026-71538
Detection coverage 1
Detect Suspicious Command Line Arguments in cyclonedx-npm
highDetects potential command injection attempts via the --workspace argument in cyclonedx-npm by identifying shell metacharacters in the command line
Detection queries are available on the platform. Get full rules →