Vulnerability · Published Apr 12, 2022 · Assigned by GitHub_M

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

Medium 6.0

In plain English

A medium-severity uncontrolled search path in git from git-for-windows. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 1.0% (higher than 63% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)6.0Medium
Exploit odds (30 days)1.0%top 36.7% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

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

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
AlmaLinux:8git2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-all2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-all2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-core2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-core2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-core-doc2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-core-doc2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-credential-libsecret2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-credential-libsecret2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-daemon2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-daemon2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-email2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-email2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-gui2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-gui2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-instaweb2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-instaweb2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-subtree2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-subtree2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8git-svn2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9git-svn2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8gitk2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9gitk2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8gitweb2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9gitweb2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8perl-Git2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9perl-Git2.39.1-1.el9ALSA-2023:2319
AlmaLinux:8perl-Git-SVN2.39.1-1.el8ALSA-2023:2859
AlmaLinux:9perl-Git-SVN2.39.1-1.el9ALSA-2023:2319
Alpine:v3.20git2.35.2-r0ALPINE-CVE-2022-24765
Alpine:v3.21git2.35.2-r0ALPINE-CVE-2022-24765
Alpine:v3.22git2.35.2-r0ALPINE-CVE-2022-24765
Alpine:v3.23git2.35.2-r0ALPINE-CVE-2022-24765
Alpine:v3.24git2.35.2-r0ALPINE-CVE-2022-24765
Alpine:v3.20libgit21.4.4-r0ALPINE-CVE-2022-24765
Alpine:v3.21libgit21.4.4-r0ALPINE-CVE-2022-24765
Alpine:v3.22libgit21.4.4-r0ALPINE-CVE-2022-24765
Alpine:v3.23libgit21.4.4-r0ALPINE-CVE-2022-24765
Alpine:v3.24libgit21.4.4-r0ALPINE-CVE-2022-24765
Debian:12git1:2.35.2-1DEBIAN-CVE-2022-24765
Debian:13git1:2.35.2-1DEBIAN-CVE-2022-24765
Debian:14git1:2.35.2-1DEBIAN-CVE-2022-24765
Ubuntu:22.04:LTSgit1:2.34.1-1ubuntu1.2UBUNTU-CVE-2022-24765
Ubuntu:22.04:LTSgit1:2.34.1-1ubuntu1.1USN-5376-2

Affected products (as reported)

VendorProductVersions
git-for-windows git < 2.35.2

Weakness: CWE-427 · Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:N

References