CVE-2022-29187

Bypass of safe.directory protections in Git

7.8 high EPSS 0.45%

Published 12 Jul 2022 Updated 3 Aug 2024 CNA: GitHub_M

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.

Check my servers

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)

7.8 high CVSS 3.1 from GitHub_M (CNA)
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

  • CWE-282 Improper Ownership Management
  • CWE-427 Uncontrolled Search Path Element

Affected products

As the CNA lists them.

ProductVersions
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-29187

RHEL, Rocky, Alma, Fedora

rpm -q git
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2022-29187

Alpine

apk list --installed | grep -i git

With 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

Other references

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.