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.
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
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| AlmaLinux:8 | git | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | git | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | git-all | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | git-all | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | git-core | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | git-core | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | git-core-doc | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | git-core-doc | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | git-credential-libsecret | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | git-credential-libsecret | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | git-daemon | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | git-daemon | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | git-email | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | git-email | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | git-gui | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | git-gui | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | git-instaweb | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | git-instaweb | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | git-subtree | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | git-subtree | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | git-svn | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | git-svn | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | gitk | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | gitk | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | gitweb | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | gitweb | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | perl-Git | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | perl-Git | 2.39.1-1.el9 | ALSA-2023:2319 |
| AlmaLinux:8 | perl-Git-SVN | 2.39.1-1.el8 | ALSA-2023:2859 |
| AlmaLinux:9 | perl-Git-SVN | 2.39.1-1.el9 | ALSA-2023:2319 |
| Alpine:v3.20 | git | 2.37.1-r0 | ALPINE-CVE-2022-29187 |
| Alpine:v3.21 | git | 2.37.1-r0 | ALPINE-CVE-2022-29187 |
| Alpine:v3.22 | git | 2.37.1-r0 | ALPINE-CVE-2022-29187 |
| Alpine:v3.23 | git | 2.37.1-r0 | ALPINE-CVE-2022-29187 |
| Alpine:v3.24 | git | 2.37.1-r0 | ALPINE-CVE-2022-29187 |
| Alpine:v3.20 | libgit2 | 1.4.4-r0 | ALPINE-CVE-2022-29187 |
| Alpine:v3.21 | libgit2 | 1.4.4-r0 | ALPINE-CVE-2022-29187 |
| Alpine:v3.22 | libgit2 | 1.4.4-r0 | ALPINE-CVE-2022-29187 |
| Alpine:v3.23 | libgit2 | 1.4.4-r0 | ALPINE-CVE-2022-29187 |
| Alpine:v3.24 | libgit2 | 1.4.4-r0 | ALPINE-CVE-2022-29187 |
| Debian:12 | git | 1:2.37.2-1 | DEBIAN-CVE-2022-29187 |
| Debian:13 | git | 1:2.37.2-1 | DEBIAN-CVE-2022-29187 |
| Debian:14 | git | 1:2.37.2-1 | DEBIAN-CVE-2022-29187 |
| Ubuntu:22.04:LTS | git | 1:2.34.1-1ubuntu1.4 | UBUNTU-CVE-2022-29187 |
| Ubuntu:22.04:LTS | git | 1:2.34.1-1ubuntu1.4 | USN-5511-1 |
Affected products (as reported)
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
- https://github.com/git/git/security/advisories/GHSA-j342-m5hw-rr3v
- https://github.blog/2022-04-12-git-security-vulnerability-announced
- https://lore.kernel.org/git/xmqqv8s2fefi.fsf%40gitster.g/T/#u
- [oss-security] 20220713 Git v2.37.1 and friends for CVE-2022-29187 mailing-list
- FEDORA-2022-dfd7e7fc0e vendor-advisory
- FEDORA-2022-2a5de7cb8b vendor-advisory
- https://support.apple.com/kb/HT213496
- 20221107 APPLE-SA-2022-11-01-1 Xcode 14.1 mailing-list
- [debian-lts-announce] 20221213 [SECURITY] [DLA 3239-1] git security update mailing-list
- FEDORA-2023-470c7ea49e vendor-advisory
- FEDORA-2023-e3c8abd37e vendor-advisory
- FEDORA-2023-1068309389 vendor-advisory
- FEDORA-2023-3ec32f6d4e vendor-advisory
- GLSA-202312-15 vendor-advisory
- GLSA-202401-17 vendor-advisory