CVE-2021-21300
malicious repositories can execute remote code while cloning
Check your servers for CVE-2021-21300
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2021-21300 affects git, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
Git is an open-source distributed revision control system. In affected versions of Git a specially crafted repository that contains symbolic links as well as files using a clean/smudge filter such as Git LFS, may cause just-checked out script to be executed while cloning onto a case-insensitive file system such as NTFS, HFS+ or APFS (i.e. the default file systems on Windows and macOS). Note that clean/smudge filters have to be configured for that. Git for Windows configures Git LFS by default, and is therefore vulnerable. The problem has been patched in the versions published on Tuesday, March 9th, 2021. As a workaound, if symbolic link support is disabled in Git (e.g. via `git config --global core.symlinks false`), the described attack won't work. Likewise, if no clean/smudge filters such as Git LFS are configured globally (i.e. _before_ cloning), the attack is foiled. As always, it is best to avoid cloning repositories from untrusted sources. The earliest impacted version is 2.14.2. The fix versions are: 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.62.17.6.
Severity (CVSS)
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:N
- Attack vector
- network: an attacker can reach the vulnerable part over the network, often from the internet
- Attack complexity
- high: an attack depends on conditions outside the control of the attacker, such as a race
- Privileges required
- none: the attacker does not need an account
- User interaction
- required: a user has to do something, such as open a link or a file
- Scope
- changed: the damage reaches other components, such as the host of a container or other users
- Impact
- confidentiality high, integrity high, availability none: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 90.7%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 99.8% of all scored CVEs. Scores of 1 Dec 2026.
Weakness
- CWE-59 Improper Link Resolution Before File Access
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| git |
affected >= 2.14.2, < 2.17.62.17.6 affected >= 2.18.0, < 2.18.5 affected >= 2.19.0, < 2.19.6 affected >= 2.20.0, < 2.20.5 affected >= 2.21.0, < 2.21.4 affected >= 2.22.0, < 2.22.5 affected >= 2.23.0, < 2.23.4 affected >= 2.24.0, < 2.24.4 affected >= 2.25.0, < 2.25.5 affected >= 2.26.0, < 2.26.3 affected >= 2.27.0, < 2.27.1 affected >= 2.28.0, < 2.28.1 affected >= 2.29.0, < 2.29.3 affected >= 2.30.0, < 2.30.1
|
Is my server affected?
Find the installed version of git and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i git
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2021-21300 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2021-21300RHEL, Rocky, Alma, Fedora
rpm -q git
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2021-21300Alpine
apk list --installed | grep -i gitWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2021-21300
trivy image --scanners vuln IMAGE | grep CVE-2021-21300
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
- FEDORA-2021-63fcbd126e lists.fedoraproject.org · vendor advisory
- FEDORA-2021-ffd0b2108d lists.fedoraproject.org · vendor advisory
- FEDORA-2021-03e61a6647 lists.fedoraproject.org · vendor advisory
- GLSA-202104-01 security.gentoo.org · vendor advisory
Other references
- https://github.com/git/git/security/advisories/GHSA-8prw-h3cq-mghm github.com
- https://lore.kernel.org/git/xmqqim6019yd.fsf%40gitster.c.googlers.com/ lore.kernel.org
- https://git-scm.com/docs/git-config#Documentation/git-config.txt-coresymlinks git-scm.com
- https://git-scm.com/docs/gitattributes#_filter git-scm.com
- https://github.com/git/git/commit/684dd4c2b414bcf648505e74498a608f28de4592 github.com
- [oss-security] 20210309 git: malicious repositories can execute remote code while cloning openwall.com · mailing list
- https://support.apple.com/kb/HT212320 support.apple.com
- 20210427 APPLE-SA-2021-04-26-10 Xcode 12.5 seclists.org · mailing list
- http://packetstormsecurity.com/files/163978/Git-LFS-Clone-Command-Execution.html packetstormsecurity.com
- [debian-lts-announce] 20221010 [SECURITY] [DLA 3145-1] git security update lists.debian.org · mailing list
Source: the record CVE-2021-21300 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse