CVE-2022-29187
Bypass of safe.directory protections in Git
Check your servers for CVE-2022-29187
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2022-29187 affects git, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
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.
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.45%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 40.4% of all scored CVEs. Scores of 1 Dec 2026.
Weakness
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| git |
affected >= 2.30.3, < 2.30.5 affected >= 2.31.2, < 2.31.4 affected >= 2.32.1, < 2.32.3 affected >= 2.33.2, < 2.33.4 affected >= 2.34.2, < 2.34.4 affected >= 2.35.2, < 2.35.4 affected >= 2.36, < 2.36.2 affected >= 2.37, < 2.37.1
|
Is my server affected?
Find the installed version of git and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i git
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2022-29187 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2022-29187RHEL, Rocky, Alma, Fedora
rpm -q git
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2022-29187Alpine
apk list --installed | grep -i gitWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2022-29187
trivy image --scanners vuln IMAGE | grep CVE-2022-29187
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
- FEDORA-2022-dfd7e7fc0e lists.fedoraproject.org · vendor advisory
- FEDORA-2022-2a5de7cb8b lists.fedoraproject.org · vendor advisory
- FEDORA-2023-470c7ea49e lists.fedoraproject.org · vendor advisory
- FEDORA-2023-e3c8abd37e lists.fedoraproject.org · vendor advisory
- FEDORA-2023-1068309389 lists.fedoraproject.org · vendor advisory
- FEDORA-2023-3ec32f6d4e lists.fedoraproject.org · vendor advisory
- GLSA-202312-15 security.gentoo.org · vendor advisory
- GLSA-202401-17 security.gentoo.org · vendor advisory
Other references
- https://github.com/git/git/security/advisories/GHSA-j342-m5hw-rr3v github.com
- https://github.blog/2022-04-12-git-security-vulnerability-announced github.blog
- https://lore.kernel.org/git/xmqqv8s2fefi.fsf%40gitster.g/T/#u lore.kernel.org
- [oss-security] 20220713 Git v2.37.1 and friends for CVE-2022-29187 openwall.com · mailing list
- https://support.apple.com/kb/HT213496 support.apple.com
- 20221107 APPLE-SA-2022-11-01-1 Xcode 14.1 seclists.org · mailing list
- [debian-lts-announce] 20221213 [SECURITY] [DLA 3239-1] git security update lists.debian.org · mailing list
Source: the record CVE-2022-29187 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse