Git LFS can execute a Git binary from the current directory
Published 11 Feb 2022 · Updated 6 Dec 2023
Is your project on an affected github.com/git-lfs/git-lfs?
Look after several Go apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- <2.12.1
- Fixed in
- 2.12.1
go get github.com/git-lfs/git-lfs@v2.12.1Details
Impact
On Windows, if Git LFS operates on a malicious repository with a git.bat or git.exe file in the current directory, that program would be executed, permitting the attacker to execute arbitrary code. This does not affect Unix systems.
This occurs because on Windows, Go includes (and prefers) the current directory when the name of a command run does not contain a directory separator.
Patches
This version should be patched in v2.12.1, which will be released in coordination with this security advisory.
Workarounds
Other than avoiding untrusted repositories, there is no workaround.
For more information
If you have any questions or comments about this advisory:
- Start a discussion in the Git LFS discussion page.
- If you cannot open a discussion, please email the core team using their usernames at
github.com.
Is GHSA-4g4p-42wc-9f3m in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected github.com/git-lfs/git-lfs, and gives you the command that fixes it.
More advisories for github.com/git-lfs/git-lfs
- LowCVE-2025-26625Git LFS may write to arbitrary files via crafted symlinks in github.com/git-lfs/git-lfs · 30 Oct 2025
- HighCVE-2025-26625Git LFS may write to arbitrary files via crafted symlinks · 17 Oct 2025
- LowCVE-2024-53263Git LFS permits exfiltration of credentials via crafted HTTP URLs in github.com/git-lfs/git-lfs · 15 Jan 2025
- HighCVE-2024-53263Git LFS permits exfiltration of credentials via crafted HTTP URLs · 14 Jan 2025
- HighCVE-2017-17831GitHub Git LFS Arbitrary command execution vulnerability · 14 May 2022
- CriticalCVE-2022-24826Git LFS can execute a binary from the current directory on Windows · 22 Apr 2022
References
- Linkgithub.com/git-lfs/git-lfs/security/advisories/GHSA-4g4p-42wc-9f3m
- Advisorynvd.nist.gov/vuln/detail/CVE-2020-27955
- Packagegithub.com/git-lfs/git-lfs
- Linkgithub.com/git-lfs/git-lfs/releases
- Linklegalhackers.com/advisories/Git-LFS-RCE-Exploit-CVE-2020-27955.html
- Linkseclists.org/fulldisclosure/2020/Nov/1
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.