Cybertechhacks/PentestPilot
GitHub: Cybertechhacks/PentestPilot
一款用 Go 构建的自动化渗透测试 CLI 工具,集成 18 个安全测试模块与漏洞链式利用引擎,为 Web 和移动应用的授权安全测试提供从信息收集到 CVSS 评分报告的完整流水线。
Stars: 0 | Forks: 0
# PentestPilot
**自动化渗透测试 CLI 工具** — 用于漏洞赏金狩猎和移动/ Web 应用程序渗透测试的自主攻击性安全代理。
```
______ _ _ _ _ _
| ___ \ | | | | (_) | | |
| |_/ /__ _ __ | |_ ___ ___| |_ _ __ _| | ___ | |_
| __/ _ \ '_ \| __/ _ \/ __| __| | '_ \| | |/ _ \| __|
| | | __/ | | | || __/\__ \ |_ | |_) | | | (_) | |_
\_| \___|_| |_|\__\___||___/\__| | .__/|_|_|\___/ \__|
| |
|_|
```
## 功能
### 信息收集
- 技术指纹识别(服务器、框架、语言)
- WAF 检测和指纹识别(Cloudflare、Sucuri、AWS WAF 等)
- Spring Boot actuator 检测
- GraphQL endpoint 检测
- TLS/SSL 证书分析
- 安全标头分析
- API 规范发现(OpenAPI/Swagger)
### Endpoint 发现
- JavaScript bundle 分析(React、Angular、Vue 路由提取)
- HTML 链接/表单提取
- 目录暴力破解(使用 wordlists)
- 隐藏参数发现
- GraphQL schema 枚举(自省 + 验证错误泄露)
### 安全测试(18 个模块)
| 模块 | 描述 |
|--------|-------------|
| BOLA/IDOR(Auth 感知) | 损坏的对象级别授权,包含 UUID/数字 IDOR 和响应差异对比 |
| BFLA | 损坏的函数级别授权(admin endpoint 访问) |
| CORS | 跨域错误配置(凭证反射、null origin) |
| Security Headers | 缺失 HSTS、CSP、X-Frame-Options 等 |
| JWT 分析 | 算法混淆、密钥强度、token 结构 |
| SQL 注入 | 基于联合查询、基于错误、基于时间盲注 |
| NoSQL 注入 | MongoDB 运算符($ne、$regex、$where、$gt、$exists) |
| 反射型 XSS | 事件处理器、模板注入、表达式语言 |
| SSTI | Jinja2/Twig、FreeMarker、ERB、Ruby/Sinatra 模板注入 |
| SSRF | AWS/GCP/Azure 元数据、内部服务访问 |
| 命令注入 | OS 命令执行、管道运算符 |
| 路径遍历 | 目录遍历、LFI/RFI |
| 存储型 XSS | 字段级存储型 XSS 测试 |
| CSV/Excel 注入 | 公式注入 payload(10 种类型) |
| 业务逻辑 | 价格操纵、优惠券滥用、状态混淆、批量赋值 |
| CSRF | 结合 CORS 验证的跨站请求伪造 |
| HTTP Request 走私 | CL.TE 和 TE.CL 变体 |
| 文件上传滥用 | MIME 混淆、polyglot 上传、路径遍历、Zip Slip |
### 附加测试
- 速率限制检测
- 竞争条件测试
- 漏洞链式利用引擎(XSS→ATO、SSRF→RCE、逻辑+IDOR 等)
- 云存储扫描(S3、Azure Blob、GCP Bucket)
- 隐藏参数发现
### 报告
- Markdown 报告
- HTML 报告(样式化、专业)
- JSON 报告(机器可读)
- 带有正确公式的 CVSS v3.1 评分
## 安装
### 从源码安装
```
git clone https://github.com/user/pentestpilot.git
cd pentestpilot
go build -o pentestpilot .
```
### 二进制文件下载
从 [Releases](https://github.com/user/pentestpilot/releases) 页面下载最新版本。
## 使用说明
### 全面扫描
```
# 未认证扫描
./pentestpilot scan https://target.com
# 认证扫描(使用 JWT token)
./pentestpilot scan https://target.com -t "eyJhbGciOi..."
# 带有目录 brute-force 的深度扫描
./pentestpilot scan https://target.com --deep
# 自定义输出和并发
./pentestpilot scan https://target.com -o ./output -f md,html,json -c 5 -r 5
```
### 单个命令
```
# 仅 Reconnaissance
./pentestpilot recon https://target.com
# 仅 Endpoint discovery
./pentestpilot discover https://target.com --deep
# 仅 Security testing(需要预先 discover)
./pentestpilot test https://target.com -t "your-jwt-token"
# Cloud storage 扫描
./pentestpilot cloud https://target.com
# Hidden parameter discovery
./pentestpilot params https://target.com
```
### CLI 选项
```
Flags:
-t, --token string Authentication token (JWT)
-m, --mode string Scan mode: unauthenticated, authenticated, full (default "full")
-o, --output string Output directory (default "./pentest-output")
-f, --format string Output format: md,html,json (default "md,html,json")
-c, --concurrency int Concurrent requests (default 10)
-r, --rate-limit int Requests per second (default 10)
-T, --timeout int Request timeout in seconds (default 30)
--spec string OpenAPI/Swagger spec file path
--proxy string HTTP proxy URL (e.g., http://127.0.0.1:8080)
--deep Enable deep scan (directory brute-force)
```
## 架构
```
pentestpilot/
├── main.go # Entry point
├── cmd/
│ └── root.go # CLI commands (scan, recon, discover, test, cloud, params)
│ └── scan.go # Full scan pipeline orchestration
├── pkg/
│ ├── httpclient/ # WAF-aware HTTP client with fingerprinting
│ │ ├── client.go # HTTP client with rate limiting, retry, stats
│ │ └── waf.go # WAF detection and bypass techniques
│ ├── fingerprint/ # Technology detection
│ │ └── fingerprint.go # Server, WAF, actuator, GraphQL, TLS detection
│ ├── recon/ # Endpoint discovery
│ │ └── recon.go # JS bundles, HTML extraction, dir brute, spec loader
│ ├── jsparse/ # JavaScript analysis
│ │ └── analyzer.go # Route/endpoint extraction from JS bundles
│ ├── graphql/ # GraphQL testing
│ │ └── graphql.go # Introspection, schema leakage, batching, depth
│ ├── testing/ # Security test modules
│ │ ├── testing.go # BOLA, CORS, headers, JWT, injection, race, rate limit
│ │ ├── bola_v2.go # Auth-aware BOLA/BFLA with SPA detection
│ │ ├── logic.go # Business logic flaws
│ │ ├── stored.go # Stored XSS, CSV injection
│ │ ├── cmdi.go # Command injection, path traversal, LFI
│ │ ├── csrf.go # CSRF with CORS validation
│ │ ├── smuggling.go # HTTP request smuggling (CL.TE, TE.CL)
│ │ ├── upload.go # File upload abuse, MIME confusion, Zip Slip
│ │ └── chain.go # Vulnerability chaining engine
│ ├── cloud/ # Cloud storage scanning
│ │ └── cloud.go # S3, Azure Blob, GCP Bucket detection
│ ├── params/ # Hidden parameter discovery
│ │ └── discovery.go # Parameter fuzzing and discovery
│ ├── cvss/ # CVSS scoring
│ │ └── scorer.go # CVSS v3.1 calculator with proper formulas
│ ├── report/ # Report generation
│ │ └── generator.go # MD, HTML, JSON report output
│ └── models/ # Data models
│ └── models.go # Finding, Endpoint, ScanContext, etc.
└── wordlists/ # Default wordlists for dir brute-force
```
## 扫描管道
```
Phase 1: Reconnaissance
└─ Fingerprint → WAF detect → Tech detection → Actuator/GraphQL probe
Phase 2: Endpoint Discovery
└─ JS bundle extraction → HTML extraction → Dir brute-force → GraphQL schema
Phase 3: Security Testing (18 modules)
└─ BOLA → CORS → Headers → JWT → Injection → CMDi → Stored →
Logic → CSRF → Smuggling → Rate limit → Race → Upload → Chain analysis
Phase 4: Cloud Storage Scan
└─ S3 buckets → Azure Blob → GCP Bucket
Phase 5: Hidden Parameter Discovery
└─ Parameter fuzzing on discovered endpoints
Phase 6: Report Generation
└─ MD + HTML + JSON reports with CVSS scoring
```
## 误报缓解
PentestPilot 包含多项防误报措施:
- **SPA HTML Shell 检测**:跳过返回应用程序 shell 的 React/Vue/Angular 全匹配路由
- **JS Bundle 数字排除**:忽略 JS 文件名中的数字(例如,`main.49c21659.js`)
- **Payload 回显检测**:当 payload 反射在错误页面中时跳过结果
- **通用错误页面检测**:过滤掉通用的服务器错误页面
- **SQL/MongoDB 特定错误检查**:需要实际的数据库错误字符串,而不仅仅是关键字
- **重定向响应过滤**:跳过针对重定向响应(3xx)的结果
## 示例
### 查找 BFLA
```
[!] CRITICAL (CVSS: 9.8) Broken Function Level Authorization (BFLA)
URL: https://target.com/admin/users
Impact: Attacker can access admin functionality and data
```
### 查找 GraphQL Schema 泄露
```
[!] HIGH (CVSS: 7.5) GraphQL Schema Leaks via Validation Errors
Queries/Fields: users, organizations, invoices, roles
Types: UserType, PaginatedUsersType
Arguments: page, limit
```
### 查找 SSRF
```
[!] CRITICAL (CVSS: 9.8) Server-Side Request Forgery (SSRF)
Via: url parameter
Impact: Access to AWS metadata, internal services
```
## 免责声明
此工具仅供授权的安全测试使用。在对您不拥有的任何系统进行测试之前,请务必获得适当的授权。对于滥用此软件造成的后果,作者概不负责。
## 许可证
MIT 许可证 - 有关详细信息,请参阅 [LICENSE](LICENSE)。
## 构建技术
- [Go](https://golang.org/) - 语言
- [Cobra](https://github.com/spf13/cobra) - CLI 框架
- 仅使用标准库 - 除了 CLI 框架外无其他外部依赖项
标签:EVTX分析, 日志审计