CVE-2026-119282: @nx/maven and @nx/gradle have OS command injection via nx.json plugin options

Published Oct 29, 2026
·
Updated

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.2

Upgrade 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

Other sources

Nx is a monorepo solution for TypeScript and polyglot codebases. From 22.0.2 until 22.7.9 and 23.1.2 for @nx/maven, and from 21.0.0 until 22.7.9 and 23.1.2 for @nx/gradle, the plugins' project-graph analyzers launch through a shell and interpolate plugin options from nx.json into command arguments. The @nx/maven targetNamePrefix value and arbitrary @nx/gradle option names or values can therefore be interpreted as shell syntax whenever an nx command constructs the project graph. A user who runs Nx in an attacker-controlled repository or pull request can execute injected commands with the user's privileges, while workspaces that register neither affected plugin are not exposed to this path. Remediation requires upgrading both nx and each affected plugin to matching releases because the plugin fix depends on code in the nx package. This issue is fixed in versions 22.7.9 and 23.1.2.

— MITRE

Affected Software

4 affected componentsFixes available
npm/@nx/gradle>=23.0.0<23.1.2
23.1.2
npm/@nx/gradle>=21.0.0<22.7.9
22.7.9
npm/@nx/maven>=23.0.0<23.1.2
23.1.2
npm/@nx/maven>=22.0.2<22.7.9
22.7.9

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/@nx/gradle to a version that resolves this vulnerability.

    Fixed in 23.1.2
  2. Upgrade

    Upgrade npm/@nx/gradle to a version that resolves this vulnerability.

    Fixed in 22.7.9
  3. Upgrade

    Upgrade npm/@nx/maven to a version that resolves this vulnerability.

    Fixed in 23.1.2
  4. Upgrade

    Upgrade npm/@nx/maven to a version that resolves this vulnerability.

    Fixed in 22.7.9
  5. Upgrade

    Upgrade nx to a version that resolves this vulnerability.

    Fixed in 22.7.9
  6. Upgrade

    Upgrade @nx/maven to a version that resolves this vulnerability.

    Fixed in 22.7.9
  7. Upgrade

    Upgrade @nx/gradle to a version that resolves this vulnerability.

    Fixed in 22.7.9
  8. Compensating control

    Until upgrading, run nx commands only in repositories you trust, because a malicious nx.json can execute code on a vulnerable version.

Event History

Oct 29, 2026
CVE Published
via MITRE·09:07 PM
Data Sourced
via MITRE·09:07 PM
DescriptionWeakness
Data Sourced
via OSV·09:07 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:17 PM
DescriptionSeverityWeakness
Oct 30, 2026
Advisory Published
via GitHub·02:42 PM
Data Sourced
via GitHub·02:42 PM
DescriptionWeaknessAffected Software
Data Sourced
via OSV·02:42 PM
Affected Software

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203