{"id":"CVE-2026-119282","aliases":["GHSA-qm8w-vx34-5j9j"],"url":"https://o3.security/vulnerability/CVE-2026-119282","summary":"Nx: OS command injection via nx.json plugin options in @nx/maven and @nx/gradle","details":"## Summary\n\n`@nx/maven` and `@nx/gradle` spawn their project-graph analyzers through a shell and interpolate plugin options read from `nx.json` straight into the command line. Because a shell parses the whole line, an option value containing shell syntax is executed as a command by any `nx` command that constructs the project graph. Anyone who clones a hostile repository, or who checks out a pull request that edits `nx.json`, runs the injected command with their own privileges.\n\n## Severity\n\nA victim who runs an ordinary `nx` command in an attacker-supplied Maven or Gradle workspace gets code execution as themselves. In most such workspaces an attacker who can write `nx.json` can already run code through the repository's build files (`./mvnw`, `pom.xml`, and the Gradle equivalents), so the genuinely new exposure is narrow — for example CI building a fork's pull request where `nx.json` is writable but the build files are not. We have no evidence of exploitation in the wild.\n\n## Affected & Patched Versions\n\n| Package | Vulnerable | Patched |\n| --- | --- | --- |\n| `@nx/maven` | `>= 22.0.2, < 22.7.9`; `>= 23.0.0, < 23.1.2` | `22.7.9`, `23.1.2` |\n| `@nx/gradle` | `>= 21.0.0, < 22.7.9`; `>= 23.0.0, < 23.1.2` | `22.7.9`, `23.1.2` |\n\n> [!IMPORTANT]\n> Workspaces that register neither `@nx/maven` nor `@nx/gradle` in `nx.json` are unaffected — the vulnerable code only runs from those plugins' graph-construction paths, and no other Nx plugin shares this pattern.\n\n## Remediation\n\nUpgrade to **22.7.9** (22.x line) or **23.1.2** (23.x line) or later:\n\n```\nnx migrate 23.1.2\n```\n\nUpgrade both `nx` and the affected plugin (`@nx/maven` and/or `@nx/gradle`). The plugin's fix depends on code that ships in the `nx` package, so bumping the plugin without a matching `nx` upgrade will not resolve it.\n\nThere is no configuration to change — upgrading is the whole fix. If you cannot upgrade yet, only run `nx` commands in repositories you trust, since a malicious `nx.json` can execute code on a vulnerable version.\n\n## Details\n\nBoth plugins spawn their analyzer through a shell and interpolate `nx.json` plugin options into the command, so those option values are shell source. For Maven the injectable value is the `targetNamePrefix` option; for Gradle it is broader, since every plugin option is mapped into a `-P` argument and arbitrary option names are accepted, making both the name and value of any option injectable.\n\n## Credits\n\n- **Arkadiusz Marta** (RE:SOURCE) — Reporter","published":"2026-10-29T21:07:46.468Z","modified":"2026-10-31T02:47:40.434432337Z","cvss":null,"epss":null,"cisaKev":null,"exploitsKnown":null,"affectedPackages":[{"ecosystem":"npm","name":"@nx/maven","fixedVersion":"22.7.9"},{"ecosystem":"npm","name":"@nx/maven","fixedVersion":"23.1.2"},{"ecosystem":"npm","name":"@nx/gradle","fixedVersion":"22.7.9"},{"ecosystem":"npm","name":"@nx/gradle","fixedVersion":"23.1.2"}],"fix":{"url":"https://github.com/nrwl/nx/commit/02c5d59e8dbbbe30963c0181c6a22cd8c1190a25","label":"nrwl/nx@02c5d59"},"references":[{"type":"WEB","url":"https://github.com/nrwl/nx/releases/tag/22.7.9"},{"type":"WEB","url":"https://github.com/nrwl/nx/releases/tag/23.1.2"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/119xxx/CVE-2026-119282.json"},{"type":"ADVISORY","url":"https://github.com/nrwl/nx/security/advisories/GHSA-qm8w-vx34-5j9j"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-119282"},{"type":"FIX","url":"https://github.com/nrwl/nx/commit/02c5d59e8dbbbe30963c0181c6a22cd8c1190a25"},{"type":"FIX","url":"https://github.com/nrwl/nx/commit/60196b7cfcffcada35b6b90e53bf1a78d049b548"},{"type":"FIX","url":"https://github.com/nrwl/nx/commit/c227f4780b054c512965c73aa480a48f9f781409"},{"type":"FIX","url":"https://github.com/nrwl/nx/pull/36626"},{"type":"PACKAGE","url":"https://github.com/nrwl/nx"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-10-31T02:47:40.434432337Z"}}