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

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

- **Severity:** MEDIUM 6.0
- **CVSS:** 6.0 (v3.1, CNA) `CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:N`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: Required; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: None
- **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.64% (percentile 45, 2026-11-26)
- **CWE:** CWE-427
- **Published:** 2022-04-12T00:00:00.000Z
- **Modified:** 2026-06-17T04:32:28.087Z

## Who should check

- Anyone running git-for-windows git \< 2.35.2

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

## Affected and fixed versions

- git-for-windows git: \< 2.35.2 (cvelist)

## Mitigation

- Upgrade git to 2.35.2 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-24765. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-24765.md
Affected: git-for-windows git < 2.35.2
Fixed in: git-for-windows git 2.35.2

Steps:
1. Search this machine and project for git-for-windows 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-24765 being exploited?

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

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

Medium: CVSS 6.0 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). A user has to take an action, such as opening a link, for the attack to work. The attack needs conditions outside the attacker's control, which makes it harder.

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

git-for-windows git \< 2.35.2.

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

Yes. Fixed in git-for-windows git 2.35.2. Upgrade git to 2.35.2 or later.

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

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-for-windows/git/security/advisories/GHSA-vw2c-22j4-2fh2>
- vendor: <https://git-scm.com/book/en/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Bash>
- vendor: <https://git-scm.com/docs/git#Documentation/git.txt-codeGITCEILINGDIRECTORIEScode>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/5PTN5NYEHYN2OQSHSAMCNICZNK2U4QH6/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BENQYTDGUL6TF3UALY6GSIEXIHUIYNWM/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SLP42KIZ6HACTVZMZLJLFJQ4W2XYT27M/>
- 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>
- other: <http://www.openwall.com/lists/oss-security/2022/04/12/7>
- other: <https://support.apple.com/kb/HT213261>
- other: <http://seclists.org/fulldisclosure/2022/May/31>
- 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-24765>

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