|
| 1 | +# Autonomous Bounty-Hunting Agent |
| 2 | + |
| 3 | +A fully autonomous multi-agent system that discovers open-source bounties, analyzes repos for security vulnerabilities, generates fixes with AI, and submits PRs. |
| 4 | + |
| 5 | +## Architecture |
| 6 | + |
| 7 | +``` |
| 8 | +┌─────────────────────────────────────────────────────────────┐ |
| 9 | +│ Orchestrator │ |
| 10 | +│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌────────────┐ │ |
| 11 | +│ │Discovery │→│ Audit │→│ Fix Gen │→│ Submit │ │ |
| 12 | +│ │ Agent │ │ Agent │ │ Agent │ │ Agent │ │ |
| 13 | +│ └──────────┘ └──────────┘ └──────────┘ └────────────┘ │ |
| 14 | +│ │ │ │ │ │ |
| 15 | +│ Algora/GH Semgrep+ AI Model GitHub API │ |
| 16 | +│ Issues Patterns (SiliconFlow) PR Submit │ |
| 17 | +└─────────────────────────────────────────────────────────────┘ |
| 18 | +``` |
| 19 | + |
| 20 | +## Multi-LLM Integration |
| 21 | + |
| 22 | +| Model | Provider | Role | |
| 23 | +|-------|----------|------| |
| 24 | +| GLM-4.1V-9B-Thinking | SiliconFlow | Vulnerability analysis & fix generation | |
| 25 | +| DeepSeek V4 Flash | DeepSeek | Code understanding & planning | |
| 26 | +| Semgrep (1,000+ rules) | Semgrep Inc | Static analysis & pattern matching | |
| 27 | + |
| 28 | +## Workflow |
| 29 | + |
| 30 | +``` |
| 31 | +discover() → audit() → analyze() → fix() → pr-report() |
| 32 | +
|
| 33 | +Phase 1: Discovery |
| 34 | + - Algora bounties → JSON scrape of open bounties |
| 35 | + - GitHub issues → Search for bounty-labeled issues |
| 36 | + - Security advisories → GHSA database (recent CVEs) |
| 37 | +
|
| 38 | +Phase 2: Security Audit |
| 39 | + - Semgrep scan → p/security-audit + p/owasp-top-ten |
| 40 | + - Pattern scan → 18+ security patterns (XSS, injection, creds) |
| 41 | + - Path traversal → File structure analysis |
| 42 | +
|
| 43 | +Phase 3: AI Fix Generation |
| 44 | + - Context extraction → Line-level code context |
| 45 | + - AI fix generation → GLM-4.1V with security-focused prompting |
| 46 | + - Validation → Syntax check + Semgrep re-scan |
| 47 | +
|
| 48 | +Phase 4: PR Submission |
| 49 | + - PR-ready report → Markdown with summary, findings, fixes |
| 50 | + - Git integration → Branch → Commit → Push → PR |
| 51 | +``` |
| 52 | + |
| 53 | +## Quick Start |
| 54 | + |
| 55 | +```bash |
| 56 | +# 1. Install dependencies |
| 57 | +npm install -g semgrep # or: pip install semgrep |
| 58 | + |
| 59 | +# 2. Set environment |
| 60 | +export GITHUB_TOKEN=ghp_... |
| 61 | +export SILICONFLOW_KEY=sk-... |
| 62 | + |
| 63 | +# 3. Run |
| 64 | +node agents/bounty-hunter/bounty-hunter.js discover |
| 65 | +node agents/bounty-hunter/bounty-hunter.js scan <org/repo> |
| 66 | +node agents/bounty-hunter/bounty-hunter.js pipeline |
| 67 | +node agents/bounty-hunter/bounty-hunter.js pr-report <report-file> |
| 68 | +``` |
| 69 | + |
| 70 | +## Example: Real Run |
| 71 | + |
| 72 | +This agent was tested on **SolFoundry/solfoundry** itself and found: |
| 73 | + |
| 74 | +| Severity | Count | Type | |
| 75 | +|----------|:-----:|------| |
| 76 | +| 🔴 Critical | 5 | GitHub Actions script injection | |
| 77 | +| 🟠 High | 10 | Hardcoded credentials | |
| 78 | +| 🟡 Medium | 10 | Nginx misconfigurations | |
| 79 | +| ℹ️ Info | 15 | Environment variable exposure | |
| 80 | + |
| 81 | +**Result:** Security PR submitted and wallet-linked (PR #1232). |
| 82 | + |
| 83 | +## Requirements |
| 84 | + |
| 85 | +- Node.js 18+ |
| 86 | +- Semgrep 1.60+ |
| 87 | +- GitHub CLI (`gh`) — authenticated |
| 88 | +- Python 3 (for Semgrep) |
| 89 | +- AI API key (SiliconFlow or compatible) |
| 90 | + |
| 91 | +## Future Enhancements |
| 92 | + |
| 93 | +- [ ] Multi-repo parallel scanning |
| 94 | +- [ ] Auto-submit PRs with AI-generated descriptions |
| 95 | +- [ ] CVE monitoring cron job (daily advisory poll) |
| 96 | +- [ ] Cross-platform support (Python, Go, Rust patterns) |
0 commit comments