Vulnerabilities in pkg:npm/nx

PACKAGE
Advisory Summary

GHSA-w2vw-w76x-qr89 is a HIGH os command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Nx libraries in the npm ecosystem. The issue involves os command injection via git revisions and remote refs. Remediation is available by upgrading affected packages to version 22.7.8, 23.1.1.

7 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/nx

7 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/nx. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-w2vw-w76x-qr89 - HIGH Nx: OS command injection via git revisions and remote refs
GHSA-w3vv-58gj-gw77 CVE-2026-104854 HIGH Nx daemon and plugin worker sockets are accessible to other local users
GHSA-hrvq-x7jp-36xv CVE-2026-104853 MODERATE Nx: Path traversal in nx migrate package-migrations extraction
GHSA-vp3h-ghgh-jr7g CVE-2026-71476 HIGH Nx: Zip-Slip in the self-hosted remote cache
GHSA-g2r8-wvmj-jf5w CVE-2026-54753 MODERATE `nx graph` dev server permissive CORS policy
GHSA-cxm3-wv7p-598c CVE-2025-10894 CRITICAL Malicious versions of Nx were published
GHSA-8mjq-32x3-22qf - CRITICAL Duplicate Advisory: Malicious versions of Nx were published

GHSA-w2vw-w76x-qr89 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-w2vw-w76x-qr89
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 Nx
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-w2vw-w76x-qr89

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

nx fixed: 22.7.8
npm install nx@22.7.8
nx fixed: 23.1.1
npm install nx@23.1.1
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 nx

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-w2vw-w76x-qr89, inspect your project dependencies using npm:

npm ls nx

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

Note: The npm ls nx 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 Nx, 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 Nx core builds several `git` invocations as shell command strings with untrusted values interpolated into them, so a value that should be a git revision or ref is parsed by `/bin/sh` instead. Two entry points are reachable by an attacker: `affected` commands, where `defaultBase` / `affected.defaultBase` from `nx.json` (and the `NX_BASE` / `NX_HEAD` environment variables) reach `git merge-base` and `git diff`; and `nx import`, where a branch name advertised by a remote repository reaches `git fetch`, `git checkout`, and `git config`. In both cases an attacker who controls a repository — or who opens a pull request against one — gets arbitrary command execution on the machine of anyone who runs an ordinary Nx command against it, including CI runners. The `affected` path is the more serious of the two. `nx affected` and `nx show projects --affected` run constantly in CI, so a pull request that changes nothing but `nx.json` is enough to execute code on the runner with whatever credentials that job holds. ## Severity Exploitable by anyone who controls repository content — a fork's pull request, or a repository the victim clones — that the victim then runs an ordinary `nx affected` or `nx import` against; no access to the victim's machine is required. We have no evidence of exploitation in the wild. ## Affected & Patched Versions | Package | Vulnerable | Patched | | --- | --- | --- | | `nx` | `>= 14.0.0, < 22.7.8`; `>= 23.0.0, < 23.1.1` | `22.7.8`, `23.1.1` | Treat every version below the patched ones as affected. ## Remediation Upgrade to **22.7.8** (22.x line) or **23.1.1** (23.x line) or later: ``` nx migrate 23.1.1 ``` The fix is a drop-in — no configuration changes are required. If you cannot upgrade, treat `nx.json` from untrusted sources as executable content, do not run `affected` commands against pull requests you have not reviewed, and do not run `nx import` against repositories you do not trust. ## Details ### `affected` commands Nx computes the merge base and the changed-file set by building `git merge-base` and `git diff` command lines as strings and running them through a shell. The base and head revisions in those strings come from `nx.json`'s `defaultBase` / `affected.defaultBase` or from the `NX_BASE` / `NX_HEAD` environment variables, and a related code path reads file contents with `git show <revision>:<path>` the same way. Because a shell parses the whole line, a revision value containing shell syntax is executed rather than passed to `git`. The revisions are wrapped in double quotes, which looks protective but is not: POSIX shells still perform command substitution inside double quotes, so a value of `$(…)` runs without needing to break out of the quotes. ### `nx import` The `GitRepository` helper runs every git operation — `fetch`, `checkout`, `reset`, `config`, and others — by interpolating its arguments into a shell command string. The untrusted argument is a branch name: `nx import` lists the branches a remote advertises, offers them to the user to choose from, and feeds the chosen name back into those commands. A hostile repository controls the names of its own branches, so it controls the command that runs when one is selected. ## Credits - **Arkadiusz Marta** (RE:SOURCE) — Reporter

GHSA-w2vw-w76x-qr89 Affected Nx Versions

2 component(s)
Fixed Versions:
22.7.823.1.1
Product / Package Ecosystem Affected Versions Fixed Version
nx
npm
≥ 14.0.0
< 22.7.8
22.7.8
nx
npm
≥ 23.0.0
< 23.1.1
23.1.1

References

Frequently Asked Questions

