CVE-2026-55849: @cyclonedx/cyclonedx-npm Shell Injection Vulnerability

HIGH
Advisory Identifier: GHSA-v75r-vx73-82pj
CWE-78
Published
Advisory Summary

CVE-2026-55849 is a HIGH shell injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting @cyclonedx/cyclonedx-npm libraries in the npm ecosystem. The issue involves shell injection via unsanitized --workspace argument. Remediation is available by upgrading affected packages to version 5.0.0.

CVE-2026-55849 at a Glance

CVE Identifier CVE-2026-55849
GHSA Identifier GHSA-v75r-vx73-82pj
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product @cyclonedx/cyclonedx-npm
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-55849

To remediate this vulnerability, upgrade all affected @cyclonedx/cyclonedx-npm dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@cyclonedx/cyclonedx-npm fixed: 5.0.0
npm install @cyclonedx/cyclonedx-npm@5.0.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @cyclonedx/cyclonedx-npm

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-55849, inspect your project dependencies using npm:

npm ls @cyclonedx/cyclonedx-npm

Analyze the terminal output to locate any version of @cyclonedx/cyclonedx-npm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.0.0), your application is affected.

Note: The npm ls @cyclonedx/cyclonedx-npm command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In @cyclonedx/cyclonedx-npm, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary 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][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], 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][v5.0.0]. ## Remediation * Upgrade to version [5.0.0][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. [v5.0.0]: https://github.com/CycloneDX/cyclonedx-node-npm/releases/tag/v5.0.0 [PR #1476]: https://github.com/CycloneDX/cyclonedx-node-npm/pull/1476

CVE-2026-55849 Affected @cyclonedx/cyclonedx-npm Versions

1 component(s)
Fixed Versions:
5.0.0
Product / Package Ecosystem Affected Versions Fixed Version
@cyclonedx/cyclonedx-npm
npm
≥ 2.1.0
< 5.0.0
5.0.0

References

Frequently Asked Questions

What is CVE-2026-55849?
CVE-2026-55849 is a security vulnerability in @cyclonedx/cyclonedx-npm involving Shell Injection via Unsanitized --workspace Argument under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which @cyclonedx/cyclonedx-npm versions are affected?
Affected versions include releases prior to 5.0.0 across affected packages: @cyclonedx/cyclonedx-npm.
What version fixes CVE-2026-55849?
Upgrading to 5.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @cyclonedx/cyclonedx-npm affected?
Yes, @cyclonedx/cyclonedx-npm is affected in releases prior to 5.0.0. Upgrade your dependency to 5.0.0 or later.
What CWE is associated with CVE-2026-55849?
CVE-2026-55849 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2026-55849?
Run the dependency tree command: 'npm ls @cyclonedx/cyclonedx-npm'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-v75r-vx73-82pj",
  "modified" : "2026-06-19T20:47:48Z",
  "published" : "2026-06-19T20:47:48Z",
  "aliases" : [ "CVE-2026-55849" ],
  "summary" : "@cyclonedx/cyclonedx-npm: Shell Injection via Unsanitized --workspace Argument",
  "details" : "## Summary\nA 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.  \nUser‑supplied `--workspace` values are passed to a subshell without proper sanitization, enabling attackers to inject arbitrary OS commands.  \nThis issue corresponds to **CWE‑78**: 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 <value>`, and\n* The environment variable `npm_execpath` is unset or empty\n\n## Exploitation Conditions (High‑Level)\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., `;`, `&&`, `|`) are interpreted by the shell, enabling command injection.\n\nThis behavior matches **CWE‑78**.\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‑controlled 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",
  "severity" : [ {
    "type" : "CVSS_V4",
    "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@cyclonedx/cyclonedx-npm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.1.0"
      }, {
        "fixed" : "5.0.0"
      } ]
    } ]
  } ],
  "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"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-19T20:47:48Z",
    "nvd_published_at" : null
  }
}