Skip to main content
No exploitation reportedFix available

CVE-2021-32751

No exploitation reported by the sources we read.

  • Published2021-07-20
  • Fixed in7.2
  • WeaknessCWE-78

Am I affected?

With a domain, we read the version its public headers and pages expose. A distribution build can carry the fix under an older number.

Description

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 use of the start scripts by running the application directly with Java command.

Timeline

dates in UTC
  1. 2021-07-2023:15CVE publishedNVD

Versions per branch

NVD · OSV
Gradle
BranchAffectedFixed in
7.2< 7.27.2
gradle
BranchAffectedFixed in
7.2< 7.2.07.2.0

as publishedRanges as NVD and OSV publish them; a distribution’s build can be fixed under an older number.

Distribution builds and vendor advisories

Packages from OSV.dev and products from the vendors' CSAF advisories.

version not verifiedVersions not verified: read as OSV.dev and the vendors publish them, not checked against each vendor's release list.

Packages

  • eco-java-gradleChainguardall versions · no fixed version listedand 188 other packages
  • gradleUbuntu:Pro:18.04:LTSall versions · no fixed version listed
  • gradleUbuntu:26.10all versions · no fixed version listed
  • gradleUbuntu:26.04:LTSall versions · no fixed version listed
  • gradleUbuntu:25.10all versions · no fixed version listed
  • gradleUbuntu:24.04:LTSall versions · no fixed version listed
  • gradleUbuntu:22.04:LTSall versions · no fixed version listed
  • gradleUbuntu:20.04:LTSall versions · no fixed version listed

18 more package ranges on OSV.dev

Vendor advisories

  • CVE-2021-32751 Red Hat Product Security6 known affected

    gradle: Arbitrary code execution via specially crafted environment variables

    gradle as a component of Red Hat JBoss Enterprise Application Platform 6 · rh-maven36-byte-buddy-agent as a component of Red Hat Software Collections · rh-maven36-byte-buddy-javadoc as a component of Red Hat Software Collections · +3 more

Full record on NVD

Fix

  1. Update Gradle to 7.2
  2. Workaround from the vendor Red Hat Product Security CVE-2021-32751 · 6 productsCI/CD systems using the Gradle build tool - You are not vulnerable if untrusted users are unable to change environment variables for the user that executes gradlew. - If you are unable to upgrade to Gradle 7.2, you can generate a new gradlew script with Gradle 7.2 and use it for older versions of G…
  3. No fix planned, says the vendor Red Hat Product Security CVE-2021-32751 · 1 productOut of support scope
  4. No fix planned, says the vendor Red Hat Product Security CVE-2021-32751 · 5 productsWill not fix

Detection

Nuclei template
none so far
ProjectDiscovery
Exploit-DB
no entry
Exploit-DB
Proof of concept
Metasploit modules
none listed
Metasploit Framework

Sources

  • CISA-ADPSSVC decisionnone2026-10-08
  • CNACVSS 3.17.5known since 2026-10-23
  • NVDCVSS 3.17.5read 2026-10-23
  • NVDCVSS 2.08.5read 2026-10-23
  • CNAweakness (CWE)CWE-78known since 2026-10-23
  • NVDweakness (CWE)CWE-78read 2026-10-23
  • FIRST EPSSEPSS score2.7 %2026-11-08
  • OSVaffected packages—
  • GitHub Advisoriesadvisory—

Identifiers

Technical details

CVSS v3 Vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
Published
2021-07-20
Last Modified
2026-10-08
NVD status
Modified
GitHub Advisory
GHSA-6j2p-252f-7mw8

Frequently asked questions

What is CVE-2021-32751?

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 use of the start scripts by running the application directly with Java command.

Is CVE-2021-32751 actively exploited?

Active exploitation of CVE-2021-32751 has not been confirmed. Its EPSS score was 2.7% on 2026-11-08, the estimated probability of exploitation in the next 30 days.

What is the CVSS score for CVE-2021-32751?

CVE-2021-32751 has a CVSS v3 base score of 7.5 (HIGH severity), with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H.

Running gradle? Hear about its next vulnerability

Surveillance reads the versions in your stack — a domain, a lockfile or a list — checks each CVE against the ranges its sources publish, and alerts you when one you run is exploited or enters CISA KEV. A version it cannot read stays « version not verified ».

No credit card required · No monthly cap on website lookups · 250 API requests/month

Sources for this record