CVEfocus › CVE database › CVE-2022-29187

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

CVSS 7.8 HighEPSS 0.4% (higher than 27% of CVEs)Published 2022-07-12Updated 2024-08-03Assigner: GitHub_M

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.

CWE-282CWE-427

What to do

Fixed builds are available from AlmaLinux, Alpine, Debian, Red Hat, Ubuntu: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

86Fixed
1Fix pending
30Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 22.04gitFixed1:2.34.1-1ubuntu1.4UBUNTU-CVE-2022-29187
Ubuntu 20.04gitFixed1:2.25.1-1ubuntu3.5UBUNTU-CVE-2022-29187
Ubuntu 18.04gitFixed1:2.17.1-1ubuntu0.12UBUNTU-CVE-2022-29187
Ubuntu 16.04gitFix pending
Debian 14gitFixed1:2.37.2-1DEBIAN-CVE-2022-29187
Debian 13gitFixed1:2.37.2-1DEBIAN-CVE-2022-29187
Debian 12gitFixed1:2.37.2-1DEBIAN-CVE-2022-29187
Red Hat Enterprise Linux 9gitFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9git-allFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9git-coreFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9git-core-docFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9git-credential-libsecretFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9git-daemonFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9git-emailFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9git-guiFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9git-instawebFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9git-subtreeFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9git-svnFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9gitkFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9gitwebFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9perl-GitFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 9perl-Git-SVNFixed0:2.39.1-1.el9RHSA-2023:2319
Red Hat Enterprise Linux 8gitFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8git-allFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8git-coreFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8git-core-docFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8git-credential-libsecretFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8git-daemonFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8git-emailFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8git-guiFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8git-instawebFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8git-subtreeFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8git-svnFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8gitkFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8gitwebFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8perl-GitFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 8perl-Git-SVNFixed0:2.39.1-1.el8RHSA-2023:2859
Red Hat Enterprise Linux 7emacs-gitNot affected
Red Hat Enterprise Linux 7emacs-git-elNot affected
Red Hat Enterprise Linux 7gitNot affected
Red Hat Enterprise Linux 7git-allNot affected
Red Hat Enterprise Linux 7git-bzrNot affected
Red Hat Enterprise Linux 7git-cvsNot affected
Red Hat Enterprise Linux 7git-daemonNot affected
Red Hat Enterprise Linux 7git-emailNot affected
Red Hat Enterprise Linux 7git-gnome-keyringNot affected
Red Hat Enterprise Linux 7git-guiNot affected
Red Hat Enterprise Linux 7git-hgNot affected
Red Hat Enterprise Linux 7git-instawebNot affected
Red Hat Enterprise Linux 7git-p4Not affected
Red Hat Enterprise Linux 7git-svnNot affected
Red Hat Enterprise Linux 7gitkNot affected
Red Hat Enterprise Linux 7gitwebNot affected
Red Hat Enterprise Linux 7perl-GitNot affected
Red Hat Enterprise Linux 7perl-Git-SVNNot affected
Red Hat Enterprise Linux 6emacs-gitNot affected
Red Hat Enterprise Linux 6emacs-git-elNot affected
Red Hat Enterprise Linux 6gitNot affected
Red Hat Enterprise Linux 6git-allNot affected
Red Hat Enterprise Linux 6git-cvsNot affected
Red Hat Enterprise Linux 6git-daemonNot affected
Red Hat Enterprise Linux 6git-emailNot affected
Red Hat Enterprise Linux 6git-guiNot affected
Red Hat Enterprise Linux 6git-svnNot affected
Red Hat Enterprise Linux 6gitkNot affected
Red Hat Enterprise Linux 6gitwebNot affected
Red Hat Enterprise Linux 6perl-GitNot affected
AlmaLinux 9gitFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9git-allFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9git-coreFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9git-core-docFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9git-credential-libsecretFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9git-daemonFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9git-emailFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9git-guiFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9git-instawebFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9git-subtreeFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9git-svnFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9gitkFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9gitwebFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9perl-GitFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 9perl-Git-SVNFixed2.39.1-1.el9ALSA-2023:2319
AlmaLinux 8gitFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8git-allFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8git-coreFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8git-core-docFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8git-credential-libsecretFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8git-daemonFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8git-emailFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8git-guiFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8git-instawebFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8git-subtreeFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8git-svnFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8gitkFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8gitwebFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8perl-GitFixed2.39.1-1.el8ALSA-2023:2859
AlmaLinux 8perl-Git-SVNFixed2.39.1-1.el8ALSA-2023:2859
Alpine Linux 3.24gitFixed2.37.1-r0ALPINE-CVE-2022-29187
Alpine Linux 3.24libgit2Fixed1.4.4-r0ALPINE-CVE-2022-29187
Alpine Linux 3.23gitFixed2.37.1-r0ALPINE-CVE-2022-29187
Alpine Linux 3.23libgit2Fixed1.4.4-r0ALPINE-CVE-2022-29187
Alpine Linux 3.22gitFixed2.37.1-r0ALPINE-CVE-2022-29187
Alpine Linux 3.22libgit2Fixed1.4.4-r0ALPINE-CVE-2022-29187
Alpine Linux 3.21gitFixed2.37.1-r0ALPINE-CVE-2022-29187
Alpine Linux 3.21libgit2Fixed1.4.4-r0ALPINE-CVE-2022-29187
Alpine Linux 3.20gitFixed2.37.1-r0ALPINE-CVE-2022-29187
Alpine Linux 3.20libgit2Fixed1.4.4-r0ALPINE-CVE-2022-29187
Alpine Linux 3.19gitFixed2.37.1-r0ALPINE-CVE-2022-29187
Alpine Linux 3.19libgit2Fixed1.4.4-r0ALPINE-CVE-2022-29187
Alpine Linux 3.18gitFixed2.37.1-r0ALPINE-CVE-2022-29187
Alpine Linux 3.18libgit2Fixed1.4.4-r0ALPINE-CVE-2022-29187
Alpine Linux 3.17gitFixed2.37.1-r0ALPINE-CVE-2022-29187
Alpine Linux 3.17libgit2Fixed1.4.4-r0ALPINE-CVE-2022-29187
Alpine Linux 3.16gitFixed2.36.2-r0ALPINE-CVE-2022-29187
Alpine Linux 3.15gitFixed2.34.4-r0ALPINE-CVE-2022-29187
Alpine Linux 3.14gitFixed2.32.3-r0ALPINE-CVE-2022-29187
Alpine Linux 3.13gitFixed2.30.5-r0ALPINE-CVE-2022-29187

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

Vendor advisories:

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.