Critical Vulnerability in Git Package: Execution of Malicious Scripts on Case-Insensitive File Systems
Summary
ALPINE-CVE-2021-21300: Git is an open-source distributed revision control system. Affects git versions < 2.22.5-r0. Fixed in 2.22.5-r0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Git is an open-source distributed revision control system widely used for source code management in software development. It allows multiple developers to work on a project simultaneously, tracking changes and facilitating collaboration. The package is known for its speed, efficiency, and support for non-linear development workflows. However, certain versions of Git are vulnerable to a security issue that can lead to the execution of malicious scripts when repositories are cloned onto case-insensitive file systems like NTFS, HFS+, or APFS.
Vulnerability Detail
In affected versions of Git, a specially crafted repository containing symbolic links and files using a clean/smudge filter (such as Git LFS) may trigger the execution of scripts during the checkout process. This vulnerability arises from the way Git handles symbolic links on case-insensitive file systems, potentially allowing attackers to execute arbitrary code. The earliest impacted version is 2.14.2, and the vulnerability has a CVSS score of 7.5, indicating a high severity level. The issue has been patched in several versions released on March 9, 2021.
How To Fix
Minimum fixed version
2.22.5-r0
This is the first release that contains the fix.
sudo apk add --upgrade git
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a workaround, you can disable symbolic link support in Git by executing the following command: git config --global core.symlinks false. Additionally, ensure that no clean/smudge filters, such as Git LFS, are configured globally before cloning repositories.
Conclusion
The vulnerability in Git poses a significant risk, particularly for users operating on case-insensitive file systems. It is crucial to update to the latest patched versions to mitigate the risk of malicious script execution. Additionally, employing workarounds can provide temporary relief until an update can be performed.
See every vulnerability recorded for git →
FAQ
The vulnerability allows for the execution of malicious scripts when cloning repositories containing symbolic links on case-insensitive file systems.
Affected versions include all versions prior to the patched releases: 2.22.5-r0, 2.24.4-r0, 2.26.3-r0, and 2.30.2-r0.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to check if your application is affected without requiring signup.
As a temporary measure, disable symbolic link support in Git and avoid using clean/smudge filters globally before cloning repositories.
The CVSS score of this vulnerability is 7.5, indicating a high severity level.
References
Related vulnerabilities
Recent vulnerabilities recorded for git.