CVE-2021-21237 Git LFS can execute a Git binary from the current directory on Windows
Git LFS on Windows executes a malicious Git binary from the current directory, allowing arbitrary code execution when processing untrusted repositories.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2021-21237?
CVE-2021-21237 is a high-severity command injection vulnerability in git-lfs, published on 15 Jan 2021. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Official description
Git LFS is a command line extension for managing large files with Git. 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 is the result of an incomplete fix for CVE-2020-27955. This issue occurs because on Windows, Go includes (and prefers) the current directory when the name of a command run does not contain a directory separator. Other than avoiding untrusted repositories or using a different operating system, there is no workaround. This is fixed in v2.13.2.
Weakness: CWE-426
Which versions are affected by CVE-2021-21237?
4 open source packages ship an affected version, including github.com/git-lfs/git-lfs and git-lfs. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
github.com/git-lfs/git-lfs Go | All versions | 1.5.1-0.20210113180018-fc664697ed2c |
github.com/git-lfs/git-lfs Go | All versions | 2.13.2 |
github.com/git-lfs/git-lfs Go | All versions | 2.13.2 |
git-lfs Bitnami | All versions | 2.13.2 |
Products include Git Large File Storage Project Git Large File Storage.
How do I fix CVE-2021-21237?
Upgrade github.com/git-lfs/git-lfs to a fixed version for your release line: 1.5.1-0.20210113180018-fc664697ed2c or 2.13.2.
Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.
Is CVE-2021-21237 being exploited?
There is no known exploitation of CVE-2021-21237 in the wild and no public exploit code.
Other vulnerabilities in git-lfs
Sources
Also known as BIT-git-lfs-2021-21237, GHSA-cx3w-xqmc-84g5, GO-2021-0098.