# CVE-2021-21300: malicious repositories can execute remote code while cloning

> Attackers can execute arbitrary code by cloning malicious repositories with symbolic links and clean/smudge filters on case-insensitive file systems.

- **Severity:** High 8.0 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 9 Mar 2021
- **Updated:** 3 Aug 2024
- **Also known as:** ALPINE-CVE-2021-21300, CLEANSTART-2026-PC25111, DEBIAN-CVE-2021-21300, GHSA-8prw-h3cq-mghm, MGASA-2021-0137, OESA-2021-1105, SUSE-SU-2021:0756-1, SUSE-SU-2021:0757-1, SUSE-SU-2021:2555-1, UBUNTU-CVE-2021-21300, USN-4761-1, openSUSE-SU-2021:0405-1, openSUSE-SU-2021:2555-1, openSUSE-SU-2024:10787-1

## What is CVE-2021-21300?

CVE-2021-21300 is a high-severity code injection vulnerability in Apple Xcode, published on 9 Mar 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official 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.

Weakness: CWE-59 (Improper Link Resolution Before File Access)

## Which versions are affected by CVE-2021-21300?

It affects 4 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `git` | SUSE:Enterprise Storage 6 | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:HPE Helion OpenStack 8 | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15-ESPOS | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Linux Enterprise High Performance Computing 15-LTSS | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Linux Enterprise Module for Basesystem 15 SP2 | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Linux Enterprise Module for Basesystem 15 SP3 | All versions | 2.31.1-10.3.1 |
| `git` | SUSE:Linux Enterprise Module for Development Tools 15 SP2 | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Linux Enterprise Module for Development Tools 15 SP3 | All versions | 2.31.1-10.3.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP2-BCL | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP2-LTSS | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP3-BCL | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP3-LTSS | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP4-LTSS | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Linux Enterprise Server 12 SP5 | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Linux Enterprise Server 15 SP1-BCL | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Linux Enterprise Server 15 SP1-LTSS | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Linux Enterprise Server 15-LTSS | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 12 SP2 | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 12 SP3 | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 12 SP4 | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 15 | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Linux Enterprise Server for SAP Applications 15 SP1 | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Linux Enterprise Software Development Kit 12 SP5 | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:Manager Proxy 4.0 | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Manager Retail Branch Server 4.0 | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:Manager Server 4.0 | All versions | 2.26.2-3.31.1 |
| `git` | SUSE:OpenStack Cloud 7 | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:OpenStack Cloud 8 | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:OpenStack Cloud 9 | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:OpenStack Cloud Crowbar 8 | All versions | 2.26.2-27.43.1 |
| `git` | SUSE:OpenStack Cloud Crowbar 9 | All versions | 2.26.2-27.43.1 |
| `git` | openSUSE:Leap 15.2 | All versions | 2.26.2-lp152.2.6.1 |
| `git` | openSUSE:Leap 15.3 | All versions | 2.31.1-10.3.1 |
| `git-annex` | openSUSE:Tumbleweed | All versions | 8.20210903-1.2 |

Products: Apple Xcode, Debian Debian Linux, Fedoraproject Fedora, Git-Scm Git.

## How do I fix CVE-2021-21300?

Upgrade to a fixed version.

## Is CVE-2021-21300 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-21300 exists.

Public exploit code:

- https://github.com/Maskhe/CVE-2021-21300 (github_poc): https://github.com/Maskhe/CVE-2021-21300
- https://github.com/AlkenePan/CVE-2021-21300 (github_poc): https://github.com/AlkenePan/CVE-2021-21300
- https://github.com/Faisal78123/CVE-2021-21300 (github_poc): https://github.com/Faisal78123/CVE-2021-21300
- https://github.com/erranfenech/CVE-2021-21300 (github_poc): https://github.com/erranfenech/CVE-2021-21300
- remote code exec for git (github_poc): https://github.com/1uanWu/CVE-2021-21300
- https://github.com/Kirill89/CVE-2021-21300 (github_poc): https://github.com/Kirill89/CVE-2021-21300

## Other vulnerabilities in Apple Xcode

- [CVE-2025-48384](https://insights.sbomify.com/CVE-2025-48384/): Git Link Following (high 8.1, exploited in the wild)
- [CVE-2014-9390](https://insights.sbomify.com/CVE-2014-9390/): JGit Improper Input Validation vulnerability (critical 9.8)
- [CVE-2019-14379](https://insights.sbomify.com/CVE-2019-14379/): Deserialization of untrusted data in FasterXML jackson-databind (critical 9.8)
- [CVE-2018-4164](https://insights.sbomify.com/CVE-2018-4164/): An issue was discovered in certain Apple products. (critical 9.8)
- [CVE-2016-0746](https://insights.sbomify.com/CVE-2016-0746/): Use after free in n/a (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-21300 and fix it if it is affected.

What it is: CVE-2021-21300 is a high-severity code injection vulnerability in Apple Xcode, published on 9 Mar 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-21300 exists.

Affected product: Apple Xcode. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-21300/ (Markdown: https://insights.sbomify.com/CVE-2021-21300/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-21300
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-21300
- OSV: https://osv.dev/vulnerability/CVE-2021-21300

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-21300/
Summaries are generated and may contain mistakes; the official description above is the record.
