Uncontrolled Search Path Element Affecting git-for-windows/git package, versions [,2.35.2)


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.15% (37th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-UNMANAGED-GITFORWINDOWSGIT-2635994
  • published13 Apr 2022
  • disclosed13 Apr 2022
  • credit俞晨东 (ycdxsb)

Introduced: 13 Apr 2022

CVE-2022-24765  (opens in a new tab)
CWE-427  (opens in a new tab)

How to fix?

Upgrade git-for-windows/git to version 2.35.2 or higher.

Overview

Affected versions of this package are vulnerable to Uncontrolled Search Path Element by creating 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.

Workaround

Create the .git folder 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.

References

CVSS Base Scores

version 3.1