mcpField
G
githacker-git-leak

githacker-git-leak

github.com/wgpsecSecurity1.8k45 installsUpdated 4d ago
Repository

About githacker-git-leak

GitHacker is a recovery skill for security audits of exposed .git directories. It can recover more than source files, including stashes, branches, tags, and reflog data for reviewing deleted content in repository history.

Key features

  1. 01Recover exposed Git repositories
  2. 02Recover stashes and reflog data
  3. 03Enumerate branches and tags
  4. 04Process single or batch targets

Use cases

  1. 01Audit a website with an exposed .git directory
  2. 02Review deleted credentials in repository history
  3. 03Recover repositories from multiple targets

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/wgpsec/aboutsecurity --skill githacker-git-leak

After installing, type/githacker-git-leakin Claude Code to confirm it loaded.

Details

From the project README

GitHacker .git 泄露利用

GitHacker 专注于 .git 目录泄露的完整恢复——不仅拿到源码,还能恢复 stash、所有分支/标签、reflog。开发者删过的密码和调试代码往往藏在这些地方。

项目地址:https://github.com/WangYihang/GitHacker

安装

pip install GitHacker
# 或(若团队内已分发 f8x CLI——WgpSec 内部工具集,本仓库不含其源码与安装方式):
# f8x -install githacker

基本用法

# 快速利用
githacker --url http://target/.git/ --output-folder result

# 暴力枚举分支/标签名(目标关闭目录列表时必须开启)
githacker --brute --url http://target/.git/ --output-folder result

# 批量目标(每行一个 URL)
githacker --brute --url-file websites.txt --output-folder result

Docker 用法(推荐)

远程 .git 目录可能被植入恶意内容(如 hooks 脚本),在 Docker 中运行更安全:

docker run -v $(pwd)/results:/tmp/githacker/results \
  wangyihang/githacker \
  --brute --output-folder /tmp/githacker/results \
  --url http://target/.git/

恢复后审计流程

GitHacker 恢复的目录是一个完整的 git 仓库,可以直接用 git 命令审计:

cd result/target/

# 1. 查看提交历史(重点找被删除的敏感信息)
git log --oneline --all
git log -p --all -S "password"
git log -p --all -S "secret"
git log -p --all -S "flag"

# 2. 查看所有分支(开发/测试分支常有敏感信息)
git branch -a
git checkout dev       # 切到开发分支看看

# 3. 查看 stash(开发者暂存的修改)
git stash list
git stash show -p stash@{0}

# 4. 查看 reflog(找到被 reset 掉的提交)
git reflog
git show <commit-hash>

# 5. 搜索凭据
grep -rn "password\|secret\|token\|api_key\|flag{" .

与其他工具对比

能力GitHackergit-dumperGitHack
源码恢复✅✅✅
Stash 恢复✅✅❌
所有分支✅(暴力枚举)❌❌
所有标签✅(暴力枚举)❌❌
Reflog✅✅❌
无目录列表✅✅✅

git-dumper 适合快速拿源码;GitHacker 的 --brute 模式能覆盖更多分支和标签,适合深度审计。

决策树

发现 /.git/HEAD 返回 200?
├─ 目录列表开启(200)→ githacker 直接利用
├─ 目录列表关闭(403)→ githacker --brute(暴力枚举分支/标签)
├─ 需要快速拿源码 → git-dumper 也行
└─ 多个目标批量扫 → githacker --url-file websites.txt

Comments

Markdown supported