GHSA-V75R-VX73-82PJ
Vulnerability from github – Published: 2026-06-19 20:47 – Updated: 2026-06-19 20:47Summary
A command injection vulnerability exists in @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.
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, 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 version 5.0.0.
Remediation
- Upgrade to version 5.0.0 or later, which contains the complete fix.
- As a temporary mitigation for older versions, ensure that the environment variable
npm_execpathis set before invoking the tool. - Avoid passing untrusted or user‑controlled values to the
--workspaceoption.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@cyclonedx/cyclonedx-npm"
},
"ranges": [
{
"events": [
{
"introduced": "2.1.0"
},
{
"fixed": "5.0.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-55849"
],
"database_specific": {
"cwe_ids": [
"CWE-78"
],
"github_reviewed": true,
"github_reviewed_at": "2026-06-19T20:47:48Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "## Summary\nA command injection vulnerability exists in `@cyclonedx/cyclonedx-npm` when the CLI is invoked with the `--workspace \u003cvalue\u003e` option while the environment variable `npm_execpath` is unset or empty. \nUser\u2011supplied `--workspace` values are passed to a subshell without proper sanitization, enabling attackers to inject arbitrary OS commands. \nThis issue corresponds to **CWE\u201178**: Improper Neutralization of Special Elements used in an OS Command.\n\nThe vulnerability was fixed in version [5.0.0][v5.0.0].\n\n## Vulnerability Details\n\nWhen `cyclonedx-npm` is executed with the `--workspace` option, the provided argument is incorporated into an internal shell command. \nIf the environment variable `npm_execpath` is set, the tool uses the npm executable directly and no injection occurs. \nHowever, 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.\n\nAs 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.\n\n## Impact\n\nAn attacker who can influence the value passed to `--workspace` can execute arbitrary OS commands. \nThis may lead to:\n\n* Arbitrary command execution\n* Data exfiltration\n* Local privilege escalation (depending on how the tool is used)\n* Modification or destruction of files accessible to the user running the CLI\n\nThe vulnerability affects only scenarios where:\n* The user invokes `cyclonedx-npm` with `--workspace \u003cvalue\u003e`, and\n* The environment variable `npm_execpath` is unset or empty\n\n## Exploitation Conditions (High\u2011Level)\n\nExploitation requires the attacker to supply or influence the `--workspace` value passed to the CLI. \nIf the tool falls back to its subshell execution path, specially crafted workspace identifiers can cause unintended command execution. \nNo exploit code is included here to avoid providing weaponizable examples.\n\n## Root Cause\n\nThe CLI constructs a shell command using untrusted input from the `--workspace` option. \nBecause the fallback code path does not sanitize or escape the workspace value, special shell metacharacters (e.g., `;`, `\u0026\u0026`, `|`) are interpreted by the shell, enabling command injection.\n\nThis behavior matches **CWE\u201178**.\n\n## Fix\n\nThe vulnerability was resolved in [PR #1476], which ensures that workspace values are handled safely and are no longer passed to a subshell in an unsafe manner.\n\nThe fix is included in `@cyclonedx/cyclonedx-npm` version [5.0.0][v5.0.0].\n\n## Remediation\n\n* Upgrade to version [5.0.0][v5.0.0] or later, which contains the complete fix.\n* As a temporary mitigation for older versions, ensure that the environment variable `npm_execpath` is set before invoking the tool.\n* Avoid passing untrusted or user\u2011controlled values to the `--workspace` option.\n\n[v5.0.0]: https://github.com/CycloneDX/cyclonedx-node-npm/releases/tag/v5.0.0\n[PR #1476]: https://github.com/CycloneDX/cyclonedx-node-npm/pull/1476",
"id": "GHSA-v75r-vx73-82pj",
"modified": "2026-06-19T20:47:48Z",
"published": "2026-06-19T20:47:48Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/CycloneDX/cyclonedx-node-npm/security/advisories/GHSA-v75r-vx73-82pj"
},
{
"type": "WEB",
"url": "https://github.com/CycloneDX/cyclonedx-node-npm/pull/1476"
},
{
"type": "PACKAGE",
"url": "https://github.com/CycloneDX/cyclonedx-node-npm"
},
{
"type": "WEB",
"url": "https://github.com/CycloneDX/cyclonedx-node-npm/releases/tag/v5.0.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "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",
"type": "CVSS_V4"
}
],
"summary": "@cyclonedx/cyclonedx-npm: Shell Injection via Unsanitized --workspace Argument"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.