CVE-2026-119282: @nx/maven and @nx/gradle have OS command injection via nx.json plugin options
The Nx plugins @nx/maven and @nx/gradle run their project-graph analyzers through a shell and paste nx.json plugin options into the command line. A hostile nx.json runs commands as whoever runs any nx command in that workspace. Upgrade to 22.7.9 or 23.1.2, and upgrade nx alongside the plugin.
Published Oct 30, 2026 · Analysis Oct 31, 2026
What an attacker can do
Both plugins start their analyzer with a shell and interpolate nx.json plugin options into the command. For Maven the injectable value is targetNamePrefix. For Gradle every plugin option becomes a -P argument and arbitrary option names are accepted, so both the name and the value can carry shell syntax. Any nx command that builds the project graph triggers it.
The attacker needs the victim to run nx in a workspace where the attacker controls nx.json: a cloned hostile repository, or a checked-out pull request that edits nx.json. The injected command runs with the victim's privileges, so it can read source, tokens and SSH keys, or plant a backdoor.
The maintainers point out the new exposure is narrow. Anyone who can write nx.json can usually already run code through build files such as ./mvnw, pom.xml or the Gradle equivalents. The real gap is a case like CI building a fork's pull request where nx.json is writable but build files are not. The advisory reports no exploitation in the wild.
Who is affected
@nx/maven: 22.0.2 up to but not including 22.7.9, and 23.0.0 up to but not including 23.1.2.
@nx/gradle: 21.0.0 up to but not including 22.7.9, and 23.0.0 up to but not including 23.1.2.
Workspaces that register neither plugin in nx.json are unaffected. Check:
npm ls nx @nx/maven @nx/gradleThen look at the plugins array in nx.json for @nx/maven or @nx/gradle.
@nx/maven
- Ecosystem
- npm
- Affected
- >= 22.0.2, < 22.7.9
- Fixed in
- 22.7.9
- Check
npm ls @nx/maven
@nx/maven
- Ecosystem
- npm
- Affected
- >= 23.0.0, < 23.1.2
- Fixed in
- 23.1.2
- Check
npm ls @nx/maven
@nx/gradle
- Ecosystem
- npm
- Affected
- >= 21.0.0, < 22.7.9
- Fixed in
- 22.7.9
- Check
npm ls @nx/gradle
@nx/gradle
- Ecosystem
- npm
- Affected
- >= 23.0.0, < 23.1.2
- Fixed in
- 23.1.2
- Check
npm ls @nx/gradle
How to fix it
Upgrade to 22.7.9 on the 22.x line or 23.1.2 on the 23.x line:
nx migrate 23.1.2Upgrade both nx and the affected plugin. The plugin fix depends on code shipped in the nx package, so bumping only the plugin does not fix it. The fix replaces the shell spawn with a safeSpawn helper that passes arguments as an array, so option values reach Maven or Gradle as literal text.
There is no configuration change. If you cannot upgrade yet, run nx only in repositories you trust.
How to tell if you were hit
Review nx.json history and pull requests for changes to plugin options of @nx/maven or @nx/gradle, especially targetNamePrefix or Gradle option names and values containing ;, |, &, backticks or $(. On CI, check for unexpected child processes spawned during project-graph construction and for outbound network calls from jobs that build fork pull requests.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
@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.
Severity
A 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.
Affected & Patched Versions
| Package | Vulnerable | Patched | | `@nx/maven` | `>= 22.0.2, < 22.7.9`; `>= 23.0.0, < 23.1.2` | `22.7.9`, `23.1.2` | | `@nx/gradle` | `>= 21.0.0, < 22.7.9`; `>= 23.0.0, < 23.1.2` | `22.7.9`, `23.1.2` |
[!IMPORTANT] > 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.
Remediation
Upgrade to 22.7.9 (22.x line) or 23.1.2 (23.x line) or later:
nx migrate 23.1.2Upgrade 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.
There 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.
Details
Both 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.
Credits
- Arkadiusz Marta (RE:SOURCE) — Reporter
Credited to arkmarta.
Questions
- Am I affected if I use Nx without Maven or Gradle?
No. The advisory says workspaces that register neither @nx/maven nor @nx/gradle in nx.json are unaffected, and no other Nx plugin shares this pattern.
- Is upgrading only the plugin enough?
No. The plugin fix depends on code in the nx package, so you must upgrade nx to a matching version (22.7.9 or 23.1.2) as well as the plugin.
- Is this exploited in the wild?
The advisory states there is no evidence of exploitation in the wild, and the entry is not in the CISA KEV catalog.
- Who is most at risk?
CI systems that build pull requests from forks, where nx.json can be changed but build files are protected, and developers who run nx commands in untrusted cloned repositories.
References
Read for this analysis:
- https://github.com/nrwl/nx/security/advisories/GHSA-qm8w-vx34-5j9j
- https://nvd.nist.gov/vuln/detail/CVE-2026-119282
- https://github.com/nrwl/nx/commit/02c5d59e8dbbbe30963c0181c6a22cd8c1190a25
- https://github.com/nrwl/nx/commit/60196b7cfcffcada35b6b90e53bf1a78d049b548
- https://github.com/nrwl/nx/commit/c227f4780b054c512965c73aa480a48f9f781409
- https://github.com/nrwl/nx/releases/tag/22.7.9
- https://github.com/nrwl/nx/releases/tag/23.1.2
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
