Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2021-29428

CVE-2021-29428: Gradle Privilege Escalation Vulnerability

CVE-2021-29428 is a local privilege escalation vulnerability in Gradle affecting Unix-like systems with insecure temporary directory permissions. This article covers technical details, affected versions, and mitigation.

Published: February 25, 2026

CVE-2021-29428 Overview

CVE-2021-29428 is a local privilege escalation vulnerability in Gradle versions prior to 7.0 affecting Unix-like systems. The flaw stems from the system temporary directory being created with overly permissive settings, enabling multiple users to create and delete files within it. An attacker with local access can exploit this condition by rapidly deleting and recreating files in the system temporary directory during Gradle build processes.

Critical Impact

Local attackers can escalate privileges by manipulating temporary files during Gradle builds, potentially compromising build integrity and gaining elevated access on affected Unix-like systems.

Affected Products

  • Gradle versions prior to 7.0
  • Quarkus (dependent on vulnerable Gradle versions)
  • Builds using precompiled script plugins written in Kotlin DSL

Discovery Timeline

  • 2021-04-13 - CVE-2021-29428 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-29428

Vulnerability Analysis

This vulnerability represents a Time-of-Check Time-of-Use (TOCTOU) race condition combined with insecure file permissions in Unix-like operating systems. The attack specifically impacts builds using precompiled script plugins written in Kotlin DSL and tests for Gradle plugins written using ProjectBuilder or TestKit.

The vulnerability does not affect Windows systems or modern versions of macOS. Additionally, Unix-like systems with the "sticky" bit set on the system temporary directory are protected from exploitation. The sticky bit ensures that only the original user (or root) can delete files, preventing the rapid file manipulation required for this attack.

Root Cause

The root cause is CWE-378: Creation of Temporary File With Insecure Permissions. When Gradle creates temporary files during build processes, the system temporary directory may be configured with open permissions (e.g., 777 without the sticky bit) on certain Unix-like systems. This allows any local user to read, write, and delete files in the temporary directory, creating a race condition opportunity.

Attack Vector

The attack requires local access to the target system. An attacker monitors the system temporary directory for Gradle build activity and exploits the race condition by quickly deleting legitimate temporary files and replacing them with malicious content. This manipulation occurs between the time Gradle checks the file and when it uses the file contents.

The attack mechanism involves the following steps:

  1. The attacker gains local access to a Unix-like system running Gradle builds
  2. The attacker monitors the system temporary directory (/tmp or similar) for Gradle-created files
  3. During a build, the attacker rapidly deletes a legitimate temporary file
  4. The attacker immediately recreates the file with malicious content
  5. Gradle processes the attacker-controlled file, potentially executing with elevated privileges

For detailed technical information, refer to the GitHub Security Advisory GHSA-89qm-pxvm-p336.

Detection Methods for CVE-2021-29428

Indicators of Compromise

  • Unusual file creation and deletion activity in the system temporary directory during Gradle builds
  • Unexpected changes in file ownership or permissions for temporary files
  • Build failures or unexpected behavior when using Kotlin DSL precompiled script plugins
  • Evidence of rapid file manipulation in /tmp or other temporary directories

Detection Strategies

  • Monitor system temporary directories for suspicious file operations during build processes
  • Implement file integrity monitoring for critical temporary files created by Gradle
  • Audit local user activity for patterns consistent with TOCTOU exploitation
  • Check Gradle version across development and build systems to identify vulnerable installations

Monitoring Recommendations

  • Enable audit logging for file operations in the system temporary directory
  • Configure alerts for rapid file creation/deletion sequences in /tmp
  • Monitor build server logs for unexpected failures in Kotlin DSL plugin compilation
  • Implement endpoint detection for local privilege escalation patterns

How to Mitigate CVE-2021-29428

Immediate Actions Required

  • Upgrade Gradle to version 7.0 or later to receive the security patch
  • Verify the "sticky" bit is set on the system temporary directory (chmod +t /tmp)
  • Review all build environments for vulnerable Gradle versions
  • Consider moving the Java temporary directory to a more secure location

Patch Information

Gradle has released version 7.0 which addresses this vulnerability. The fix is documented in the Gradle 7.0 Release Notes Security Advisories. The patches were implemented via GitHub Pull Request #15240 and GitHub Pull Request #15654.

Workarounds

  • Set the sticky bit on Unix-like operating systems using chmod +t /tmp to restrict file deletion to file owners
  • Redirect the Java temporary directory by setting the System Property java.io.tmpdir to a path with restricted permissions
  • Ensure the alternative temporary directory limits permissions to the build user only
  • For containerized builds, use private temporary directories with appropriate permission restrictions
bash
# Configuration example
# Set the sticky bit on the system temporary directory
chmod +t /tmp

# Alternatively, set a custom Java temporary directory with restricted permissions
mkdir -p /secure/tmp/gradle
chmod 700 /secure/tmp/gradle
export JAVA_OPTS="-Djava.io.tmpdir=/secure/tmp/gradle"

# Verify sticky bit is set (look for 't' in permissions)
ls -ld /tmp
# Expected output: drwxrwxrwt

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypePrivilege Escalation

  • Vendor/TechGradle

  • SeverityHIGH

  • CVSS Score7.8

  • EPSS Probability0.06%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-378
  • Technical References
  • GitHub Security Advisory GHSA-89qm-pxvm-p336
  • Vendor Resources
  • Gradle Security Advisories

  • GitHub Pull Request #15240

  • GitHub Pull Request #15654
  • Related CVEs
  • CVE-2025-27148: Gradle Privilege Escalation Vulnerability

  • CVE-2026-25063: gradle-completion RCE Vulnerability

  • CVE-2026-22865: Gradle Build Tool DOS Vulnerability

  • CVE-2026-22816: Gradle Build Automation RCE Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English