---
title: "GHSA-v75r-vx73-82pj: @cyclonedx/cyclonedx-npm: Shell Injection via Unsanitized --workspace Argument"
description: "High severity. @cyclonedx/cyclonedx-npm: Shell Injection via Unsanitized --workspace Argument. Affects @cyclonedx/cyclonedx-npm; fixed in 5.0.0."
url: https://inlinr.com/advisories/GHSA-v75r-vx73-82pj
lang: en
---

[Packages](https://inlinr.com/packages) / [@cyclonedx/cyclonedx-npm](https://inlinr.com/packages/@cyclonedx/cyclonedx-npm) / [Security](https://inlinr.com/packages/@cyclonedx/cyclonedx-npm/security)

High Vulnerability GHSA-v75r-vx73-82pj CVE-2026-55849 Published 19 Jun 2026

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

Your version 

Affected releases · [@cyclonedx/cyclonedx-npm](https://inlinr.com/packages/@cyclonedx/cyclonedx-npm)

- 4.x 4.0.0 – 4.2.1 No fix on this line yet
- 3.x and older 2.1.0 – 3.1.0 No fix, no longer updated

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

```
npm install @cyclonedx/cyclonedx-npm@5.0.0
```

Every release on a timeline

7.x 

1. Not affected

7.0.0 – 7.0.1  
2 releases, latest

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. Not affected

2.0.0  
1 release
2. Affected

2.1.0  
1 release

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

## What happens

Summary

A command injection vulnerability exists in [@cyclonedx/cyclonedx-npm](https://inlinr.com/packages/@cyclonedx/cyclonedx-npm) when the CLI is invoked with the `--workspace <value>` option while the environment variable `npm_execpath` is unset or empty.  
User‑supplied `--workspace` values are passed to a subshell without proper sanitization, enabling attackers to inject arbitrary OS commands.  
This issue corresponds to **CWE‑78**: Improper Neutralization of Special Elements used in an OS Command.

The vulnerability was fixed in version [5.0.0](https://github.com/CycloneDX/cyclonedx-node-npm/releases/tag/v5.0.0 "https://github.com/CycloneDX/cyclonedx-node-npm/releases/tag/v5.0.0").

Vulnerability Details

When `cyclonedx-npm` is executed with the `--workspace` option, the provided argument is incorporated into an internal shell command.  
If the environment variable `npm_execpath` is set, the tool uses the npm executable directly and no injection occurs.  
However, when `npm_execpath` is unset or empty, the tool falls back to spawning a subshell and interpolating the `--workspace` value directly into the command string without proper escaping or neutralization.

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.  
This may lead to:

- Arbitrary command execution
- Data exfiltration
- Local privilege escalation (depending on how the tool is used)
- 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 environment variable `npm_execpath` is unset or empty

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 its subshell execution path, specially crafted workspace identifiers can cause unintended command execution.  
No exploit code is included here to avoid providing weaponizable examples.

Root Cause

The CLI constructs 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.

This behavior matches **CWE‑78**.

Fix

The vulnerability was resolved in [PR #1476](https://github.com/CycloneDX/cyclonedx-node-npm/pull/1476 "https://github.com/CycloneDX/cyclonedx-node-npm/pull/1476"), which ensures that workspace values are handled safely and are no longer passed to a subshell in an unsafe manner.

The fix is included in [@cyclonedx/cyclonedx-npm](https://inlinr.com/packages/@cyclonedx/cyclonedx-npm) version [5.0.0](https://github.com/CycloneDX/cyclonedx-node-npm/releases/tag/v5.0.0 "https://github.com/CycloneDX/cyclonedx-node-npm/releases/tag/v5.0.0").

Remediation

- Upgrade to version [5.0.0](https://github.com/CycloneDX/cyclonedx-node-npm/releases/tag/v5.0.0 "https://github.com/CycloneDX/cyclonedx-node-npm/releases/tag/v5.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 before invoking the tool.
- Avoid passing untrusted or user‑controlled values to the `--workspace` option.

## How it is exploited

Exploitable with local access, with no account and a user to do something.

- **Confidentiality**: high
- **Integrity**: high
- **Availability**: high

CVSS:4.0/​AV:L/​AC:L/​AT:N/​PR:N/​UI:P/​VC:H/​VI:H/​VA:H/​SC:N/​SI:N/​SA:N

## References

- [Reference](https://github.com/CycloneDX/cyclonedx-node-npm/security/advisories/GHSA-v75r-vx73-82pj "https://github.com/CycloneDX/cyclonedx-node-npm/security/advisories/GHSA-v75r-vx73-82pj")  
github.com/CycloneDX/cyclonedx-node-npm/securit…
- [Pull request](https://github.com/CycloneDX/cyclonedx-node-npm/pull/1476 "https://github.com/CycloneDX/cyclonedx-node-npm/pull/1476")  
#1476
- [Package](https://github.com/CycloneDX/cyclonedx-node-npm "https://github.com/CycloneDX/cyclonedx-node-npm")  
github.com/CycloneDX/cyclonedx-node-npm
- [Reference](https://github.com/CycloneDX/cyclonedx-node-npm/releases/tag/v5.0.0 "https://github.com/CycloneDX/cyclonedx-node-npm/releases/tag/v5.0.0")  
github.com/CycloneDX/cyclonedx-node-npm/release…

A whole project to check? Paste its package.json in the [dependency check](https://inlinr.com/tools/dependency-check): every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.
