CVE-2021-29428
Gradle vulnerability analysis and mitigation

Overview

In Gradle before version 7.0, on Unix-like systems, the system temporary directory could be created with open permissions that allow multiple users to create and delete files within it. This vulnerability (CVE-2021-29428) was discovered and disclosed in April 2021, affecting Gradle versions prior to 7.0. The vulnerability primarily impacted builds using precompiled script plugins written in Kotlin DSL and tests for Gradle plugins written using ProjectBuilder or TestKit (GitHub Advisory).

Technical details

The vulnerability stems from insecure temporary file creation practices in the system temporary directory. A race condition in the creation of temporary directories could be exploited, particularly in three scenarios: precompiled script plugins, ProjectBuilder API in tests, and Gradle TestKit in tests. The vulnerability received a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H, indicating local access requirements but high potential impact (NVD).

Impact

If exploited, this vulnerability could lead to local privilege escalation, allowing an attacker to execute commands at the same privilege level as the build. The impact was particularly significant for systems using precompiled script plugins, ProjectBuilder API, or TestKit in tests. Windows users and those on modern versions of macOS were not affected by this vulnerability (GitHub Advisory).

Mitigation and workarounds

The vulnerability was patched in Gradle 7.0, which removed reliance on system temporary directories where possible and instead uses a combination of the Gradle User Home and project's build directory. For users unable to upgrade, workarounds include ensuring the 'sticky' bit is set on Unix-like systems' temporary directory, or moving the Java temporary directory by setting the System Property java.io.tmpdir to a path with limited permissions (GitHub Advisory, Release Notes).

Additional resources


SourceThis report was generated using AI

Related Gradle vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-27148HIGH8.8
  • GradleGradle
  • gradle-8
NoYesFeb 25, 2025
CVE-2023-35947HIGH8.1
  • GradleGradle
  • gradle
NoYesJun 30, 2023
CVE-2023-44387MEDIUM6.5
  • GradleGradle
  • gradle
NoYesOct 05, 2023
CVE-2023-39152MEDIUM6.5
  • JavaJava
  • org.jenkins-ci.plugins:gradle
NoYesJul 26, 2023
CVE-2023-42445MEDIUM5.3
  • GradleGradle
  • gradle
NoYesOct 06, 2023

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management