Skip to content
Fencer Vulns
high 7.5

CVE-2021-32751 json

Arbitrary code execution via specially crafted environment variables

published 2021-07-20 5 y ago modified 2026-10-08 31 d ago also BIT-gradle-2021-32751 , EUVD-2021-19523 , GHSA-6j2p-252f-7mw8

cvss
7.5
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
2.7%
EPSS 2.7% chance of exploitation in 30 days, percentile 86%
public exploits
0
none known

Summary

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.

Patch / fix

  • bitnami gradle 7.2.0
  • gradle gradle 7.2
  • gradle SLE Real Time 15 SP3, SLE Module for Development Tools 15 SP4, openSUSE Leap 15.4 4.4.1-150200.3.10.1

suse advisories SUSE-SU-2023:2203-1

  • gradle Alpine 3.24, Alpine 3.23, Alpine 3.22 +7 more 7.2-r0

alpine advisories ALPINE-CVE-2021-32751

Alpine secdb © Alpine Linux, from https://secdb.alpinelinux.org via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

  • gradle-src Arch Linux 7.2-1
  • gradle Arch Linux 7.2-1

arch linux advisories AVG-2192

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2021-32751 updated cvss 7.5

gradle: Arbitrary code execution via specially crafted environment variables

  • Red Hat JBoss Enterprise Application Platform 6 gradle gradle
    affected: workaround, no fix planned “Out of support scope”
  • Red Hat Software Collections rh-maven36-byte-buddy, rh-maven36-byte-buddy-agent, rh-maven36-byte-buddy-parent, rh-maven36-byte-buddy-javadoc, rh-maven36-byte-buddy-maven-plugin
    affected: workaround, no fix planned “Will not fix”
  • Red Hat JBoss Enterprise Application Platform 7 gradle gradle Red Hat JBoss Enterprise Application Platform Expansion Pack gradle gradle
    not affected: vulnerable code not present

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

CISA SSVC

Exploitation
none
Automatable
yes
Technical impact
total
Assessed
31 d ago

Exploit prediction

2.71% chance of exploitation in the next 30 days, higher than 86% of all scored CVEs (FIRST EPSS, 2026-11-08).

Exploits and checks

  • github.com https://github.com/gradle/gradle/security/advisories/GHSA-6j2p-252f-7mw8 referenced PoC, tagged "exploit" by a source, unverified
  • medium.com https://medium.com/dot-debug/the-perils-of-bash-eval-cc5f9e309cae referenced PoC, tagged "exploit" by a source, unverified
  • mywiki.wooledge.org https://mywiki.wooledge.org/BashFAQ/048 referenced PoC, tagged "exploit" by a source, unverified

CVSS scores

assigned by version score vector
CNA 3.1 7.5 CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD 3.1 7.5 CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD 2.0 8.5 AV:N/AC:M/Au:S/C:C/I:C/A:C
OSV 3.1 7.5 CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H

Affected packages

ecosystem package affected fixed in
bitnami gradle
<7.2.0
7.2.0

Affected products

  • gradle gradle

Classification

Weakness
  • CWE-78 Improper Neutralization of Special Elements used in an OS Command

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.