GithubHelp home page GithubHelp logo

amalmurali47 / git_rce Goto Github PK

View Code? Open in Web Editor NEW
465.0 3.0 139.0 7 KB

Exploit PoC for CVE-2024-32002

Home Page: https://amalmurali.me/posts/git-rce

Shell 100.00%
cve-2024-32002 git proof-of-concept rce

git_rce's Introduction

CVE-2024-32002: Exploiting Git RCE via git clone

This repository contains a PoC for exploiting CVE-2024-32002, a vulnerability in Git that allows RCE during a git clone operation. By crafting repositories with submodules in a specific way, an attacker can exploit symlink handling on case-insensitive filesystems to write files into the .git/ directory, leading to the execution of malicious hooks.

Note: This PoC will only work in Windows or Mac systems.

Blog Post

For a detailed explanation of how this exploit was reversed, see the blog post: https://amalmurali.me/posts/git-rce.

How It Works

  1. A malicious repository (git_rce) includes a submodule with a specially crafted path.
  2. The submodule path uses a case variation that exploits the case-insensitive filesystem.
  3. The submodule includes a symlink pointing to its .git/ directory, which contains a malicious hook.
  4. When the repository is cloned, the symlink is followed, and the malicious hook is executed, leading to RCE.

Repository Structure

  • git_rce/ (this repository): The main repository containing the submodule.
  • amalmurali47/hook: The submodule repository containing the malicious hook.

Reproduction

โš ๏ธ Warning: Do not run this PoC on systems you do not own or do not have explicit permission to use. Unauthorized testing could result in unintended consequences.

git clone --recursive [email protected]:amalmurali47/git_rce.git

Note: On Windows, you may need to run the shell as administrator for this to work.

PoC execution on Windows

PoC execution on Mac

Exploit Script

The script used to create the PoC is included in this repository as create_poc.sh. The instructions for setting up the PoC on a GitHub repo are included in the blog post.

Disclaimer

This repository is for educational purposes only. The information provided here is intended to help developers understand the vulnerability and protect their systems. Do not use this exploit maliciously or without permission. Use of this PoC is at your own risk. The author is not responsible for any damages or legal issues that may arise from the use of this information.

Acknowledgments

Credit to filip-hejsek for discovering this vulnerability.

License

This project is licensed under the MIT License.

git_rce's People

Contributors

amalmurali47 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

git_rce's Issues

Failed to reproduce the vulnerability.

$ git clone --recursive [email protected]:amalmurali47/git_rce.git

Cloning into 'git_rce'...
remote: Enumerating objects: 35, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 35 (delta 0), reused 0 (delta 0), pack-reused 34
Receiving objects: 100% (35/35), 5.53 KiB | 5.53 MiB/s, done.
Resolving deltas: 100% (12/12), done.
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:

'a'
Submodule 'x/y' ([email protected]:amalmurali47/hook.git) registered for path 'A/modules/x'
fatal: could not create leading directories of 'D:/git_rce/A/modules/x': Not a directory
fatal: clone of '[email protected]:amalmurali47/hook.git' into submodule path 'D:/git_rce/A/modules/x' failed
Failed to clone 'A/modules/x'. Retry scheduled
fatal: could not create leading directories of 'D:/git_rce/A/modules/x': Not a directory
fatal: clone of '[email protected]:amalmurali47/hook.git' into submodule path 'D:/git_rce/A/modules/x' failed
Failed to clone 'A/modules/x' a second time, aborting

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.