war1234/bug-bounty-hunter
0
๐ Bug Bounty Hunter โ OpenEnv
An RL environment where AI agents learn to act as security researchers.
The agent receives production-style vulnerable Python code and must:
- Identify the vulnerability type (SQLi, IDOR, Insecure Deserialization...)
- Classify severity (Low / Medium / High / Critical)
- Write a fix for the vulnerable code
- Explain the issue to a non-technical stakeholder
API Endpoints
Quick Start (Python)
import requests
BASE = "https://Daksh-agarwal-bug-bounty-hunter.hf.space"
# Start episode
obs = requests.post(f"{BASE}/reset").json()["observation"]
print(obs["code_snippet"])
# Submit answer
action = {
"vuln_type": "sql_injection",
"severity": "critical",
"fixed_code": "cursor.execute('SELECT * FROM users WHERE username = ?', (username,))",
"explanation": "SQL injection via parameterized queries..."
}
result = requests.post(f"{BASE}/step", json=action).json()
print(f"Reward: {result['reward']}")Reward Function
reward = 0.35 ร vuln_identified
+ 0.25 ร severity_correct
+ 0.30 ร fix_quality
+ 0.10 ร explanation_qualityRange: [0.0, 1.0] โ partial credit at every dimension.
Challenges
Setup & Run Locally
Prerequisites
- Python 3.10+
- Docker Desktop
Option 1 โ Run with Docker
git clone https://github.com/Dakshh-Agarwal/bug-bounty-hunter.git
cd bug-bounty-hunter
docker build -t bug-bounty-hunter .
docker run -p 7860:7860 bug-bounty-hunterVisit http://localhost:7860/docs to explore the API.
Option 2 โ Run without Docker
pip install -r server/requirements.txt
uvicorn bug_bounty_env.server.app:app --host 0.0.0.0 --port 7860Run the Inference Agent
pip install openai requests
export API_BASE_URL=https://api-inference.huggingface.co/v1
export MODEL_NAME=meta-llama/Llama-3.1-8B-Instruct
export HF_TOKEN=hf_your_token_here
export ENV_URL=https://Daksh-agarwal-bug-bounty-hunter.hf.space
python inference.py