Sploitus

Exploit for vuln-agent

githubexploit Β· 2026-08-05

Exploit Code

README168 lines
## https://sploitus.com/exploit?id=9AA766AE-3C8C-5DBF-9600-482A8975C313
# vuln-agent

AI-powered vulnerability scanner + exploit-research assistant for Telegram.

`vuln-agent` takes a target URL, **discovers** its software stack, cross-references **14 vulnerability sources**, reasons over the findings with an LLM agent, and **proves exploitability** by running real PoCs against the target β€” all from a Telegram chat. It also runs a **vuln monitor** that pushes new CVE alerts (≀14 days old) to your admin chat.

> **Ethical use only.** This tool performs active exploitation checks against the target you provide. Only scan systems you own or have explicit permission to test.

---

## Features

- **Pure discovery pipeline** β€” no hardcoded CVEs. Every finding comes from: `detect_stack β†’ search_vuln β†’ fetch_cve_detail β†’ version_match β†’ run_poc_check`.
- **Real exploit verification** β€” PoCs are run as subprocesses against the live target (`--check` mode, non-destructive). Verdicts are validated server-side (circumstantial evidence is downgraded).
- **14 vulnerability sources** β€” CVE 5.0 (MITRE), NVD, OSV, GitHub Advisory, ExploitDB, Wordfence, Patchstack, WPScan, CISA KEV, PoC-in-GitHub, WatchTowr, EPSS, BleepingComputer, Joomla Security.
- **Nuclei templates** — 4,200+ community-verified templates checked first (fast + accurate), with a YAML→Python fallback when the binary is missing.
- **Aggregate caching** β€” repeat lookups are served from SQLite (15.9s cold β†’ 0.0s cached). No re-scrape during bot uptime.
- **Vuln monitor** β€” hourly CVE alerts (6h interval, 14-day recency window), deduped, with AI-written summaries + Shodan/FOFA/Hunter dorks.
- **Self-improvement** β€” learns detection signatures, PoC patterns, WAF bypasses, and per-CMS lessons across scans.
- **Switch AI models from Telegram** β€” `/model` lists provider models and swaps detect/report models at runtime (persisted).
- **Multi-model cooperation** β€” a fast detect model (ReAct research) + a report/PoC model, both streamed with hard timeouts + retries.

---

## Architecture

```
Telegram bot (bot.py)
  β”œβ”€β”€ /scan        β†’ background task: run_research β†’ run_verify β†’ run_report
  β”‚                   β”‚
  β”‚                   β”œβ”€β”€ _pre_research (parallel I/O, no LLM)
  β”‚                   β”‚     detect_stack (detect/cms.py, detect/waf.py, probe.py)
  β”‚                   β”‚     search_vuln Γ— N components  (scrapers/registry.py)
  β”‚                   β”‚     fetch_cve_detail Γ— top-20   (14 sources, cached)
  β”‚                   β”œβ”€β”€ LLM review (ReAct loop, ≀15 steps)
  β”‚                   β”œβ”€β”€ run_verify: EPSS + KEV enrichment, then parallel run_poc
  β”‚                   β”‚     run_poc: nuclei template β†’ learned pattern β†’ LLM loop
  β”‚                   β”‚              β†’ save_poc β†’ subprocess --check β†’ verdict
  β”‚                   β”‚              (verdict validated: strong vs circumstantial proof)
  β”‚                   └── run_report: deterministic, LLM-free render
  β”‚
  β”œβ”€β”€ /poc         β†’ run_poc for a specific CVE (nuclei β†’ pattern β†’ LLM)
  β”œβ”€β”€ /chat        β†’ persistent per-scan Q&A (history persisted, per-user lock)
  β”œβ”€β”€ /model       β†’ list/switch detect + report models from the router
  β”œβ”€β”€ /monitor     β†’ vuln news listener (see below)
  └── /feedback /knowledge β†’ self-improvement loop

Vuln monitor (agent/monitor.py)
  every 6h (and on /monitor check):
    Wordfence threat-intel (Playwright) + 35 product queries (cached)
    β†’ filter published ≀14 days β†’ dedupe vs sent_cves β†’ top 5 by CVSS
    β†’ fetch detail + advisories β†’ AI summary + dorks β†’ send β†’ mark sent
    (re-entrancy guard: no concurrent cycles, no double-send)

LLM layer (llm.py)
  OpenAI-compatible router (9router), SSE streaming
  hard timeouts + retry (3Γ—) on transient failures (5xx/524/ReadTimeout)
  runtime model overrides persisted in db settings

Scraper layer (scrapers/)
  registry.py: parallel fan-out, 30s per-source cap, aggregate cache
               (single-flight: concurrent same-key lookups share one scrape)
  each source: BaseScraper with pluggable SQLite cache (TTL 24h)
```

### Pipeline detail

| Phase | What runs | Bounded by |
|---|---|---|
| Detect | HTTP probe β†’ CMS/plugin/service/WAF fingerprint | 15s client, 13 aux paths |
| Research | parallel `search_vuln` per component | 90s per search |
| Detail | top-20 CVEs Γ— 14 sources (parallel, sem 10) | 90s each |
| AI review | ReAct loop emitting findings JSON | 15 steps Γ— 600s |
| Verify | EPSS + KEV enrich, then `run_poc` per candidate (sem 10) | 600s per candidate |
| Report | deterministic render from `verified` field | LLM-free |

---

## Setup

```bash
git clone  vuln-agent
cd vuln-agent
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

cp .env.example .env   # then edit
```

### `.env`

```ini
# Telegram bot
TELEGRAM_BOT_TOKEN=123456:ABC-DEF        # from @BotFather
ALLOWED_USER_IDS=123456789,987654321     # who may use the bot

# LLM router (OpenAI-compatible). Any OpenAI-compatible endpoint works.
ROUTER_BASE=https://9router.kliksosmed.id/v1
ROUTER_KEY=sk-REPLACE_WITH_YOUR_KEY
MODEL_DETECT=al/qwen3.7-flash            # fast research model
MODEL_REPORT=al/deepseek-v4-flash        # report + PoC model

# misc
HTTP_TIMEOUT=20
USER_AGENT=vuln-agent/1.0 (+security-research)
LLM_TIMEOUT=180
LLM_MAX_STEPS=12
```

### Optional

- **NVD API key** (free): `NVD_API_KEY=...` β€” raises NVD rate limit from 5β†’50 req/30s.
- **nuclei binary**: `install -m 755 -d /usr/local/bin && curl -sSL https://github.com/projectdiscovery/nuclei/releases/latest/download/nuclei_..._linux_amd64.zip | ...` — enables the fast template path. Without it, the YAML→Python fallback is used.
- **Playwright** (for Wordfence threat-intel + Cloudflare-challenged pages): `pip install playwright && playwright install chromium`.

### Run

```bash
python3 bot.py
```

---

## Telegram commands

| Command | Description |
|---|---|
| `/scan ` | Background scan: detect stack β†’ research β†’ verify β†’ report |
| `/jobs` | List running / interrupted scans |
| `/poc  ` | Generate + verify a PoC for a CVE (`force` to regenerate) |
| `/chat  [question]` | Persistent Q&A about a scan (`/end` to exit) |
| `/model [detect\|report ] [list\|reset]` | Switch AI models at runtime (from provider list) |
| `/monitor on\|off\|list\|check` | Vuln news listener (6h interval, ≀14-day-old CVEs) |
| `/report ` | Re-send a saved report |
| `/history` | List your scans |
| `/sources` | List vulnerability sources |
| `/feedback  good\|bad\|wrong [note]` | Rate a scan (feeds self-improvement) |
| `/knowledge` | Show lessons learned from prior scans |

---

## Testing

```bash
python3 -m pytest tests/ -q
```

The suite covers: version-range matching, CVSS parsing, EPSS/KEV enrichment, JSON extraction, report rendering/ranking, research fallback, nuclei codegen, probe cookies, DB writers, LLM timeout handling.

---

## Security notes

- `.env` is git-ignored β€” the API key never leaves your host.
- PoC execution is a direct subprocess (`python3  --target  --check`) β€” no sandbox. Only run against targets you own.
- `--check` mode is non-destructive (harmless payloads, math-echo proof). `--exploit` mode (via `/poc` LLM agent) performs active exploitation β€” use with permission.
- Auth: only `ALLOWED_USER_IDS` can use the bot. Leaving it empty opens the bot to everyone.

---

## Disclaimer

This project is for authorized security testing and research. The authors are not responsible for misuse. Scanning or exploiting systems without permission is illegal in most jurisdictions.

## License

MIT β€” free to use, modify, and contribute. Open source.