Fazliddin2105/cve-hunter
GitHub: Fazliddin2105/cve-hunter
一个自主渗透测试平台,通过 20 个并行 AI Agent 和工具级验证实现零误报的全面漏洞扫描。
Stars: 0 | Forks: 0
CVE Hunter 是一个专业的自主渗透测试平台,它能够**并行部署 20 个专家级漏洞 agent**,每个 agent 都有自己的方法论、payload 和基于工具的验证。你只需提供一个域名 — 它就会生成一份经过验证的安全评估报告。
```
# 使用 AI 验证的完全自动化 pentest (Claude Opus 4.6):
cve-hunter target.com
# 相同的 pentest,不使用 AI — 工具自行验证(零 token 消耗):
cve-hunter target.com -n
```
就是这样。两条命令。其他一切都是自动的。
## 工作原理
```
┌─────────────────────────────────────────────────────────────────────┐
│ cve-hunter target.com │
└────────────────────────────────┬────────────────────────────────────┘
│
┌────────────▼────────────┐
│ PHASE 1: RECON │
│ subfinder + assetfinder│
│ httpx (live hosts) │
│ katana + gau (URLs) │
│ ffuf (directories) │
│ tech fingerprinting │
└────────────┬────────────┘
│
┌──────────────────────▼──────────────────────┐
│ PHASE 2: 20 AGENTS (PARALLEL) │
├─────────┬─────────┬─────────┬───────────────┤
│ SQLi │ XSS │ SSRF │ LFI/RCE │
│ IDOR │ SSTI │ XXE │ Auth Bypass │
│ CORS │ Race │ Misconf│ Open Redirect│
│ Info │ SubTkO │ ... │ │
└────┬────┴────┬────┴────┬────┴───────┬───────┘
│ │ │ │
┌────▼─────────▼─────────▼────────────▼───────┐
│ PHASE 3: TOOL VERIFICATION │
│ sqlmap confirms SQLi (not just pattern) │
│ dalfox confirms XSS (actual DOM execution) │
│ nuclei active templates (real exploitation) │
│ Response analysis (root: in /etc/passwd) │
└────────────────────┬────────────────────────┘
│
┌────────────────────▼────────────────────────┐
│ PHASE 4: AI VERIFICATION (optional) │
│ Each finding gets expert analysis │
│ False positives eliminated │
│ Severity classified with evidence │
│ Attack chains identified │
└────────────────────┬────────────────────────┘
│
┌────────────────────▼────────────────────────┐
│ PHASE 5: REPORT │
│ Markdown / PDF / JSON │
│ Only 100% verified findings │
│ PoC for each vulnerability │
│ CVSS 3.1 scoring │
└─────────────────────────────────────────────┘
```
## 核心功能
### 自主多 Agent 引擎
- **20个专家 agent** — 每个专门负责一类漏洞
- **并行执行** — 所有 agent 同时扫描 (ThreadPoolExecutor)
- 每个 agent 都有**专业方法论** — 不是通用的扫描器,而是针对性的专家 payload
- **安全不一致性方法** — 寻找开发者保护了一个 endpoint 但却遗漏了其同级 endpoint 的情况
### 零误报
- **基于工具的证明** — sqlmap 必须输出“存在漏洞”,而不仅仅是“可能存在”
- **基于证据** — LFI 需要在响应中看到 `root:x:0:0`,而不仅仅是一个 200 状态码
- **AI 复核**(可选) — Claude Opus 结合完整上下文分析每个发现
- **明确丢弃** — 如果某项发现未能通过验证,将作为已丢弃项报告并附带原因
### 兼容 AI 与无 AI 模式
| 模式 | 命令 | 验证 |
|------|---------|-------------|
| **AI 模式** | `cve-hunter target.com` | 工具 + 每个发现使用 Claude Opus 4.6 |
| **无 AI 模式** | `cve-hunter target.com -n` | 仅使用工具 — 零 token 消耗,依然准确 |
### 完整平台(不仅是自动扫描)
| 模式 | 命令 | 功能说明 |
|------|---------|-------------|
| **自动渗透测试** | `cve-hunter
` | 全面自主评估(20 个 agent) |
| **WebScan** | `webscan ` | 针对性的 Web 漏洞扫描 |
| **Recon** | `search`, `stats`, `host` | Shodan 侦察 + CVE 富化 |
| **Deps** | `deps ` | 项目依赖项中的已知 CVE (OSV.dev) |
| **Audit** | `audit ` | 源代码中的新 CVE 发现 |
| **Secrets** | `secrets ` | 硬编码凭证与 API key 检测 |
| **Hunt** | `hunt --verify` | 使用 nuclei 进行主动 CVE 确认 |
| **Exploit** | `exploit ` | 漏洞利用剧本生成器 |
| **Monitor** | `monitor` | 持续告警 (Telegram) |
## 安装说明
### 快速安装(推荐)
```
git clone https://github.com/YOUR_USERNAME/cve-hunter.git
cd cve-hunter
./install.sh
```
安装程序将会:
1. 创建一个 Python 虚拟环境
2. 安装所有依赖项
3. 安装外部安全工具(如果缺失)
4. 将 `cve-hunter` 添加到你的 PATH 中
5. 安装完成后立即可用
### 手动安装
```
git clone https://github.com/YOUR_USERNAME/cve-hunter.git
cd cve-hunter
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
pip install -e ".[full]" # includes AI + PDF support
```
### 外部工具(全面扫描所需)
自动渗透测试引擎使用这些工具。请根据需要安装:
```
# 子域名发现
go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
go install github.com/tomnomnom/assetfinder@latest
# HTTP 探测与爬取
go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest
go install -v github.com/projectdiscovery/katana/cmd/katana@latest
# URL 收集
go install github.com/lc/gau/v2/cmd/gau@latest
# Vulnerability 扫描
go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest
# XSS 扫描
go install github.com/hahwul/dalfox/v2@latest
# 目录 fuzzing
go install github.com/ffuf/ffuf/v2@latest
# SQL injection
pip install sqlmap
# Web 服务器扫描
sudo apt install nikto
```
## 配置说明
### API Key(可选)
创建 `~/.cve-hunter.yml`:
```
# Shodan(用于 recon/search/hunt 模式)
shodan_api_key: ""
# AI Backend — 选择一项:
# 选项 A:Amazon Bedrock(推荐)
bedrock_api_key: ""
aws_region: "us-east-1"
ai_model: "us.anthropic.claude-opus-4-6-v1"
# 选项 B:Direct Anthropic API
anthropic_api_key: ""
ai_model: "claude-opus-4-8"
# 可选的 enrichment
nvd_api_key: ""
vulners_api_key: ""
# Telegram 告警
telegram_bot_token: ""
telegram_chat_id: ""
```
### 无需任何 Key 即可使用的功能
| 功能 | 需求 |
|---------|----------|
| `cve-hunter target.com -n` | 无(仅限工具) |
| `cve-hunter target.com` | Bedrock 或 Anthropic key |
| `deps ` | 无 |
| `audit ` | 无(或用于排名的 AI key) |
| `secrets ` | 无 |
| `search` / `host` / `stats` | Shodan key |
## 20 个漏洞 Agent
每个 agent 都有其独特的:
- **System prompt** — 具备特定专业知识的职业渗透测试人员角色
- **方法论** — 去哪里寻找,匹配哪些模式,以及绕过技术
- **Payload** — 针对特定漏洞类别精心挑选
- **验证标准** — 什么才能构成证明(不仅仅是怀疑)
- **利用链升级** — 如何与其他发现结合以造成更大影响
| # | Agent | 侧重点 | 验证工具 |
|---|-------|-------|-------------------|
| 1 | **SQLi** | SQL injection(错误、盲注、时间、联合) | sqlmap |
| 2 | **XSS** | 跨站脚本攻击(反射型、存储型、DOM 型) | dalfox |
| 3 | **SSRF** | 服务器端请求伪造 | OOB callback |
| 4 | **LFI** | 本地文件包含 / 路径遍历 | 响应中包含 `root:` |
| 5 | **RCE** | 远程代码执行 | 命令输出证据 |
| 6 | **IDOR** | 不安全的直接对象引用 | 获取其他用户数据 |
| 7 | **Auth Bypass** | 身份验证/授权缺陷 | 无需凭证即可访问 |
| 8 | **Info Disclosure** | 敏感数据泄露 | 响应中包含 PII/凭证 |
| 9 | **CORS** | 跨域配置错误 | 反射的 Origin 标头 |
| 10 | **SSTI** | 服务器端模板注入 | 数学表达式结果 |
| 11 | **Open Redirect** | 未经验证的重定向 | 外部重定向证明 |
| 12 | **XXE** | XML 外部实体注入 | 文件内容或 OOB |
| 13 | **Subdomain Takeover** | 悬挂的 DNS 记录 | 指向未声明服务的 CNAME |
| 14 | **Misconfig** | 服务器/框架配置错误 | 暴露的调试/管理面板 |
| 15 | **Race Condition** | TOCTOU / 并发缺陷 | 重复操作证明 |
| 16 | **Crypto Failure** | 弱加密,明文传输 (A02:2025) | 破解的 hash / 无 HTTPS 证明 |
| 17 | **Insecure Design** | 业务逻辑,速率限制 (A04:2025) | 约束绕过证明 |
| 18 | **Vuln Components** | 带有已知 CVE 的过时库 (A06:2025) | 版本 + 公开 exploit |
| 19 | **Data Integrity** | 反序列化,CSRF,CI/CD (A08:2025) | RCE / 接受伪造的 token |
| 20 | **Logging Gaps** | 暴露的日志,无速率限制 (A09:2025) | 日志中的敏感数据 |
### OWASP Top 10 覆盖矩阵
| OWASP 2021/2025 | 类别 | Agent(s) | 状态 |
|-----------------|----------|----------|--------|
| **A01** | 访问控制失效 | `idor`, `auth_bypass` | 已覆盖 |
| **A02** | 加密机制失效 | `crypto_failure` | 已覆盖 |
| **A03** | 注入 | `sqli`, `xss`, `ssti`, `rce`, `xxe` | 已覆盖 |
| **A04** | 不安全设计 | `insecure_design` | 已覆盖 |
| **A05** | 安全配置错误 | `misconfig`, `cors` | 已覆盖 |
| **A06** | 自带缺陷和过时的组件 | `vuln_components` | 已覆盖 |
| **A07** | 身份识别和认证失效 | `auth_bypass` | 已覆盖 |
| **A08** | 软件和数据完整性故障 | `data_integrity` | 已覆盖 |
| **A09** | 安全日志和监控失效 | `security_logging` | 已覆盖 |
| **A10** | SSRF | `ssrf` | 已覆盖 |
## 方法论
### 安全不一致性方法(核心技术)
发现真实漏洞最有效的方法不是随机 fuzzing — 而是寻找开发者在保护了一个代码路径的同时却忘记了其同级路径的情况:
```
GET /api/v1/users/{id} → authorization check ✓
GET /api/v1/users/{id}/docs → NO authorization ← vulnerability here
```
每个 agent 都会在其领域内寻找这种模式:
- SQLi agent:一个 handler 中使用参数化查询,另一个中却使用字符串拼接
- Auth agent:在 `/api/users` 上有 token 验证,但在 `/api/admin` 上却没有
- LFI agent:在文件上传时进行了路径清理,但在文件预览时却没有
### 漏洞利用链
低严重性的发现会自动检查其利用链潜力:
```
XSS (Medium) + CSRF (Low) = Account Takeover (Critical)
SSRF (Medium) + Cloud Metadata = Credential Theft (Critical)
Path Traversal (High) + File Write = RCE (Critical)
Open Redirect (Low) + OAuth = Token Theft (High)
```
## 使用示例
### 基础自主渗透测试
```
# 带 AI 的全面扫描(需要在 config 中提供 Bedrock/Anthropic key):
cve-hunter example.com
# 不带 AI 的全面扫描(工具自行验证一切):
cve-hunter example.com -n
# 输出会自动保存到 ./reports/auto/
```
### WebScan(针对性扫描)
```
cve-hunter webscan target.com # Full pipeline
cve-hunter webscan target.com --fast # Skip slow stages
cve-hunter webscan target.com --ai --md out.md # AI summary
```
### 源代码审计
```
cve-hunter audit ./source-code # Find new CVEs
cve-hunter audit ./source-code --ai # AI ranks findings
cve-hunter audit ./source-code --since HEAD~10 # Recent changes only
```
### Shodan 侦察
```
cve-hunter search 'apache 2.4.49' --min-cvss 9 --auto
cve-hunter host 203.0.113.5 --auto
cve-hunter stats 'country:US port:443 has_vuln:true'
```
### 依赖项扫描
```
cve-hunter deps ./my-project # Scans package files automatically
cve-hunter secrets ./my-project # Finds hardcoded keys
```
## 输出结果
报告将保存至 `./reports/auto/`,格式如下:
```
pentest__.md
```
### 报告结构
```
# Penetration Test 报告 — target.com
**Date:** 2026-07-20 10:00 → 10:45
**Methodology:** Automated multi-agent (20 specialist agents)
**Verified Findings:** 3
## Recon 摘要
- Subdomains: 12
- Live hosts: 8
- URLs discovered: 342
- Parameterized URLs: 89
## 已验证的 Findings
### 1. [CRITICAL] SQL Injection(sqlmap 已确认)
**Class:** SQLI
**Target:** https://target.com/api/search?q=test
**Tool:** sqlmap
**Evidence:** Parameter 'q' is vulnerable (time-based blind)
**Verified by:** tool-confirmed + AI analysis
### 2. [HIGH] Profile Bio 中的 Stored XSS
**Class:** XSS
**Target:** https://target.com/profile/edit
**Tool:** dalfox
**Evidence:** Payload executed in victim context
**Verified by:** tool-confirmed
```
## 架构
```
cve_hunter/
├── cli.py # CLI entry point & argument routing
├── auto_pentest.py # Autonomous multi-agent engine (core)
├── methodology_kb.py # Professional methodology knowledge base
├── ai/
│ ├── client.py # AI backend (Anthropic / Bedrock)
│ ├── analyst.py # AI analysis & triage
│ └── deep_analyst.py # Deep vulnerability analysis
├── webscan/
│ ├── pipeline.py # WebScan orchestration
│ └── tools.py # External tool wrappers (nuclei, sqlmap, etc.)
├── audit/
│ ├── grep_audit.py # Source code security audit
│ └── secrets.py # Secret detection
├── bounty/
│ ├── runner.py # Bug bounty campaign runner
│ ├── methodology.py # Bounty methodology framework
│ └── profiles.py # Target profiles
├── enrichers/
│ ├── nvd.py # NVD CVE data
│ ├── kev.py # CISA Known Exploited Vulnerabilities
│ ├── epss.py # Exploitation Prediction Scoring
│ └── vulners.py # Exploit availability
├── exploit/
│ └── planner.py # Exploitation playbook generator
├── hunt/
│ └── nuclei.py # Active CVE verification
├── output/
│ ├── pdf_out.py # PDF report generation
│ ├── html_out.py # HTML interactive reports
│ ├── md_out.py # Markdown output
│ ├── json_out.py # JSON export
│ └── csv_out.py # CSV export
├── config.py # Configuration management
├── knowledge.py # Vulnerability playbooks
├── presets.py # 177 Shodan query presets
├── monitor.py # Continuous monitoring
├── retry.py # Retry logic with backoff
└── shodan_hunter.py # Shodan API interface
```
## CVE 富化与优先级评分
通过 Shodan 找到的每个 CVE 都会从 4 个独立来源进行数据富化:
| 来源 | 添加的数据 | 免费 |
|--------|-----------|------|
| **NVD 2.0** | CVSS、CWE、描述 | 是 |
| **CISA KEV** | 正在被利用的标志 | 是 |
| **FIRST EPSS** | 30 天被利用概率 | 是 |
| **Vulners** | Exploit-DB、Metasploit、nuclei 模板 | 需要 Key(免费) |
**优先级评分公式:**
```
priority = CVSS
+ 3.0 (if CISA KEV — actively exploited)
+ 1.5 (if used by ransomware)
+ 2.0 × EPSS probability
+ 0.5 (if public exploit exists)
```
## 范围与授权
### 自动渗透测试模式
当你运行 `cve-hunter target.com` 时,它将对指定的域名执行**主动测试**。仅在你拥有或已获得书面授权的目标上使用。
### 被动侦察
Shodan 模式(`search`, `stats`, `host`)仅查询预先收集的数据 — 不会向目标发送任何数据包。
### 主动测试(范围受限)
`hunt --verify` 和 `exploit` 需要明确的范围授权:
```
cve-hunter hunt --preset critical-apache --scope authorized.txt --verify
```
`authorized.txt` 格式:
```
203.0.113.0/24
198.51.100.9
.target.com
```
## 免责声明
此工具专为**授权的安全测试**而设计。用户需对以下事项负责:
- 在测试任何目标之前获得适当的授权
- 遵守所有适用的法律和法规
- 负责任地使用测试结果并向资产所有者报告
对于滥用此工具所造成的后果,作者不承担任何责任。
## 许可证
MIT 许可证 — 详情请参阅 [LICENSE](LICENSE)。标签:AI智能体, CISA项目, OWASP Top 10, Python, 无后门, 日志审计, 逆向工具