Git - Execution of Arbitrary Code via Symbolic Links and Clean/Smudge Filters

git Updated 02 Oct 2025

Summary

09/03/2021
N/A
Yes i
High
7.5

CVE-2021-21300: Git is an open-source distributed revision control system. Affects git across 3 version ranges.

< 2.22.5-r0 < 37f0a4afad027cf030747a1ef45537ba86162960 < 684dd4c2b414bcf648505e74498a608f28de4592

Fixed in 2.22.5-r0. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Git is an open-source distributed revision control system widely used for version control of source code during software development. It provides a platform for multiple developers to collaborate on a project, track changes, and manage code repositories. Git supports various features such as branching, merging, and tagging, making it a versatile tool for managing codebase history. However, a vulnerability has been discovered in Git that allows the execution of arbitrary code when cloning a repository containing symbolic links and clean/smudge filters.

Vulnerability Detail

The vulnerability, identified as CVE-2021-21300, affects Git versions starting from 2.14.2. When cloning a repository that includes symbolic links and files utilizing clean/smudge filters like Git LFS (Large File Storage), the vulnerability can be exploited on case-insensitive file systems such as NTFS, HFS+, or APFS. This vulnerability arises due to the execution of just-checked out scripts during the cloning process. By crafting a malicious repository, an attacker can execute arbitrary code on the target system. Git for Windows, which includes Git LFS by default, is particularly vulnerable to this attack. The severity of this vulnerability is rated as CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H, with a score of 7.5.

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 temporary workaround, symbolic link support can be disabled in Git by running the command git config --global core.symlinks false. This prevents the described attack from being successful. Additionally, if no clean/smudge filters like Git LFS are configured globally before cloning a repository, the attack can be thwarted. However, it is always advisable to exercise caution and avoid cloning repositories from untrusted sources.

Conclusion

The vulnerability in Git allows the execution of arbitrary code when cloning a repository containing symbolic links and clean/smudge filters. It is crucial to update Git to one of the patched versions released on March 9th, 2021, to mitigate this vulnerability. Disabling symbolic link support in Git and avoiding cloning repositories from untrusted sources are recommended precautions. For further support on vulnerability remediation, reach out to DevNack.com.

See every vulnerability recorded for git →

Share this vulnerability

FAQ

Git is an open-source distributed revision control system used for managing source code during software development. It enables multiple developers to collaborate on a project and track changes to the codebase.

The vulnerability affects Git versions starting from 2.14.2. It has been patched in 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, and 2.17.6.

To fix this vulnerability, update Git to one of the patched versions released on March 9th, 2021. The fixed versions include 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, and 2.17.6.

Yes, you can disable symbolic link support in Git by running the command git config --global core.symlinks false. This prevents the described attack from being successful.

To avoid this vulnerability, it is best to avoid cloning repositories from untrusted sources. Additionally, ensure that clean/smudge filters like Git LFS are not configured globally before cloning a repository.

Related vulnerabilities

Recent vulnerabilities recorded for git.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback