OS Command Injection in Gradle
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
A vulnerability tracked as CVE-2021-32751 has been found in Gradle.
Attackers can target a specific entry point like application over the network to misuse the product.
Successful exploitation can lead to full system takeover. CVSS score: 7.5/10.
What to do: apply the vendor's official patched release.
If unsure, ask your IT team or search "Gradle CVE-2021-32751" on the vendor's site.
CVE-2021-32751 (Gradle) — CWE-78 / CVSS v3 7.5
Attack vector: remote (network-reachable) / no user interaction
Attack surface: application / gradlew / eval / bash
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
OS command injection (CWE-78) exists in Gradle. Attackers reach the vulnerable code path via application.
Check the vendor advisory for the affected versions of Gradle. Attack surface: application / gradlew / eval / bash.
Severity: High (CVSS 7.5/10). Successful exploitation can lead to full system takeover.
Update to the patched release per vendor advisory.
Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.
Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'Gradle' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1
Identify exposureidentify
grep -r 'Gradle' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
Gradleを grep し、稼働しているサービス・バージョンを把握する。 -
2
Post-deployment verificationverify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| Bitnamigradle |
< 7.2.0→ 7.2.0 |
7.2.0 |
Fix status by distribution
Records published by each distribution for this CVE. Fixed versions differ by release; check each link.
- Alpine Linux ALPINE-CVE-2021-32751 gradle Fix available
- Debian DEBIAN-CVE-2021-32751 gradle No fixed version in this record
- Ubuntu UBUNTU-CVE-2021-32751 gradle No fixed version in this record
Original description The description as published by the source.
Gradle is a build tool with a focus on build automation. In versions prior to 7.2, start scripts generated by the application plugin and the gradlew script are both vulnerable to arbitrary code execution when an attacker is able to change environment variables for the user running the script. This may impact those who use gradlew on Unix-like systems or use the scripts generated by Gradle in thieir application on Unix-like systems. For this vulnerability to be exploitable, an attacker needs to be able to set the value of particular environment variables and have those environment variables be seen by the vulnerable scripts. This issue has been patched in Gradle 7.2 by removing the use of eval and requiring the use of the bash shell. There are a few workarounds available. For CI/CD systems using the Gradle build tool, one may ensure that untrusted users are unable to change environment variables for the user that executes gradlew. If one is unable to upgrade to Gradle 7.2, one may generate a new gradlew script with Gradle 7.2 and use it for older versions of Gradle. Fpplications using start scripts generated by Gradle, one may ensure that untrusted users are unable to change environment variables for the user that executes the start script. A vulnerable start script could be manually patched to remove the use of eval or the use of environment variables that affect the application's command-line. If the application is simple enough, one may be able to avoid the…
Source: NIST National Vulnerability Database NVD GitHub Advisory
References
- report github.com
- report medium.com
- report mywiki.wooledge.org
- web nvd.nist.gov