CVE-2022-29187 in Xcodeinfo

Summary

by MITRE • 07/13/2022

Git is a distributed revision control system. Git prior to versions 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, is vulnerable to privilege escalation in all platforms. An unsuspecting user could still be affected by the issue reported in CVE-2022-24765, for example when navigating as root into a shared tmp directory that is owned by them, but where an attacker could create a git repository. Versions 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 contain a patch for this issue. The simplest way to avoid being affected by the exploit described in the example is to avoid running git as root (or an Administrator in Windows), and if needed to reduce its use to a minimum. While a generic workaround is not possible, a system could be hardened from the exploit described in the example by removing any such repository if it exists already and creating one as root to block any future attacks.

If you want to get best quality of vulnerability data, you may have to visit VulDB.

Analysis

by VulDB Data Team • 05/22/2026

Git version 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 address a privilege escalation vulnerability that affects all platforms where Git is installed. This vulnerability stems from improper handling of repository initialization and file permissions when Git processes are executed with elevated privileges. The flaw allows attackers to exploit the way Git manages repository creation and access controls, particularly when running as root or administrator. The vulnerability is categorized under CWE-276 as improper file permissions, which directly relates to the insecure default settings that enable privilege escalation. When a user with elevated privileges navigates into a directory where an attacker has created a malicious Git repository, the system can be compromised through the privilege escalation mechanism.

The technical implementation of this vulnerability involves the interaction between Git's repository initialization process and the underlying file system permissions. Attackers can create malicious repositories in shared directories such as tmp partitions that are owned by the root user but accessible to regular users. When Git attempts to initialize or interact with these repositories, it can inadvertently grant elevated privileges to unprivileged users through improper permission handling. This scenario particularly affects systems where Git is frequently used in shared environments, such as development servers or multi-user systems where temporary directories are commonly utilized. The vulnerability is closely related to the ATT&CK technique T1068, which describes the use of local privilege escalation to gain elevated system access.

The operational impact of this vulnerability extends beyond simple privilege escalation, as it can enable attackers to execute arbitrary code with elevated privileges, modify system files, and potentially establish persistent access to compromised systems. The vulnerability is particularly dangerous in environments where root access is frequently required for Git operations, such as continuous integration systems, automated deployment environments, or shared development servers. The exploit described in CVE-2022-24765 demonstrates how attackers can leverage this flaw to gain unauthorized access to systems. Organizations using older Git versions are at risk of unauthorized access and potential system compromise when users execute Git commands with elevated privileges in compromised directories.

Mitigation strategies for this vulnerability primarily focus on privilege reduction and system hardening. The most effective approach is to avoid running Git as root or administrator whenever possible, which directly addresses the core issue by eliminating the privilege escalation vector. System administrators should implement strict access controls on shared directories and regularly audit repository permissions to ensure that no malicious repositories exist in system directories. The recommended solution involves removing any existing repositories in potentially compromised directories and recreating them with proper ownership and permissions. Additionally, organizations should implement automated monitoring to detect unauthorized repository creation in sensitive directories and establish policies that require Git operations to be performed with minimal necessary privileges. The patch versions mentioned in the advisory provide the necessary code-level fixes to prevent this specific privilege escalation vector.

Responsible

GitHub, Inc.

Reservation

04/13/2022

Disclosure

07/13/2022

Moderation

accepted

Entry

2

Relate

show

CPE

ready

EPSS

0.00444

KEV

no

Activities

very low

Sources

Might our Artificial Intelligence support you?

Check our Alexa App!