Summary
Git LFS can execute a binary from the current directory on Windows
Workarounds
There are no known workarounds at this time.
References
- https://github.com/git-lfs/git-lfs/security/advisories/GHSA-6rw3-3whw-jvjj
- https://nvd.nist.gov/vuln/detail/CVE-2022-24826
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24826
- https://github.com/git-lfs/git-lfs/releases/tag/v3.1.4
- git-lfs/git-lfs@762ccd4a49
For more information
If you have any questions or comments about this advisory:
- For general questions, start a discussion in the Git LFS discussion forum.
- For reports of additional vulnerabilities, please follow the Git LFS security reporting policy.
Impact
On Windows, if Git LFS operates on a malicious repository with a ..exe file as well as a file named git.exe, and git.exe is not found in PATH, the ..exe program will be executed, permitting the attacker to execute arbitrary code. This does not affect Unix systems.
Similarly, if the malicious repository contains files named ..exe and cygpath.exe, and cygpath.exe is not found in PATH, the ..exe program will be executed when certain Git LFS commands are run.
More generally, if the current working directory contains any file with a base name of . and a file extension from PATHEXT (except .bat and .cmd), and also contains another file with the same base name as a program Git LFS intends to execute (such as git, cygpath, or uname) and any file extension from PATHEXT (including .bat and .cmd), then, on Windows, when Git LFS attempts to execute the intended program the ..exe, ..com, etc., file will be executed instead, but only if the intended program is not found in any directory listed in PATH.
The vulnerability occurs because when Git LFS detects that the program it intends to run does not exist in any directory listed in PATH then Git LFS passes an empty string as the executable file path to the Go os/exec package, which contains a bug such that, on Windows, it prepends the name of the current working directory (i.e., .) to the empty string without adding a path separator, and as a result searches in that directory for a file with the base name . combined with any file extension from PATHEXT, executing the first one it finds.
(The reason ..bat and ..cmd files are not executed in the same manner is that, although the Go os/exec package tries to execute them just as it does a ..exe file, the Microsoft Win32 API CreateProcess() family of functions have an undocumented feature in that they apparently recognize when a caller is attempting to execute a batch script file and instead run the cmd.exe command interpreter, passing the full set of command line arguments as parameters. These are unchanged from the command line arguments set by Git LFS, and as such, the intended program's name is the first, resulting in a command line like cmd.exe /c git, which then fails.)
Git LFS has resolved this vulnerability by always reporting an error when a program is not found in any directory listed in PATH rather than passing an empty string to the Go os/exec package in this case.
The bug in the Go os/exec package has been reported to the Go project and is expected to be patched after this security advisory is published.
CVE-2022-24826 has a CVSS score of 9.8 (Critical). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (3.1.3); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
The problem was introduced in v2.12.1 and is patched in v3.1.3 and v3.1.4. Users of affected versions should upgrade to v3.1.4.
Frequently Asked Questions
- What is CVE-2022-24826? CVE-2022-24826 is a critical-severity security vulnerability in github.com/git-lfs/git-lfs/v3 (go), affecting versions >= 3.0.0, < 3.1.3. It is fixed in 3.1.3.
- How severe is CVE-2022-24826? CVE-2022-24826 has a CVSS score of 9.8 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which packages are affected by CVE-2022-24826?
github.com/git-lfs/git-lfs/v3(go) (versions >= 3.0.0, < 3.1.3)github.com/git-lfs/git-lfs(go) (versions >= 2.12.1)
- Is there a fix for CVE-2022-24826? Yes. CVE-2022-24826 is fixed in 3.1.3. Upgrade to this version or later.
- Is CVE-2022-24826 exploitable, and should I be worried? Whether CVE-2022-24826 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2022-24826 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2022-24826? Upgrade
github.com/git-lfs/git-lfs/v3to 3.1.3 or later.