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

> Attackers can escalate privileges by exploiting safe.directory bypasses when root users navigate attacker-controlled Git repositories.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 12 Jul 2022
- **Updated:** 3 Aug 2024
- **Also known as:** ALPINE-CVE-2022-29187, CLEANSTART-2026-EQ09700, DEBIAN-CVE-2022-29187, GHSA-j342-m5hw-rr3v, OESA-2022-1765, SUSE-SU-2022:2535-1, SUSE-SU-2022:2537-1, SUSE-SU-2022:2550-1, UBUNTU-CVE-2022-29187, USN-5511-1, openSUSE-SU-2024:12188-1, openSUSE-SU-2024:13449-1

## What is CVE-2022-29187?

CVE-2022-29187 is a high-severity vulnerability in Apple Xcode, published on 12 Jul 2022. It can only be exploited from the same machine or local network, with no action from the victim.

### 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.

Weakness: CWE-427 (Uncontrolled Search Path Element), CWE-282 (Improper Ownership Management)

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

It affects 4 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `git` | SUSE:Enterprise Storage 6 | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Enterprise Storage 7 | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:HPE Helion OpenStack 8 | All versions | 2.26.2-27.57.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15 SP2-ESPOS | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15-ESPOS | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15-LTSS | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise Module for Basesystem 15 SP3 | All versions | 2.35.3-150300.10.15.1 |
| `git` | SUSE:Linux Enterprise Module for Basesystem 15 SP4 | All versions | 2.35.3-150300.10.15.1 |
| `git` | SUSE:Linux Enterprise Module for Development Tools 15 SP3 | All versions | 2.35.3-150300.10.15.1 |
| `git` | SUSE:Linux Enterprise Module for Development Tools 15 SP4 | All versions | 2.35.3-150300.10.15.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP2-BCL | All versions | 2.26.2-27.57.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP3-BCL | All versions | 2.26.2-27.57.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP4-LTSS | All versions | 2.26.2-27.57.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP5 | All versions | 2.26.2-27.57.1 |
| `git` | SUSE:Linux Enterprise Server 15 SP1-BCL | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise Server 15 SP1-LTSS | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise Server 15 SP2-BCL | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise Server 15 SP2-LTSS | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise Server 15-LTSS | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 12 SP4 | All versions | 2.26.2-27.57.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 2.26.2-27.57.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 15 | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 15 SP1 | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Linux Enterprise Software Development Kit 12 SP5 | All versions | 2.26.2-27.57.1 |
| `git` | SUSE:Manager Proxy 4.1 | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Manager Retail Branch Server 4.1 | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:Manager Server 4.1 | All versions | 2.26.2-150000.41.1 |
| `git` | SUSE:OpenStack Cloud 8 | All versions | 2.26.2-27.57.1 |
| `git` | SUSE:OpenStack Cloud 9 | All versions | 2.26.2-27.57.1 |
| `git` | SUSE:OpenStack Cloud Crowbar 9 | All versions | 2.26.2-27.57.1 |
| `git` | openSUSE:Leap 15.3 | All versions | 2.26.2-150000.41.1 |
| `git` | openSUSE:Leap 15.3 | All versions | 2.35.3-150300.10.15.1 |
| `git` | openSUSE:Leap 15.4 | All versions | 2.26.2-150000.41.1 |
| `git` | openSUSE:Leap 15.4 | All versions | 2.35.3-150300.10.15.1 |
| `git` | openSUSE:Tumbleweed | All versions | 2.37.1-1.1 |
| `libgit2` | openSUSE:Tumbleweed | All versions | 1.7.1-3.1 |

Products: Apple Xcode, Debian Debian Linux, Fedoraproject Fedora, Git-Scm Git.

## How do I fix CVE-2022-29187?

Upgrade to a fixed version.

## Is CVE-2022-29187 being exploited?

There is no known exploitation of CVE-2022-29187 in the wild and no public exploit code.

## Other vulnerabilities in Apple Xcode

- [CVE-2025-48384](https://insights.sbomify.com/CVE-2025-48384/): Git Link Following (high 8.1, exploited in the wild)
- [CVE-2014-9390](https://insights.sbomify.com/CVE-2014-9390/): JGit Improper Input Validation vulnerability (critical 9.8)
- [CVE-2019-14379](https://insights.sbomify.com/CVE-2019-14379/): Deserialization of untrusted data in FasterXML jackson-databind (critical 9.8)
- [CVE-2018-4164](https://insights.sbomify.com/CVE-2018-4164/): An issue was discovered in certain Apple products. (critical 9.8)
- [CVE-2016-0746](https://insights.sbomify.com/CVE-2016-0746/): Use after free in n/a (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-29187 and fix it if it is affected.

What it is: CVE-2022-29187 is a high-severity vulnerability in Apple Xcode, published on 12 Jul 2022. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2022-29187 in the wild and no public exploit code.

Affected product: Apple Xcode. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-29187/ (Markdown: https://insights.sbomify.com/CVE-2022-29187/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-29187
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-29187
- OSV: https://osv.dev/vulnerability/CVE-2022-29187

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-29187/
Summaries are generated and may contain mistakes; the official description above is the record.