What is GHSA-w2vw-w76x-qr89?
GHSA-w2vw-w76x-qr89 is a security vulnerability in Nx involving OS command injection via git revisions and remote refs under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Nx versions are affected?
Affected versions include releases prior to 22.7.8, 23.1.1 across affected packages: nx.
What version fixes GHSA-w2vw-w76x-qr89?
Upgrading to 22.7.8, 23.1.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nx affected?
Yes, nx is affected in releases prior to 22.7.8, 23.1.1. Upgrade your dependency to 22.7.8, 23.1.1 or later.
What CWE is associated with GHSA-w2vw-w76x-qr89?
GHSA-w2vw-w76x-qr89 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 GHSA-w2vw-w76x-qr89?
Run the dependency tree command: 'npm ls nx'. 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-w2vw-w76x-qr89",
  "modified" : "2026-10-05T23:29:06Z",
  "published" : "2026-10-05T23:29:06Z",
  "aliases" : [ ],
  "summary" : "Nx: OS command injection via git revisions and remote refs",
  "details" : "## Summary\n\nNx core builds several `git` invocations as shell command strings with untrusted values interpolated into them, so a value that should be a git revision or ref is parsed by `/bin/sh` instead. Two entry points are reachable by an attacker: `affected` commands, where `defaultBase` / `affected.defaultBase` from `nx.json` (and the `NX_BASE` / `NX_HEAD` environment variables) reach `git merge-base` and `git diff`; and `nx import`, where a branch name advertised by a remote repository reaches `git fetch`, `git checkout`, and `git config`. In both cases an attacker who controls a repository — or who opens a pull request against one — gets arbitrary command execution on the machine of anyone who runs an ordinary Nx command against it, including CI runners.\n\nThe `affected` path is the more serious of the two. `nx affected` and `nx show projects --affected` run constantly in CI, so a pull request that changes nothing but `nx.json` is enough to execute code on the runner with whatever credentials that job holds.\n\n## Severity\n\nExploitable by anyone who controls repository content — a fork's pull request, or a repository the victim clones — that the victim then runs an ordinary `nx affected` or `nx import` against; no access to the victim's machine is required. We have no evidence of exploitation in the wild.\n\n## Affected & Patched Versions\n\n| Package | Vulnerable | Patched |\n| --- | --- | --- |\n| `nx` | `>= 14.0.0, < 22.7.8`; `>= 23.0.0, < 23.1.1` | `22.7.8`, `23.1.1` |\n\nTreat every version below the patched ones as affected.\n\n## Remediation\n\nUpgrade to **22.7.8** (22.x line) or **23.1.1** (23.x line) or later:\n\n```\nnx migrate 23.1.1\n```\n\nThe fix is a drop-in — no configuration changes are required. If you cannot upgrade, treat `nx.json` from untrusted sources as executable content, do not run `affected` commands against pull requests you have not reviewed, and do not run `nx import` against repositories you do not trust.\n\n## Details\n\n### `affected` commands\n\nNx computes the merge base and the changed-file set by building `git merge-base` and `git diff` command lines as strings and running them through a shell. The base and head revisions in those strings come from `nx.json`'s `defaultBase` / `affected.defaultBase` or from the `NX_BASE` / `NX_HEAD` environment variables, and a related code path reads file contents with `git show <revision>:<path>` the same way. Because a shell parses the whole line, a revision value containing shell syntax is executed rather than passed to `git`.\n\nThe revisions are wrapped in double quotes, which looks protective but is not: POSIX shells still perform command substitution inside double quotes, so a value of `$(…)` runs without needing to break out of the quotes.\n\n### `nx import`\n\nThe `GitRepository` helper runs every git operation — `fetch`, `checkout`, `reset`, `config`, and others — by interpolating its arguments into a shell command string. The untrusted argument is a branch name: `nx import` lists the branches a remote advertises, offers them to the user to choose from, and feeds the chosen name back into those commands. A hostile repository controls the names of its own branches, so it controls the command that runs when one is selected.\n\n\n## Credits\n\n- **Arkadiusz Marta** (RE:SOURCE) — Reporter",
  "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" : "nx"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "14.0.0"
      }, {
        "fixed" : "22.7.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "nx"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "23.0.0"
      }, {
        "fixed" : "23.1.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nrwl/nx/security/advisories/GHSA-w2vw-w76x-qr89"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nrwl/nx/pull/36348"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nrwl/nx/pull/36379"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nrwl/nx/commit/11ab38573478172109bb5306cb30ca4af246caf0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nrwl/nx/commit/4159295a037fdbd8e7f44a33a19d85ab3792415b"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nrwl/nx/commit/9ce184a04d2098a4797c8b0d6877ee079b751abf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nrwl/nx/commit/c12850ce7b364db08e325c13541641d754db7123"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nrwl/nx/commit/cd9b3c068e17adc9c1722b35b9ca962b98542c20"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nrwl/nx/commit/cf996496bbad727362d48292b50fafc8c3665847"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nrwl/nx"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nrwl/nx/releases/tag/22.7.8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nrwl/nx/releases/tag/23.1.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78", "CWE-88" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-05T23:29:06Z",
    "nvd_published_at" : null
  }
}