Autonomous penetration testing platform that finds real vulnerabilities, exploits them, generates patches, and opens PRs with proofβall running in E2B cloud sandboxes.
β No Docker Required β Runs on macOS 12+, Windows, Linux β E2B Cloud Sandboxes β All security scans execute remotely β GitHub Integration β Import repos and auto-generate security PRs β Enterprise Dashboard β Modern React UI with FastAPI backend
- Automated Reconnaissance: Parallel nmap, nikto, gobuster scans
- AI-Powered Analysis: xAI Grok detects vulnerabilities from scan output
- Real Exploitation: Validates findings with sqlmap, custom exploits
- Auto-Patching: Generates secure code fixes with LLM
- PR Creation: Opens GitHub PRs with proof-of-concept and patches
- Live Dashboard: Monitor scans, view vulnerabilities, track patches
- Python 3.9+
- Node.js 18+ (for dashboard frontend)
- E2B API key (sign up free)
- xAI API key (get from x.ai)
- PostgreSQL database (or Neon serverless)
git clone https://github.com/yourusername/autocTF.git
cd autocTFCreate .env file with required API keys:
# Required for pentesting
E2B_API_KEY=e2b_your_key_here
XAI_API_KEY=xai-your_key_here
DATABASE_URL=postgresql://user:pass@host/db
# Optional for PR creation
GITHUB_TOKEN=ghp_your_token_here
GITHUB_REPO=yourusername/your-repo
# Optional for screenshots
BROWSERBASE_API_KEY=bb_live_your_key
BROWSERBASE_PROJECT_ID=your_project_idGet API Keys:
- E2B: https://e2b.dev/dashboard (100 hours/month free)
- xAI: https://x.ai (sign up for API access)
- GitHub: https://github.com/settings/tokens (repo, workflow scopes)
- Neon DB: https://neon.tech (free serverless PostgreSQL)
# Backend dependencies
pip install -r requirements.txt
cd dashboard/backend && pip install -r requirements.txt
# Frontend dependencies
cd ../frontend && npm install
cd ../..# Starts both backend (port 8000) and frontend (port 3000)
./start-dashboard.shAccess:
- Dashboard UI: http://localhost:3000
- API Docs: http://localhost:8000/docs
- Open http://localhost:3000
- Go to Targets β Add Target β From GitHub
- Paste repo URL:
https://github.com/OWASP/WebGoat - Click Import from GitHub
- Click Start Scan on the imported target
- Monitor progress in Scans page
- View findings in Vulnerabilities page
# Quick 2-minute demo
./demo_script.sh
# Or run agent directly
python3 agent/main.py
# Enter target URL when prompted# Import GitHub repository
curl -X POST http://localhost:8000/api/targets/from-github \
-H "Content-Type: application/json" \
-d '{"github_url": "https://github.com/digininja/DVWA"}'
# Start pentest scan
curl -X POST http://localhost:8000/api/targets/{id}/scan
# Check scan status
curl http://localhost:8000/api/runs/{run_id}
# List vulnerabilities
curl http://localhost:8000/api/vulnerabilitiesAutoCTF/
βββ agent/ # Autonomous pentest pipeline
β βββ main.py # Orchestrator: recon β analyze β exploit β patch β PR
β βββ recon.py # Parallel nmap, nikto, gobuster via E2B
β βββ analyze.py # LLM vulnerability detection (xAI Grok)
β βββ exploit.py # SQLi, XSS, command injection exploits
β βββ patcher.py # LLM-generated security patches
β βββ reporter.py # Markdown reports + GitHub PR creation
β
βββ dashboard/
β βββ backend/ # FastAPI REST API
β β βββ main.py # API endpoints (targets, scans, vulns)
β β βββ models.py # SQLAlchemy database models
β β βββ pentest_worker.py # Background scan execution
β β βββ github_utils.py # GitHub repo import logic
β β
β βββ frontend/ # React + TailwindCSS dashboard
β βββ src/pages/ # Dashboard, Targets, Scans, Vulnerabilities
β βββ src/components/# Reusable UI components
β
βββ mcp/ # Model Context Protocol clients
β βββ exec_client.py # E2B sandbox command execution
β βββ browserbase_client.py # Screenshot capture
β βββ github_client.py # PR creation with PyGithub
β
βββ sandbox_manager.py # E2B cloud sandbox lifecycle manager
βββ startup_validation.py # Health checks for all services
| Variable | Required | Description |
|---|---|---|
E2B_API_KEY |
β Yes | E2B sandbox API key |
XAI_API_KEY |
β Yes | xAI Grok LLM API key |
DATABASE_URL |
β Yes | PostgreSQL connection string |
GITHUB_TOKEN |
For PR creation (repo scope) | |
GITHUB_REPO |
Target repo (owner/name) | |
BROWSERBASE_API_KEY |
For screenshots | |
BROWSERBASE_PROJECT_ID |
Browserbase project | |
OPENAI_API_KEY |
Alternative LLM |
- Sign up at https://neon.tech
- Create new project
- Copy connection string
- Add to
.env:
DATABASE_URL=postgresql://user:[email protected]/neondb?sslmode=requireImportant: AutoCTF scans live web applications, not just code repositories. For testing with WebGoat:
# Option 1: Docker
git clone https://github.com/WebGoat/WebGoat.git
cd WebGoat
docker-compose up -d
# Wait 30 seconds for startup
sleep 30
curl http://localhost:8080/WebGoat/ # Should return HTML
# Option 2: Java JAR
wget https://github.com/WebGoat/WebGoat/releases/download/v2023.8/webgoat-2023.8.jar
java -jar webgoat-2023.8.jar --server.port=8080# Create target with correct port
curl -X POST http://localhost:8000/api/targets \
-H "Content-Type: application/json" \
-d '{
"name": "WebGoat Live",
"url": "http://localhost:8080"
}'
# Start scan
curl -X POST http://localhost:8000/api/targets/{id}/scanCommon Issue: Scanning http://localhost:3000 (dashboard UI) instead of http://localhost:8080 (WebGoat server) will return 0 vulnerabilities because the target isn't running.
# Check if port 8000 is already in use
lsof -i :8000
kill -9 $(lsof -ti :8000)
# Restart backend
cd dashboard/backend
python3 main.py# Verify API key is set
python3 -c "import os; from dotenv import load_dotenv; load_dotenv(); print('E2B_API_KEY:', os.getenv('E2B_API_KEY')[:20])"
# Test sandbox creation
python3 sandbox_manager.py- Ensure token has
repoandworkflowscopes - Token format:
ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Get from: https://github.com/settings/tokens
# Test Neon connection
psql "$DATABASE_URL" -c "SELECT version();"
# Check connection string format
# Should be: postgresql://user:[email protected]/db?sslmode=require- E2B Migration Guide: See
E2B_CLOUD_MIGRATION.mdfor Docker-free setup details - API Documentation: http://localhost:8000/docs (when backend is running)
- Project Instructions: See
CLAUDE.mdfor development guidelines
-
Import Repository Paste
https://github.com/digininja/DVWAin dashboard -
Start Scan AutoCTF clones repo in E2B sandbox and analyzes code
-
Recon Phase If live URL provided, runs nmap, nikto, gobuster
-
Analysis xAI Grok analyzes scan output and identifies vulnerabilities
-
Exploitation Validates findings (e.g., SQLi with sqlmap)
-
Patching Generates secure code fixes with LLM
-
PR Creation Opens GitHub PR with proof + patches (if
GITHUB_TOKENset)
- E2B Cloud: All scans run in isolated cloud sandboxes
- No Local Docker: No container runtime needed on your machine
- API Keys: Keep
.envfile secure, never commit to git - Rate Limits: E2B free tier = 100 hours/month
- Target Authorization: Only scan systems you own or have permission to test
- OS: macOS 12+, Windows 10+, Linux (Ubuntu 20.04+)
- Python: 3.9 or higher
- Node.js: 18 or higher (for dashboard)
- RAM: 2GB minimum, 4GB recommended
- Network: Stable internet (E2B cloud access)
Issues and PRs welcome! Please ensure:
- Code follows existing patterns
- Tests pass before submitting
- Environment variables are documented
MIT License - See LICENSE file for details
- E2B - Cloud sandbox infrastructure
- xAI - Grok LLM for vulnerability analysis
- OWASP - WebGoat and DVWA test applications
- PyGithub - GitHub API integration
- E2B Dashboard: https://e2b.dev/dashboard
- xAI Platform: https://x.ai
- Neon Database: https://neon.tech
- GitHub Tokens: https://github.com/settings/tokens
Built for security researchers, penetration testers, and DevSecOps teams.