CyberSecurityUP/NeuroSploit

GitHub: CyberSecurityUP/NeuroSploit

一款集成 AI 自主智能体、支持 100 种漏洞类型并具备反幻觉验证机制的自动化渗透测试框架。

Stars: 890 | Forks: 229

# NeuroSploit v3 ![NeuroSploit](https://img.shields.io/badge/NeuroSploit-AI--Powered%20Pentesting-blueviolet) ![Version](https://img.shields.io/badge/Version-3.0.0-blue) ![License](https://img.shields.io/badge/License-MIT-green) ![Python](https://img.shields.io/badge/Python-3.10+-yellow) ![React](https://img.shields.io/badge/React-18-61dafb) ![Vuln Types](https://img.shields.io/badge/Vuln%20Types-100-red) ![Docker](https://img.shields.io/badge/Docker-Kali%20Sandbox-informational) **AI 驱动的自主渗透测试平台** NeuroSploit v3 是一个先进的安全评估平台,结合了 AI 驱动的自主智能体、100 种漏洞类型、每次扫描独立的 Kali Linux 隔离容器、误报加固、漏洞利用链,以及带有实时监控功能的现代化 React Web 界面。 ## 亮点 - **100 种漏洞类型**,涵盖 10 个类别,配备 AI 驱动的测试提示 - **自主智能体** - 三流并行渗透测试(侦察 + 初级测试员 + 工具运行器) - **单扫描 Kali 容器** - 每次扫描都在独立的 Docker 容器中运行 - **反幻觉流水线** - 阴性对照、执行证明、置信度评分 - **漏洞利用链引擎** - 自动链接发现结果(SSRF->内部, SQLi->特定数据库等) - **WAF 检测与绕过** - 16 种 WAF 签名,12 种绕过技术 - **智能策略自适应** - 无效端点检测、收益递减、优先级重算 - **多提供商 LLM** - Claude, GPT, Gemini, Ollama, LMStudio, OpenRouter - **实时仪表盘** - WebSocket 驱动的实时扫描进度、发现结果和报告 - **沙箱仪表盘** - 实时监控运行中的 Kali 容器、工具、健康检查 ## 目录 - [快速开始](#quick-start) - [架构](#architecture) - [自主智能体](#autonomous-agent) - [100 种漏洞类型](#100-vulnerability-types) - [Kali 沙箱系统](#kali-sandbox-system) - [反幻觉与验证](#anti-hallucination--validation) - [Web GUI](#web-gui) - [API 参考](#api-reference) - [配置](#configuration) - [开发](#development) - [安全声明](#security-notice) ## 快速开始 ### 选项 1:Docker(推荐) ``` # 克隆仓库 git clone https://github.com/your-org/NeuroSploitv2.git cd NeuroSploitv2 # 复制环境文件并添加您的 API 密钥 cp .env.example .env nano .env # Add ANTHROPIC_API_KEY, OPENAI_API_KEY, or GEMINI_API_KEY # 构建 Kali 沙箱镜像(仅首次,约 5 分钟) ./scripts/build-kali.sh # 启动后端 uvicorn backend.main:app --host 0.0.0.0 --port 8000 ``` ### 选项 2:手动设置 ``` # 后端 pip install -r requirements.txt uvicorn backend.main:app --host 0.0.0.0 --port 8000 --reload # 前端(新终端) cd frontend npm install npm run dev ``` ### 构建 Kali 沙箱镜像 ``` # 常规构建(使用 Docker 缓存) ./scripts/build-kali.sh # 完全重建(无缓存) ./scripts/build-kali.sh --fresh # 构建 + 运行健康检查 ./scripts/build-kali.sh --test # 或通过 docker-compose docker compose -f docker/docker-compose.kali.yml build ``` 通过 **http://localhost:8000**(生产构建)或 **http://localhost:5173**(开发模式)访问 Web 界面。 ## 架构 ``` NeuroSploitv3/ ├── backend/ # FastAPI Backend │ ├── api/v1/ # REST API (13 routers) │ │ ├── scans.py # Scan CRUD + pause/resume/stop │ │ ├── agent.py # AI Agent control │ │ ├── agent_tasks.py # Scan task tracking │ │ ├── dashboard.py # Stats + activity feed │ │ ├── reports.py # Report generation (HTML/PDF/JSON) │ │ ├── scheduler.py # Cron/interval scheduling │ │ ├── vuln_lab.py # Per-type vulnerability lab │ │ ├── terminal.py # Terminal agent (10 endpoints) │ │ ├── sandbox.py # Sandbox container monitoring │ │ ├── targets.py # Target validation │ │ ├── prompts.py # Preset prompts │ │ ├── vulnerabilities.py # Vulnerability management │ │ └── settings.py # Runtime settings │ ├── core/ │ │ ├── autonomous_agent.py # Main AI agent (~7000 lines) │ │ ├── vuln_engine/ # 100-type vulnerability engine │ │ │ ├── registry.py # 100 VULNERABILITY_INFO entries │ │ │ ├── payload_generator.py # 526 payloads across 95 libraries │ │ │ ├── ai_prompts.py # Per-vuln AI decision prompts │ │ │ ├── system_prompts.py # 12 anti-hallucination prompts │ │ │ └── testers/ # 10 category tester modules │ │ ├── validation/ # False-positive hardening │ │ │ ├── negative_control.py # Benign request control engine │ │ │ ├── proof_of_execution.py # Per-type proof checks (25+ methods) │ │ │ ├── confidence_scorer.py # Numeric 0-100 scoring │ │ │ └── validation_judge.py # Sole authority for finding approval │ │ ├── request_engine.py # Retry, rate limit, circuit breaker │ │ ├── waf_detector.py # 16 WAF signatures + bypass │ │ ├── strategy_adapter.py # Mid-scan strategy adaptation │ │ ├── chain_engine.py # 10 exploit chain rules │ │ ├── auth_manager.py # Multi-user auth management │ │ ├── xss_context_analyzer.py # 8-context XSS analysis │ │ ├── poc_generator.py # 20+ per-type PoC generators │ │ ├── execution_history.py # Cross-scan learning │ │ ├── access_control_learner.py # Adaptive BOLA/BFLA/IDOR learning │ │ ├── response_verifier.py # 4-signal response verification │ │ ├── agent_memory.py # Bounded dedup agent memory │ │ └── report_engine/ # OHVR report generator │ ├── models/ # SQLAlchemy ORM models │ ├── db/ # Database layer │ ├── config.py # Pydantic settings │ └── main.py # FastAPI app entry │ ├── core/ # Shared core modules │ ├── llm_manager.py # Multi-provider LLM routing │ ├── sandbox_manager.py # BaseSandbox ABC + legacy shared sandbox │ ├── kali_sandbox.py # Per-scan Kali container manager │ ├── container_pool.py # Global container pool coordinator │ ├── tool_registry.py # 56 tool install recipes for Kali │ ├── mcp_server.py # MCP server (12 tools, stdio) │ ├── scheduler.py # APScheduler scan scheduling │ └── browser_validator.py # Playwright browser validation │ ├── frontend/ # React + TypeScript Frontend │ ├── src/ │ │ ├── pages/ │ │ │ ├── HomePage.tsx # Dashboard with stats │ │ │ ├── AutoPentestPage.tsx # 3-stream auto pentest │ │ │ ├── VulnLabPage.tsx # Per-type vulnerability lab │ │ │ ├── TerminalAgentPage.tsx # AI terminal chat │ │ │ ├── SandboxDashboardPage.tsx # Container monitoring │ │ │ ├── ScanDetailsPage.tsx # Findings + validation │ │ │ ├── SchedulerPage.tsx # Cron/interval scheduling │ │ │ ├── SettingsPage.tsx # Configuration │ │ │ └── ReportsPage.tsx # Report management │ │ ├── components/ # Reusable UI components │ │ ├── services/api.ts # API client layer │ │ └── types/index.ts # TypeScript interfaces │ └── package.json │ ├── docker/ │ ├── Dockerfile.kali # Multi-stage Kali sandbox (11 Go tools) │ ├── Dockerfile.sandbox # Legacy Debian sandbox │ ├── Dockerfile.backend # Backend container │ ├── Dockerfile.frontend # Frontend container │ ├── docker-compose.kali.yml # Kali sandbox build │ └── docker-compose.sandbox.yml # Legacy sandbox │ ├── config/config.json # Profiles, tools, sandbox, MCP ├── data/ │ ├── vuln_knowledge_base.json # 100 vuln type definitions │ ├── execution_history.json # Cross-scan learning data │ └── access_control_learning.json # BOLA/BFLA adaptive data │ ├── scripts/ │ └── build-kali.sh # Build/rebuild Kali image ├── tools/ │ └── benchmark_runner.py # 104 CTF challenges ├── agents/base_agent.py # BaseAgent class ├── neurosploit.py # CLI entry point └── requirements.txt ``` ## 自主智能体 AI 智能体(`autonomous_agent.py`)自主编排整个渗透测试过程。 ### 三流并行架构 ``` ┌─────────────────────┐ │ Auto Pentest │ │ Target URL(s) │ └────────┬────────────┘ │ ┌──────────────┼──────────────┐ ▼ ▼ ▼ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ Stream 1 │ │ Stream 2 │ │ Stream 3 │ │ Recon │ │ Junior Test │ │ Tool Runner │ │ ─────────── │ │ ─────────── │ │ ─────────── │ │ Crawl pages │ │ Test target │ │ Nuclei scan │ │ Find params │ │ AI-priority │ │ Naabu ports │ │ Tech detect │ │ 3 payloads │ │ AI decides │ │ WAF detect │ │ per endpoint│ │ extra tools │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │ │ │ └────────────────┼────────────────┘ ▼ ┌─────────────────────┐ │ Deep Analysis │ │ 100 vuln types │ │ Full payload sets │ │ Chain exploitation │ └─────────┬───────────┘ ▼ ┌─────────────────────┐ │ Report Generation │ │ AI executive brief │ │ PoC code per find │ └─────────────────────┘ ``` ### 智能体自主模块 | 模块 | 描述 | |--------|-------------| | **请求引擎** | 带退避的重试、单主机速率限制、熔断器、自适应超时 | | **WAF 检测器** | 16 种 WAF 签名(Cloudflare, AWS, Akamai, Imperva 等),12 种绕过技术 | | **策略适配器** | 无效端点检测、收益递减、403 绕过、优先级重算 | | **链式引擎** | 10 条链式规则(SSRF->内部, SQLi->特定数据库, LFI->配置, IDOR 模式迁移) | | **认证管理器** | 多用户上下文(user_a, user_b, admin)、登录表单检测、会话管理 | ### 扫描功能 - 带检查点的 **暂停 / 恢复 / 停止** - **手动验证** - 确认或拒绝 AI 发现 - 确认发现时的 **截图捕获**(Playwright) - **跨扫描学习** - 历史成功率影响未来优先级 - **CVE 测试** - 正则检测 + AI 生成的载荷 ## 100 种漏洞类型 ### 类别 | 类别 | 类型数 | 示例 | |----------|-------|---------| | **注入** | 38 | XSS(反射型/存储型/DOM)、SQLi、NoSQLi、命令注入、SSTI、LDAP、XPath、CRLF、Header 注入、日志注入、GraphQL 注入 | | **检测** | 21 | 安全头、CORS、点击劫持、信息泄露、调试端点、错误泄露、源代码暴露 | | **AI 驱动** | 41 | BOLA、BFLA、IDOR、竞态条件、业务逻辑、JWT 篡改、OAuth 缺陷、原型污染、WebSocket 劫持、缓存投毒、HTTP 请求走私 | | **认证** | 8 | 认证绕过、会话固定、凭证填充、密码重置缺陷、MFA 绕过、默认凭证 | | **授权** | 6 | BOLA、BFLA、IDOR、权限提升、强制浏览、功能级访问控制 | | **文件访问** | 5 | LFI、RFI、路径遍历、文件上传、XXE | | **请求伪造** | 4 | SSRF、CSRF、云元数据、DNS 重绑定 | | **客户端** | 8 | CORS、点击劫持、开放重定向、DOM Clobbering、原型污染、PostMessage、CSS 注入 | | **基础设施** | 6 | SSL/TLS、HTTP 方法、子域名接管、Host 头、CNAME 劫持 | | **云/供应链** | 4 | 云元数据、S3 存储桶配置错误、依赖混淆、第三方脚本 | ### 载荷引擎 - 跨越 95 个库的 **526 个载荷** - **73 个 XSS 存储型载荷** + 5 个特定上下文集 - 每种类型的 AI 决策提示,包含反幻觉指令 - WAF 自适应载荷转换(12 种技术) ## Kali 沙箱系统 每次扫描都在其 **独立的 Kali Linux Docker 容器** 中运行,提供: - **完全隔离** - 并发扫描之间互不干扰 - **按需工具** - 56 种工具仅在需要时安装 - **自动清理** - 扫描完成后销毁容器 - **资源限制** - 单容器内存(2GB)和 CPU(2 核)限制 ### 预装工具(28 种) | 类别 | 工具 | |----------|-------| | **扫描器** | nuclei, naabu, httpx, nmap, nikto, masscan, whatweb | | **发现** | subfinder, katana, dnsx, uncover, ffuf, gobuster, waybackurls | | **利用** | dalfox, sqlmap | | **系统** | curl, wget, git, python3, pip3, go, jq, dig, whois, openssl, netcat, bash | ### 按需工具(另外 28 种) 首次请求时在容器内自动安装: - **APT**: wpscan, dirb, hydra, john, hashcat, testssl, sslscan, enum4linux, dnsrecon, amass, medusa, crackmapexec 等。 - **Go**: gau, gitleaks, anew, httprobe - **Pip**: dirsearch, wfuzz, arjun, wafw00f, sslyze, commix, trufflehog, retire ### 容器池 ``` ContainerPool (global coordinator, max 5 concurrent) ├── KaliSandbox(scan_id="abc") → docker: neurosploit-abc ├── KaliSandbox(scan_id="def") → docker: neurosploit-def └── KaliSandbox(scan_id="ghi") → docker: neurosploit-ghi ``` - **TTL 强制执行** - 容器在 60 分钟后自动销毁 - **孤儿清理** - 服务器启动时移除陈旧容器 - **优雅降级** - 如果 Docker 不可用,则回退到共享容器 ## 反幻觉与验证 NeuroSploit 使用多层验证流水线来消除误报: ### 验证流水线 ``` Finding Candidate │ ▼ ┌─────────────────────┐ │ Negative Controls │ Send benign/empty requests as controls │ Same behavior = FP │ -60 confidence if same response └─────────┬───────────┘ ▼ ┌─────────────────────┐ │ Proof of Execution │ 25+ per-vuln-type proof methods │ XSS: context check │ SSRF: metadata markers │ SQLi: DB errors │ BOLA: data comparison └─────────┬───────────┘ ▼ ┌─────────────────────┐ │ AI Interpretation │ LLM with anti-hallucination prompts │ Per-type system msgs │ 12 composable prompt templates └─────────┬───────────┘ ▼ ┌─────────────────────┐ │ Confidence Scorer │ 0-100 numeric score │ ≥90 = confirmed │ +proof, +impact, +controls │ ≥60 = likely │ -baseline_only, -same_behavior │ <60 = rejected │ Breakdown visible in UI └─────────┬───────────┘ ▼ ┌─────────────────────┐ │ Validation Judge │ Final verdict authority │ approve / reject │ Records for adaptive learning └─────────────────────┘ ``` ### 反幻觉系统提示 应用于 7 个任务上下文的 12 个可组合提示: - `anti_hallucination` - 核心真实性指令 - `proof_of_execution` - 要求具体证据 - `negative_controls` - 与良性请求进行比较 - `anti_severity_inflation` - 准确的严重性评级 - `access_control_intelligence` - BOLA/BFLA 数据比较方法论 ### 访问控制自适应学习 - 记录每个域名的 BOLA/BFLA/IDOR 的 TP/FP 结果 - 9 种默认响应模式,6 种已知 FP 模式(WSO2, Keycloak 等) - 历史 FP 率影响未来的置信度评分 ## Web 图形界面 ### 页面 | 页面 | 路由 | 描述 | |------|-------|-------------| | **仪表盘** | `/` | 统计概览、严重性分布、近期活动流 | | **自动渗透** | `/auto` | 一键自主渗透测试,带三流实时显示 | | **漏洞实验室** | `/vuln-lab` | 单类型漏洞测试(100 种类型,11 个类别) | | **终端智能体** | `/terminal` | AI 驱动的交互式安全聊天 + 工具执行 | | **沙箱** | `/sandboxes` | 实时 Docker 容器监控 + 管理 | | **AI 智能体** | `/scan/new` | 手动创建扫描并选择提示 | | **扫描详情** | `/scan/:id` | 带置信度徽章的发现结果,暂停/恢复/停止 | | **调度器** | `/scheduler` | Cron/间隔自动扫描调度 | | **报告** | `/reports` | HTML/PDF/JSON 报告生成与查看 | | **设置** | `/settings` | LLM 提供商、模型路由、功能开关 | ### 沙箱仪表盘 实时监控单扫描 Kali 容器: - **池统计** - 活动/最大容器数、Docker 状态、TTL - **容量条** - 可视化利用率指示器 - **单容器卡片** - 名称、扫描链接、运行时间、已安装工具、状态 - **操作** - 健康检查、销毁(需确认)、清理过期/孤儿容器 - **5 秒自动轮询** 以获取实时更新 ## API 参考 ### 基础 URL ``` http://localhost:8000/api/v1 ``` ### 端点 #### 扫描 | 方法 | 端点 | 描述 | |--------|----------|-------------| | `POST` | `/scans` | 创建新扫描 | | `GET` | `/scans` | 列出所有扫描 | | `GET` | `/scans/{id}` | 获取扫描详情 | | `POST` | `/scans/{id}/start` | 启动扫描 | | `POST` | `/scans/{id}/stop` | 停止扫描 | | `POST` | `/scans/{id}/pause` | 暂停扫描 | | `POST` | `/scans/{id}/resume` | 恢复扫描 | | `DELETE` | `/scans/{id}` | 删除扫描 | #### AI 智能体 | 方法 | 端点 | 描述 | |--------|----------|-------------| | `POST` | `/agent/run` | 启动自主智能体 | | `GET` | `/agent/status/{id}` | 获取智能体状态 + 发现 | | `GET` | `/agent/by-scan/{scan_id}` | 通过扫描 ID 获取智能体 | | `POST` | `/agent/stop/{id}` | 停止智能体 | | `POST` | `/agent/pause/{id}` | 暂停智能体 | | `POST` | `/agent/resume/{id}` | 恢复智能体 | | `GET` | `/agent/findings/{id}` | 获取详细发现 | | `GET` | `/agent/logs/{id}` | 获取智能体日志 | #### 沙箱 | 方法 | 端点 | 描述 | |--------|----------|-------------| | `GET` | `/sandbox` | 列出容器 + 池状态 | | `GET` | `/sandbox/{scan_id}` | 容器健康检查 | | `DELETE` | `/sandbox/{scan_id}` | 销毁容器 | | `POST` | `/sandbox/cleanup` | 移除过期容器 | | `POST` | `/sandbox/cleanup-orphans` | 移除孤儿容器 | #### 调度器 | 方法 | 端点 | 描述 | |--------|----------|-------------| | `GET` | `/scheduler` | 列出计划任务 | | `POST` | `/scheduler` | 创建计划任务 | | `DELETE` | `/scheduler/{id}` | 删除任务 | | `POST` | `/scheduler/{id}/pause` |暂停任务 | | `POST` | `/scheduler/{id}/resume` | 恢复任务 | #### 漏洞实验室 | 方法 | 端点 | 描述 | |--------|----------|-------------| | `GET` | `/vuln-lab/types` | 按类别列出 100 种漏洞类型 | | `POST` | `/vuln-lab/run` | 运行单类型漏洞测试 | | `GET` | `/vuln-lab/challenges` | 列出挑战运行 | | `GET` | `/vuln-lab/stats` | 检出率统计 | #### 报告与仪表盘 | 方法 | 端点 | 描述 | |--------|----------|-------------| | `POST` | `/reports` | 生成报告 | | `POST` | `/reports/ai-generate` | AI 驱动的报告 | | `GET` | `/reports/{id}/view` | 查看 HTML 报告 | | `GET` | `/dashboard/stats` | 仪表盘统计 | | `GET` | `/dashboard/activity-feed` | 近期活动 | ### WebSocket ``` ws://localhost:8000/ws/scan/{scan_id} ``` 事件:`scan_started`, `progress_update`, `finding_discovered`, `scan_completed`, `scan_error` ### API 文档 交互式文档位于: - Swagger UI: `http://localhost:8000/api/docs` - ReDoc: `http://localhost:8000/api/redoc` ## 配置 ### 环境变量 ``` # LLM API 密钥(至少需要一个) ANTHROPIC_API_KEY=your-key OPENAI_API_KEY=your-key GEMINI_API_KEY=your-key # 本地 LLM(可选) OLLAMA_BASE_URL=http://localhost:11434 LMSTUDIO_BASE_URL=http://localhost:1234 OPENROUTER_API_KEY=your-key # 数据库 DATABASE_URL=sqlite+aiosqlite:///./data/neurosploit.db # 服务器 HOST=0.0.0.0 PORT=8000 DEBUG=false ``` ### config/config.json ``` { "llm": { "default_profile": "gemini_pro_default", "profiles": { ... } }, "agent_roles": { "pentest_generalist": { "vuln_coverage": 100 }, "bug_bounty_hunter": { "vuln_coverage": 100 } }, "sandbox": { "mode": "per_scan", "kali": { "enabled": true, "image": "neurosploit-kali:latest", "max_concurrent": 5, "container_ttl_minutes": 60 } }, "mcp_servers": { "neurosploit_tools": { "transport": "stdio", "command": "python3", "args": ["-m", "core.mcp_server"] } } } ``` ## 开发 ### 后端 ``` pip install -r requirements.txt uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000 # API 文档:http://localhost:8000/api/docs ``` ### 前端 ``` cd frontend npm install npm run dev # Dev server at http://localhost:5173 npm run build # Production build ``` ### 构建 Kali 沙箱 ``` ./scripts/build-kali.sh --test # Build + health check ``` ### MCP 服务器 ``` python3 -m core.mcp_server # Starts stdio MCP server (12 tools) ``` ## 安全声明 **本工具仅用于授权的安全测试。** - 仅测试您拥有或获得明确书面许可测试的系统 - 遵循负责任的披露实践 - 遵守所有适用法律法规 - 未经授权访问计算机系统是违法的 ## 许可证 MIT 许可证 - 详情见 [LICENSE](LICENSE)。 ## 技术栈 | 层级 | 技术 | |-------|-------------| | **后端** | Python, FastAPI, SQLAlchemy, Pydantic, aiohttp | | **前端** | React 18, TypeScript, TailwindCSS, Vite | | **AI/LLM** | Anthropic Claude, OpenAI GPT, Google Gemini, Ollama, LMStudio, OpenRouter | | **沙箱** | Docker, Kali Linux, ProjectDiscovery 套件, Nmap, SQLMap, Nikto | | **工具** | Nuclei, Naabu, httpx, Subfinder, Katana, FFuf, Gobuster, Dalfox | | **基础设施** | Docker Compose, MCP 协议, Playwright, APScheduler | **NeuroSploit v3** - *AI 驱动的自主渗透测试平台*
标签:CISA项目, DLL 劫持, Docker容器, Python, React, Syscalls, WAF绕过, Web报告查看器, XXE攻击, 人工智能, 元数据标签, 反取证, 大语言模型, 安全评估, 插件系统, 攻击面发现, 无后门, 漏洞利用链, 特征检测, 用户模式Hook绕过, 网络安全, 网络安全审计, 网络攻防, 自主代理, 自动化攻击, 请求拦截, 逆向工具, 隐私保护