The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
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-2022-29187

CVE-2022-29187: Git-scm Git Privilege Escalation Flaw

CVE-2022-29187 is a privilege escalation vulnerability in Git-scm Git affecting versions prior to 2.37.1. Attackers can exploit root users in shared directories. This article covers technical details, affected versions, and patches.

Updated: May 16, 2026

CVE-2022-29187 Overview

CVE-2022-29187 is a privilege escalation vulnerability in Git, the distributed revision control system maintained by the git-scm project. The flaw allows an attacker to bypass the safe.directory protections introduced for CVE-2022-24765. An unsuspecting user running Git as root in a shared directory owned by them, such as /tmp, can be compromised if an attacker plants a malicious repository in that path. Affected versions include all Git releases prior to 2.37.1, 2.36.2, 2.35.4, 2.34.4, 2.33.4, 2.32.3, 2.31.4, and 2.30.5. The issue is tracked under [CWE-282] (Improper Ownership Management) and [CWE-427] (Uncontrolled Search Path Element).

Critical Impact

A local attacker can achieve privilege escalation when a higher-privileged user (such as root or a Windows Administrator) executes Git inside a directory containing an attacker-controlled repository.

Affected Products

  • Git versions prior to 2.37.1, 2.36.2, 2.35.4, 2.34.4, 2.33.4, 2.32.3, 2.31.4, and 2.30.5
  • Fedora 35, 36, and 37; Debian Linux 10.0
  • Apple Xcode (versions prior to the fix shipped in Apple HT213496)

Discovery Timeline

  • 2022-07-12 - CVE-2022-29187 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2022-29187

Vulnerability Analysis

The vulnerability stems from an incomplete fix for CVE-2022-24765. That earlier patch added the safe.directory configuration to prevent Git from trusting repositories owned by another user. However, the original check exempted the root user under the assumption that root would never traverse untrusted directories. Attackers can defeat this assumption by planting a .git directory inside any location a privileged user later enters, such as a shared /tmp directory the privileged user owns.

When Git executes inside such a directory, it reads the attacker-supplied .git/config file. The configuration can specify arbitrary values for core.fsmonitor, core.pager, or similar directives that Git invokes as shell commands. The privileged process then executes attacker-controlled code, completing the privilege escalation chain.

Root Cause

The root cause is improper ownership validation in Git's repository discovery logic. Git skipped the safe.directory ownership check when the effective user was root, leaving privileged invocations exposed to the same parent-directory takeover pattern previously addressed by CVE-2022-24765. The defect aligns with [CWE-282] Improper Ownership Management and [CWE-427] Uncontrolled Search Path Element.

Attack Vector

Exploitation requires local access and the ability to write into a directory that a privileged user will traverse. The attacker creates a Git repository, complete with a crafted .git/config, in a path such as /tmp/attacker-controlled/. When root runs any Git command in that directory (or a subdirectory), Git ascends the directory tree, locates the malicious .git, and executes hooks or configured commands with root privileges.

No network access, user interaction beyond the privileged invocation, or authentication beyond local shell access is required. Refer to the GitHub Security Advisory GHSA-j342-m5hw-rr3v and the Openwall OSS-Security disclosure for the upstream technical analysis.

Detection Methods for CVE-2022-29187

Indicators of Compromise

  • Unexpected .git directories present in shared paths such as /tmp, /var/tmp, or system service working directories.
  • Git configuration files (.git/config) referencing executables in core.fsmonitor, core.pager, core.editor, or core.sshCommand that point to attacker-controlled binaries.
  • Process telemetry showing git invoked as root followed by execution of unexpected shell or interpreter processes.

Detection Strategies

  • Audit endpoint process logs for git executions where the parent process runs with elevated privileges and the working directory is world-writable.
  • Hunt for filesystem events that create .git directories outside known repository roots, particularly in shared temporary directories.
  • Correlate Git invocations with subsequent spawning of sh, bash, python, or other interpreters that are not typical for routine Git operations.

Monitoring Recommendations

  • Enable auditd or equivalent kernel auditing rules for execve events involving the git binary when the effective UID is 0.
  • Monitor package management telemetry to confirm Git versions across the fleet match patched releases (2.30.5 or later within each maintenance line).
  • Alert on creation of .git/hooks/* scripts in non-developer accounts or system directories.

How to Mitigate CVE-2022-29187

Immediate Actions Required

  • Upgrade Git to a fixed version: 2.37.1, 2.36.2, 2.35.4, 2.34.4, 2.33.4, 2.32.3, 2.31.4, or 2.30.5, or any later release.
  • Stop running git as root or Administrator. Reduce privileged Git usage to the minimum operationally required.
  • Inventory shared writable directories (such as /tmp) for existing .git directories and remove any that are not legitimate.

Patch Information

Fixed releases are published by the upstream Git project and distribution maintainers. Apply vendor updates from the GitHub Security Advisory GHSA-j342-m5hw-rr3v, the Debian LTS announcement, Gentoo GLSA 202312-15, and Apple Support HT213496 for Xcode. Fedora users should apply the corresponding Fedora package update.

Workarounds

  • Pre-create a root-owned .git directory in shared paths (such as /tmp/.git) to prevent attackers from staging a malicious repository at that location.
  • Add explicit safe.directory entries to /etc/gitconfig only for repositories that must be operated on by privileged users.
  • Restrict shared directory permissions where feasible, replacing world-writable locations with per-user temporary directories.
bash
# Configuration example: explicitly allow only trusted repositories for root
git config --system --add safe.directory /opt/trusted-repo
git config --system --add safe.directory /srv/git/maintained-repo

# Block future attacks in /tmp by reserving the .git path as root-owned
sudo mkdir -p /tmp/.git
sudo chown root:root /tmp/.git
sudo chmod 700 /tmp/.git

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

  • Vulnerability Details
  • TypePrivilege Escalation

  • Vendor/TechGit

  • SeverityHIGH

  • CVSS Score7.8

  • EPSS Probability0.07%

  • 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-282

  • CWE-427
  • Technical References
  • Full Disclosure Mailing List

  • Openwall OSS-Security Mailing List

  • GitHub Security Vulnerability Announcement

  • GitHub Security Advisory GHSA-j342-m5hw-rr3v

  • Debian LTS Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Kernel Mailing List Thread

  • Gentoo GLSA 202312-15

  • Gentoo GLSA 202401-17

  • Apple Support Article HT213496
  • Related CVEs
  • CVE-2024-32020: Git Privilege Escalation Vulnerability

  • CVE-2026-45033: GitHub Copilot CLI RCE Vulnerability

  • CVE-2026-32631: Git for Windows NTLM Hash Disclosure

  • CVE-2026-4496: Git-MCP-Server RCE Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today 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