CVE-2026-71538 — @cyclonedx/cyclonedx-npm
Fix: CycloneDX/cyclonedx-node-npm#1489CVE-2026-71538 is a remote code execution vulnerability in @cyclonedx/cyclonedx-npm. A fix is available for @cyclonedx/cyclonedx-npm — see the affected versions and patch details below.
@cyclonedx/cyclonedx-npm: Shell Injection via Unsanitized --workspace Argument on Windows
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
@cyclonedx/cyclonedx-npmnpmDescription
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-npmwith--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_execpathis set to anpm-cli.jsbefore invoking the tool. - Avoid passing untrusted or user-controlled values to the
--workspaceoption. - If immediate upgrade is not possible, prioritize mitigation on Windows systems, where exploitability exists.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @cyclonedx/cyclonedx-npm | all versions | 6.0.0npm install @cyclonedx/cyclonedx-npm@6.0.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @cyclonedx/cyclonedx-npm, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update @cyclonedx/cyclonedx-npm to 6.0.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-71538 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2026-71538 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2026-71538. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is CVE-2026-71538 in your dependencies?
O3 Security finds CVE-2026-71538 across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.