LiveActive security incident?Get immediate response
CVE Record

CVE-2021-32751: Arbitrary code execution via specially crafted environment variables

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.

HighCVSS 7.5Not KEV-listedUpdated
Glexia's TakeAutomated analysishigh

Security readout for executives and security teams

Plain-English summary

Gradle-generated Unix scripts could run attacker-controlled code if a lower-privileged user can influence environment variables seen by the script runner. The main business risk is compromised build or application startup environments, especially CI/CD, not broad unauthenticated internet exposure.

Executive priority

Treat as a high-priority build and deployment hygiene issue where untrusted users share CI/CD or runtime control. Prioritize systems where build scripts run with privileged credentials, release signing access, or deployment permissions.

Technical view

Gradle before 7.2 produced vulnerable gradlew and application-plugin start scripts on Unix-like systems. Use of eval allowed environment-variable influence to become arbitrary command execution. Gradle 7.2 patched this by removing eval and requiring bash. The issue maps to CWE-78 and is rated CVSS 7.5 high.

Likely exposure

Exposure is most likely where teams run Gradle wrappers or Gradle-generated start scripts on Unix-like hosts, especially CI/CD systems or shared environments where untrusted users can set environment variables for the executing account.

Exploitation context

The source bundle does not show known active exploitation, and the CVE is not marked KEV. Exploitation requires control over particular environment variables visible to the vulnerable script, so risk depends on process isolation and CI/CD permissions.

Researcher notes

The key validation question is whether attacker-controlled environment variables can reach vulnerable Unix shell scripts. CVSS is high, but exploitability is gated by environment control. Sources name patch and workarounds but do not provide evidence of exploitation in the wild.

Mitigation direction

  • Upgrade Gradle to version 7.2 or later.
  • Regenerate gradlew using Gradle 7.2 if full upgrade is not immediately possible.
  • Prevent untrusted users from changing environment variables for script-running accounts.
  • Patch generated start scripts to remove eval where upgrade is delayed.
  • Run simple applications directly with Java if start scripts are unnecessary.

Validation and detection

  • Inventory repositories using gradlew from Gradle versions before 7.2.
  • Identify Unix-like deployments using Gradle application-plugin generated start scripts.
  • Review CI/CD permissions for who can set build environment variables.
  • Check whether vulnerable scripts still contain eval-dependent command construction.
  • Confirm remediation by comparing regenerated scripts against Gradle 7.2 behavior.
Prepared
Confidence
high
Sources
5

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · medium confidence lookup

CWE-78: Command execution behavior lookup

Command injection weaknesses can lead defenders to review execution techniques and command interpreter telemetry. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
description · low confidence lookup

Execution behavior lookup

The CVE wording references code or command execution, so execution technique review may help defensive triage. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2021-32751 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
High
CVSS
7.5 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

1CVSS vectors
0Timeline events
0ADP providers
4Source links

CVSS vector scores

1 official score

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

ScoreVersionSeverityVectorExploitImpactSource
7.5CVSS 3.1HighCVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H1.65.9Primary CVE score

Vulnerability scoring details

Base CVSS 3.1 score

7.5High
CVSS 3.1 vector shape for CVE-2021-32751Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone
Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
gradlegradle< 7.2Listed
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.