Packages / @cyclonedx/cyclonedx-npm / Security

HighVulnerabilityGHSA-q69g-4hcv-6jg4CVE-2026-71538Published 17 Sep 2026

@cyclonedx/cyclonedx-npm: Shell Injection via Unsanitized --workspace Argument on Windows

Your version

Affected releases · @cyclonedx/cyclonedx-npm

  • 5.x5.0.0No fix on this line yet
  • 4.x4.0.0 – 4.2.1No fix on this line yet
  • 3.x and older1.0.0 – 3.1.0No fix, no longer updated

5.x has no fix yet; the newest fixed line:

npm install @cyclonedx/cyclonedx-npm@6.0.0
Every release on a timeline
7.x
  1. Not affected

    7.0.0 – 7.0.1

    2 releases, latest

5.x
  1. Affected

    5.0.0

    1 release

4.x
  1. Affected

    4.0.0 – 4.2.1

    9 releases

3.x
  1. Affected

    3.0.0 – 3.1.0

    2 releases

2.x
  1. Affected

    2.0.0 – 2.1.0

    2 releases

1.x
  1. Affected

    1.0.0 – 1.20.0

    41 releases

59 stable releases of @cyclonedx/cyclonedx-npm, oldest to newest, one row per major.

What happens

Summary

A Windows-specific command injection vulnerability exists in @cyclonedx/cyclonedx-npm when the CLI is invoked with the --workspace <value> option.
User-supplied --workspace values can be passed to a shell command without proper neutralization on the Windows fallback execution path, enabling attackers to inject arbitrary OS commands.

The vulnerability was fixed in version [6.0.0][v6.0.0].

Vulnerability Details

When cyclonedx-npm is executed with the --workspace option, the provided argument is incorporated into an internal command execution flow.
On Windows systems, this path can interpret untrusted --workspace input as shell syntax if not safely handled.

As a result, specially crafted workspace names can break out of the intended command context and execute arbitrary commands with the privileges of the invoking user.

Impact

An attacker who can influence the value passed to --workspace can execute arbitrary OS commands on Windows hosts.
This may lead to:

  • Arbitrary command execution

  • Data exfiltration

  • Local privilege escalation (depending on runtime context and privileges)

  • Modification or destruction of files accessible to the user running the CLI

The vulnerability affects only scenarios where:

  • The user invokes cyclonedx-npm with --workspace <value>, and

  • The vulnerable execution path is reached on Windows.

Exploitation Conditions (High-Level)

Exploitation requires the attacker to supply or influence the --workspace value passed to the CLI.
If the tool falls back to the vulnerable shell execution path on Windows, specially crafted workspace identifiers can cause unintended command execution.
No exploit code is included here to avoid providing weaponizable examples.

Root Cause

The CLI fallback execution path on Windows constructed a shell command using untrusted input from the --workspace option.
Because the fallback code path does not sanitize or escape the workspace value, special shell metacharacters (e.g., >, &, |) are interpreted by the shell, enabling command injection.

Fix

The vulnerability was resolved in [PR #1489], which ensures workspace values are handled safely and are no longer passed to a vulnerable shell execution path.

The fix is included in @cyclonedx/cyclonedx-npm version [6.0.0][v6.0.0].

Remediation

  • Upgrade to version [6.0.0][v6.0.0] or later, which contains the complete fix.

  • As a temporary mitigation for older versions, ensure that the environment variable npm_execpath is set to a npm-cli.js before invoking the tool.

  • Avoid passing untrusted or user-controlled values to the --workspace option.

  • If immediate upgrade is not possible, prioritize mitigation on Windows systems, where exploitability exists.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.