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

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.41% (percentile 27, 2026-11-26)
- **CWE:** CWE-282, CWE-427
- **Published:** 2022-07-12T00:00:00.000Z
- **Modified:** 2026-06-17T04:39:46.357Z

## Who should check

- Anyone running 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

## 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 and fixed versions

- 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 (cvelist)

## Mitigation

- Upgrade git to 2.37.1 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2022-29187. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-29187.md
Affected: 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
Fixed in: git 2.30.5, git 2.31.4, git 2.32.3, git 2.33.4, git 2.34.4, git 2.35.4, git 2.36.2, git 2.37.1

Steps:
1. Search this machine and project for git: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2022-29187 being exploited?

There is no confirmed exploitation: CVE-2022-29187 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.41% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2022-29187?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2022-29187?

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.

### Is there a fix for CVE-2022-29187?

Yes. Fixed in git 2.30.5, git 2.31.4, git 2.32.3, git 2.33.4, git 2.34.4, git 2.35.4, git 2.36.2, git 2.37.1. Upgrade git to 2.37.1 or later.

### How do I check if I'm affected by CVE-2022-29187?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/git/git/security/advisories/GHSA-j342-m5hw-rr3v>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/TRZG5CDUQ27OWTPC5MQOR4UASNXHWEZS/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DDI325LOO2XBDDKLINOAQJEG6MHAURZE/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DIKWISWUDFT2FAITYIA6372BVLH3OOOC/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YROCMBWYFKRSS64PO6FUNM6L7LKBUKVW/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HVOLER2PIGMHPQMDGG4RDE2KZB74QLA2/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UDZRZAL7QULOB6V7MKT66MOMWJLBJPX4/>
- vendor: <https://security.gentoo.org/glsa/202312-15>
- vendor: <https://security.gentoo.org/glsa/202401-17>
- other: <https://github.blog/2022-04-12-git-security-vulnerability-announced>
- other: <https://lore.kernel.org/git/xmqqv8s2fefi.fsf%40gitster.g/T/#u>
- other: <http://www.openwall.com/lists/oss-security/2022/07/14/1>
- other: <https://support.apple.com/kb/HT213496>
- other: <http://seclists.org/fulldisclosure/2022/Nov/1>
- other: <https://lists.debian.org/debian-lts-announce/2022/12/msg00025.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2022-29187>

HTML: <https://flawdb.com/CVE-2022-29187> · JSON: <https://flawdb.com/api/v1/entries/CVE-2022-29187>
