# CVE-2022-24765: Uncontrolled search for the Git directory in Git for Windows

> Attackers on multi-user Windows machines can execute arbitrary code by placing a malicious .git directory in the root drive, affecting Git for Windows users.

- **Severity:** Medium 6.0 (`CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 12 Apr 2022
- **Updated:** 16 Dec 2025
- **Also known as:** ALPINE-CVE-2022-24765, BIT-git-2022-24765, CLEANSTART-2026-EN85312, DEBIAN-CVE-2022-24765, GHSA-vw2c-22j4-2fh2, MGASA-2022-0147, OESA-2022-1676, SUSE-SU-2022:1260-1, SUSE-SU-2022:1306-1, SUSE-SU-2022:1484-1, UBUNTU-CVE-2022-24765, USN-5376-1, USN-5376-2, USN-5376-3, openSUSE-SU-2024:12003-1, openSUSE-SU-2024:12005-1, openSUSE-SU-2024:12223-1

## What is CVE-2022-24765?

CVE-2022-24765 is a medium-severity path traversal vulnerability in Apple Xcode, published on 12 Apr 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

Git for Windows is a fork of Git containing Windows-specific patches. This vulnerability affects users working on multi-user machines, where untrusted parties have write access to the same hard disk. Those untrusted parties could create the folder `C:\.git`, which would be picked up by Git operations run supposedly outside a repository while searching for a Git directory. Git would then respect any config in said Git directory. Git Bash users who set `GIT_PS1_SHOWDIRTYSTATE` are vulnerable as well. Users who installed posh-gitare vulnerable simply by starting a PowerShell. Users of IDEs such as Visual Studio are vulnerable: simply creating a new project would already read and respect the config specified in `C:\.git\config`. Users of the Microsoft fork of Git are vulnerable simply by starting a Git Bash. The problem has been patched in Git for Windows v2.35.2. Users unable to upgrade may create the folder `.git` on all drives where Git commands are run, and remove read/write access from those folders as a workaround. Alternatively, define or extend `GIT_CEILING_DIRECTORIES` to cover the _parent_ directory of the user profile, e.g. `C:\Users` if the user profile is located in `C:\Users\my-user-name`.

Weakness: CWE-427 (Uncontrolled Search Path Element)

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

1 open source package ship an affected version, including git. It affects 4 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `git` | Bitnami | All versions | 2.35.2 |
| `git` | SUSE:Enterprise Storage 6 | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Enterprise Storage 7 | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:HPE Helion OpenStack 8 | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15 SP2-ESPOS | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15-ESPOS | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15-LTSS | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise Module for Basesystem 15 SP3 | All versions | 2.35.3-150300.10.12.1 |
| `git` | SUSE:Linux Enterprise Module for Development Tools 15 SP3 | All versions | 2.35.3-150300.10.12.1 |
| `git` | SUSE:Linux Enterprise Real Time 15 SP2 | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP2-BCL | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP3-BCL | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP3-LTSS | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP4-LTSS | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP5 | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:Linux Enterprise Server 15 SP1-BCL | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise Server 15 SP1-LTSS | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise Server 15 SP2-BCL | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise Server 15 SP2-LTSS | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise Server 15-LTSS | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 12 SP3 | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 12 SP4 | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 15 | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 15 SP1 | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Linux Enterprise Software Development Kit 12 SP5 | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:Manager Proxy 4.1 | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Manager Retail Branch Server 4.1 | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:Manager Server 4.1 | All versions | 2.26.2-150000.36.1 |
| `git` | SUSE:OpenStack Cloud 8 | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:OpenStack Cloud 9 | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:OpenStack Cloud Crowbar 8 | All versions | 2.26.2-27.52.1 |
| `git` | SUSE:OpenStack Cloud Crowbar 9 | All versions | 2.26.2-27.52.1 |
| `git` | openSUSE:Leap 15.3 | All versions | 2.26.2-150000.36.1 |
| `git` | openSUSE:Leap 15.3 | All versions | 2.35.3-150300.10.12.1 |
| `git` | openSUSE:Leap 15.4 | All versions | 2.35.3-150300.10.12.1 |

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

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

Upgrade git to 2.35.2 or later.

## Is CVE-2022-24765 being exploited?

There is no known exploitation of CVE-2022-24765 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-24765 and fix it if it is affected.

What it is: CVE-2022-24765 is a medium-severity path traversal vulnerability in Apple Xcode, published on 12 Apr 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2022-24765 in the wild and no public exploit code.

Affected packages and fixed versions:
- git (Bitnami): affected all versions; fixed in 2.35.2

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-24765/ (Markdown: https://insights.sbomify.com/CVE-2022-24765/index.md)
```

## Sources

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

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