Vulnerability · Published Jul 12, 2022 · Assigned by GitHub_M

CVE-2022-29187Bypass of safe.directory protections in Git

High 7.8

In plain English

A high-severity uncontrolled search path in git from git. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.4% (higher than 39% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.8High
Exploit odds (30 days)0.4%top 61.1% of all CVEs
Exploited in the wildNo reportsnot in CISA KEV
Attack toolingNoneno public tooling known

Official description

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.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
AlmaLinux:8git2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-all2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-all2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-core2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-core2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-core-doc2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-core-doc2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-credential-libsecret2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-credential-libsecret2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-daemon2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-daemon2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-email2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-email2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-gui2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-gui2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-instaweb2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-instaweb2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-subtree2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-subtree2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-svn2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-svn2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8gitk2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9gitk2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8gitweb2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9gitweb2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8perl-Git2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9perl-Git2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8perl-Git-SVN2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9perl-Git-SVN2.39.1-1.el9ALSA-2023:2319
Alpine:v3.20git2.37.1-r0ALPINE-CVE-2022-29187
Alpine:v3.21git2.37.1-r0ALPINE-CVE-2022-29187
Alpine:v3.22git2.37.1-r0ALPINE-CVE-2022-29187
Alpine:v3.23git2.37.1-r0ALPINE-CVE-2022-29187
Alpine:v3.24git2.37.1-r0ALPINE-CVE-2022-29187
Alpine:v3.20libgit21.4.4-r0ALPINE-CVE-2022-29187
Alpine:v3.21libgit21.4.4-r0ALPINE-CVE-2022-29187
Alpine:v3.22libgit21.4.4-r0ALPINE-CVE-2022-29187
Alpine:v3.23libgit21.4.4-r0ALPINE-CVE-2022-29187
Alpine:v3.24libgit21.4.4-r0ALPINE-CVE-2022-29187
Debian:12git1:2.37.2-1DEBIAN-CVE-2022-29187
Debian:13git1:2.37.2-1DEBIAN-CVE-2022-29187
Debian:14git1:2.37.2-1DEBIAN-CVE-2022-29187
Ubuntu:22.04:LTSgit1:2.34.1-1ubuntu1.4UBUNTU-CVE-2022-29187
Ubuntu:22.04:LTSgit1:2.34.1-1ubuntu1.4USN-5511-1

Affected products (as reported)

VendorProductVersions
git git >= 2.30.3, < 2.30.5>= 2.31.2, < 2.31.4>= 2.32.1, < 2.32.3>= 2.33.2, < 2.33.4>= 2.34.2, < 2.34.4>= 2.35.2, < 2.35.4>= 2.36, < 2.36.2>= 2.37, < 2.37.1

Weakness: CWE-282, CWE-427 · Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

References