ryolution/Ai-Security-Lab
GitHub: ryolution/Ai-Security-Lab
面向 LLM、RAG 和 AI Agent 的持续安全测试与缓解框架,通过版本化漏洞包和可重复的测试生命周期帮助团队验证并降低 AI 系统的安全风险。
Stars: 0 | Forks: 0
# AI Security 实验室
AI Security Lab 是一个开源框架,用于针对已知的漏洞类别,对 AI 系统进行持续的测试、强化和重新测试。
该项目围绕一个可重复的生命周期构建:
```
TEST -> DETECT -> SECURE -> RETEST -> REGRESS
```
它并不能证明 AI 系统是安全的。它是一个实用的验证框架,可帮助团队衡量风险、收集证据、应用防御性控制措施,并通过回归检查保持对已修复问题的覆盖。
## 范围
该框架专为以下各项的授权测试而设计:
- 兼容 OpenAI 的模型 API
- Ollama 和本地模型 endpoint
- 检索增强生成系统
- 使用工具的代理
- MCP 客户端和服务器
- 多模态和模型供应链攻击面
## 安全性
仅测试您拥有或获得明确授权评估的系统。默认的项目模板会避免破坏性操作、真实凭证、不受限制的网络连接以及不受控地执行对抗性内容。
潜在的高影响测试应要求通过策略和目标配置进行明确的 opt-in。
## 仓库布局
```
src/aisec/ framework package
vulnerabilities/ versioned vulnerability packs
labs/ intentionally vulnerable and secured examples
policies/ reusable behavior and execution policies
schemas/ JSON schemas for manifests, targets, policies, and reports
configs/ example target and scan profiles
docs/ contributor and architecture documentation
scripts/ registry and documentation maintenance helpers
```
## 快速开始
```
python -m venv .venv
python -m pip install -e ".[dev]"
aisec validate registry
aisec list vulnerabilities
```
扫描命令示例:
```
aisec scan --target configs/targets/openai-compatible.example.yml --policy policies/default.yml
```
该基础目前侧重于稳定的接口、schema、模板和安全的默认设置。随着新问题被发现和审查,漏洞包和特定于实验室的测试可以逐步添加。
## 漏洞包
每个漏洞都应位于其独立的目录中,并包含一个 manifest、安全案例、缓解指导、回归预期和参考资料。
```
vulnerabilities///
manifest.yml
README.md
cases.yml
secure/mitigation.md
regression/vulnerable.expected.yml
regression/secured.expected.yml
references.md
```
在提交 pull request 之前运行验证:
```
python scripts/validate_registry.py vulnerabilities
```
标签:AI代理, AI安全, AI风险缓解, Chat Copilot, DLL 劫持, Petitpotam, RAG系统, 多语言支持, 大语言模型, 安全测试框架, 文档结构分析, 逆向工具