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.
- 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
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
Which versions are affected by CVE-2022-24765?
1 open source package ship an affected version, including git. It affects 4 products.
| Package | Affected | Fixed in |
|---|---|---|
git Bitnami | All versions | 2.35.2 |
Linux distribution packages (39)
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 include 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.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
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
Sources
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 and 11 more.