CVE-2021-21300:Git vulnerability allows remote code execution during clone operations when symbolic links and clean/smudge filters are used on case-insensitive file systems.

splash
Back

Description Preview

A vulnerability in Git allows attackers to execute arbitrary code when cloning repositories on case-insensitive file systems such as NTFS, HFS+, or APFS (default on Windows and macOS). The attack requires a specially crafted repository containing symbolic links and files using clean/smudge filters like Git LFS. When such a repository is cloned, a just-checked-out script can be executed without the user's knowledge. Git for Windows is particularly vulnerable as it configures Git LFS by default. This vulnerability affects Git versions from 2.14.2 up to versions released before March 9th, 2021.

Overview

This vulnerability (CVE-2021-21300) is classified as CWE-59, which relates to link following (symlink) vulnerabilities. The issue occurs during the clone operation when Git processes repositories containing both symbolic links and files that use clean/smudge filters such as Git LFS. On case-insensitive file systems (like those used by default on Windows and macOS), this combination can lead to arbitrary code execution as a specially crafted repository can cause scripts to be executed during the checkout process. The attack vector requires that clean/smudge filters are configured, which is the default setup for Git for Windows with Git LFS. This represents a significant security risk for developers who clone repositories from untrusted sources.

Remediation

  1. Update Git to one of the following patched versions: 2.30.1, 2.29.3, 2.28.1, 2.27.1, 2.26.3, 2.25.5, 2.24.4, 2.23.4, 2.22.5, 2.21.4, 2.20.5, 2.19.6, 2.18.5, 2.17.6.

  2. If updating is not immediately possible, implement one of these workarounds:

    • Disable symbolic link support in Git using the command: git config --global core.symlinks false
    • Remove any global clean/smudge filter configurations (such as Git LFS) before cloning repositories
    • Avoid cloning repositories from untrusted sources
  3. For Git for Windows users, be especially cautious as Git LFS is configured by default, making the system vulnerable without additional configuration changes.

References

  • GitHub Security Advisory: https://github.com/git/git/security/advisories/GHSA-8prw-h3cq-mghm
  • Git patch commit: https://github.com/git/git/commit/684dd4c2b414bcf648505e74498a608f28de4592
  • OSS Security mailing list discussion: http://www.openwall.com/lists/oss-security/2021/03/09/3
  • Git documentation on filters: https://git-scm.com/docs/gitattributes#_filter
  • Git documentation on symlinks: https://git-scm.com/docs/git-config#Documentation/git-config.txt-coresymlinks
  • Exploit details: http://packetstormsecurity.com/files/163978/Git-LFS-Clone-Command-Execution.html
  • Kernel.org discussion: https://lore.kernel.org/git/xmqqim6019yd.fsf%40gitster.c.googlers.com/
  • Apple security update: https://support.apple.com/kb/HT212320
  • Debian security update: https://lists.debian.org/debian-lts-announce/2022/10/msg00014.html
  • Gentoo security advisory: https://security.gentoo.org/glsa/202104-01

Industry ExposureMost to least
This section illustrates the prevalence of a specific Common Vulnerabilities and Exposures (CVE) across various industries based on customer reports. The ranking displays industries from the most to least affected by this particular vulnerability, offering valuable insight into where this CVE has been most frequently observed. This information can help organizations within these sectors prioritize their security efforts, understand their relative risk exposure compared to their peers, and focus remediation strategies where they are most needed. By understanding the industry-specific impact, organizations can make more informed decisions regarding patching, resource allocation, and overall risk management related to this CVE.

  1. Manufacturing
    Manufacturing
  2. Health Care & Social Assistance
    Health Care & Social Assistance
  3. Public Administration
    Public Administration
  4. Finance and Insurance
    Finance and Insurance
  5. Educational Services
    Educational Services
  6. Transportation & Warehousing
    Transportation & Warehousing
  7. Professional, Scientific, & Technical Services
    Professional, Scientific, & Technical Services
  8. Utilities
    Utilities
  9. Retail Trade
    Retail Trade
  10. Other Services (except Public Administration)
    Other Services (except Public Administration)
  11. Management of Companies & Enterprises
    Management of Companies & Enterprises
  12. Arts, Entertainment & Recreation
    Arts, Entertainment & Recreation
  13. Information
    Information
  14. Agriculture, Forestry Fishing & Hunting
    Agriculture, Forestry Fishing & Hunting
  15. Accommodation & Food Services
    Accommodation & Food Services
  16. Construction
    Construction
  17. Wholesale Trade
    Wholesale Trade
  18. Administrative, Support, Waste Management & Remediation Services
    Administrative, Support, Waste Management & Remediation Services
  19. Mining
    Mining
  20. Real Estate Rental & Leasing
    Real Estate Rental & Leasing

Focus on What Matters

  1. See Everything.
  2. Identify True Risk.
  3. Proactively Mitigate Threats.

Let's talk!

background
Armis Vulnerability Intelligence Database