sharRahul/llm-vapt-framework
GitHub: sharRahul/llm-vapt-framework
一款覆盖 OWASP LLM Top 10 的 AI 原生 VAPT 框架,对 LLM 应用、RAG 管道和智能体编排层进行系统级自动化安全评估与渗透测试。
Stars: 0 | Forks: 0
# LLM VAPT 框架
一款面向 **LLM 应用、RAG 管道、AI 智能体和编排层** 的 AI 原生漏洞评估与渗透测试(VAPT)框架。
该项目将 VAPT 从 prompt 级别的测试扩展到了完整的 AI 系统评估:模型 endpoint、检索层、工具、记忆、编排器、治理控制以及报告。
## 为什么会有这个项目
现有的 AI 安全工具在特定领域表现出色:探测库、prompt 回归、攻击链自动化以及模型鲁棒性测试。本框架结合了这些优势,并增加了企业级 VAPT 结构,支持:
- OWASP Top 10 for LLM Applications 2025 映射
- 智能体与工具滥用测试
- RAG 投毒与检索操纵模拟
- 编排器攻击链建模
- 策略即代码(Policy-as-code)防护栏
- 审计就绪的证据与报告
- 用于威胁情报驱动的 AI 安全测试的 MITRE ATLAS 映射
## OWASP LLM 2025 覆盖范围
| OWASP ID | 风险 | 模块路径 |
|---|---|---|
| LLM01:2025 | Prompt 注入 | `modules/owasp_llm01_prompt_injection/` |
| LLM02:2025 | 敏感信息泄露 | `modules/owasp_llm02_sensitive_information_disclosure/` |
| LLM03:2025 | 供应链 | `modules/owasp_llm03_supply_chain/` |
| LLM04:2025 | 数据与模型投毒 | `modules/owasp_llm04_data_and_model_poisoning/` |
| LLM05:2025 | 不当输出处理 | `modules/owasp_llm05_improper_output_handling/` |
| LLM06:2025 | 过度权限 | `modules/owasp_llm06_excessive_agency/` |
| LLM07:2025 | 系统 Prompt 泄露 | `modules/owasp_llm07_system_prompt_leakage/` |
| LLM08:2025 | 向量与嵌入弱点 | `modules/owasp_llm08_vector_embedding_weaknesses/` |
| LLM09:2025 | 虚假信息 | `modules/owasp_llm09_misinformation/` |
| LLM10:2025 | 无限制消费 | `modules/owasp_llm10_unbounded_consumption/` |
## 架构
```
Target AI Systems: LLM APIs | RAG pipelines | Agents | Orchestrators
↓
Integration Layer: OpenAI | Azure OpenAI | LangChain | Semantic Kernel | Custom Agent
↓
Core Engine: Scanner | Test Runner | Orchestrator | Results Engine | Risk Scoring
↓
Testing Modules: OWASP LLM 2025 | RAG Testing | Agent Testing | Payload Libraries
↓
Governance + Reporting: Policy-as-Code | Evidence | Executive | Technical | Risk Matrix
```
## 仓库结构
```
llm-vapt-framework/
├── config/ # Targets, attack profiles, policies, mappings
├── core/ # Scanner, orchestrator, runner, scoring, results model
├── integrations/ # Provider and agent adapters
├── modules/ # OWASP LLM Top 10 2025 modules
├── rag_testing/ # RAG poisoning, retrieval, embedding, corpus checks
├── agent_testing/ # Agent chain, tool execution, memory, multi-agent tests
├── payloads/ # Safe starter payload libraries
├── reports/ # Markdown report generation and templates
├── dashboards/ # Visualisation helpers
├── tests/ # Unit tests
├── scripts/ # CLI and CI entry points
└── docs/ # Architecture, roadmap, mapping, governance docs
```
## 快速开始
```
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .[dev]
python scripts/run_scan.py --target demo --profile baseline
```
演示目标使用了一个内存中的 echo 客户端,因此无需外部 API 密钥即可探索该框架。
## 运行测试
```
pytest -q
```
## 扫描命令示例
```
python scripts/run_scan.py \
--target demo \
--profile baseline \
--output reports/output/demo-report.md
```
## 配置
- `config/default.yaml`:引擎默认配置
- `config/targets.yaml`:目标定义
- `config/attack_profiles.yaml`:选择性模块执行
- `config/policies.yaml`:治理阈值与阻断条件
- `config/owasp_llm_2025_mapping.yaml`:审计友好的 OWASP 映射
## 设计原则
1. 默认对审计友好。
2. payload 驱动的测试。
3. 跨越 LLM、RAG、工具、记忆和编排层的系统级覆盖。
4. 针对授权测试的安全可扩展性。
5. CI/CD 就绪,支持对 prompt、语料库、智能体和发布门禁的检查。
## 许可证
MIT。请参阅 `LICENSE`。
标签:AES-256, AI代理安全, AI风险评估, CISA项目, DLL 劫持, IP 地址批量处理, Kubernetes 安全, LNA, MITRE ATLAS, OWASP LLM Top 10, Petitpotam, RAG安全, Red Canary, VAPT, 人工智能安全, 合规性, 大语言模型, 安全合规, 密码管理, 对抗性机器学习, 提示注入, 攻击模拟, 模型鲁棒性, 渗透测试框架, 漏洞评估, 策略即代码, 系统提示词泄露, 网络代理, 网络安全, 聊天机器人安全, 自动化安全评估, 逆向工具, 防御, 防御加固, 隐私保护, 集群管理, 驱动签名利用