Nx code execution in Maven and Gradle project-graph analyzers
nrwl nx · @nx maven · @nx gradle
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| @nx/maven npm |
|
|
| @nx/gradle npm |
|
nrwl nx · @nx maven · @nx gradle
| Product | Affected | Fixed in |
|---|---|---|
| @nx/maven npm |
|
|
| @nx/gradle npm |
|
22.7.923.1.2Nx 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.
From the CVE record · GitHub_M
The @nx/maven and @nx/gradle project-graph analyzers can interpret plugin options in nx.json as shell commands. An attacker can execute commands with a user's privileges if that user runs Nx in an attacker-controlled repository or pull request and the workspace registers an affected plugin.
Check workspaces using @nx/maven versions >=22.0.2 <22.7.9 or >=23.0.0 <23.1.2, or @nx/gradle versions >=21.0.0 <22.7.9 or >=23.0.0 <23.1.2.