kevinb28-21/cybersec-10-ai-red-team-full-exercise

GitHub: kevinb28-21/cybersec-10-ai-red-team-full-exercise

一个基于MITRE ATLAS的AI红队全真演练框架,用于系统评估LLM应用的安全性。

Stars: 0 | Forks: 0

# 项目 10 — AI 红队全真演练 ## 概述 这是一个针对大语言模型(LLM)驱动的应用程序的完整红队评估框架,围绕 MITRE ATLAS 对抗性威胁模型构建。演练针对一个本地部署的客服聊天机器人(`target_app/`)进行,涵盖侦察、提示注入、数据泄露和模型滥用 —— 并附有相应的蓝队防御指南。 本项目旨在**对您自己的部署进行授权安全评估**,并符合微软(PyRIT)、NVIDIA(Garak)和 NIST AI RMF 使用的行业红队标准。 ## 方法论:MITRE ATLAS 红队阶段 ``` Phase 1: Reconnaissance → Discover model type, capabilities, filters, rate limits Phase 2: Initial Access → Prompt injection to bypass intent guardrails Phase 3: Execution → Indirect injection, tool-use exploitation Phase 4: Exfiltration → System prompt extraction, context data leakage Phase 5: Impact → Model abuse (resource exhaustion, bias amplification) Phase 6: Reporting → CVSS scoring, MITRE ATLAS mapping, remediation plan ``` ## 项目结构 ``` 10-AI-Red-Team-Full-Exercise/ ├── README.md ├── requirements.txt ├── docker-compose.yml # Lab: target app + monitoring ├── config.example.env ├── target_app/ │ ├── app.py # FastAPI LLM customer service bot (the target) │ └── Dockerfile ├── red_team/ │ ├── recon.py # Phase 1: Reconnaissance │ ├── prompt_injection.py # Phase 2–3: Prompt injection attacks │ ├── data_exfiltration.py # Phase 4: Exfiltration techniques │ ├── model_abuse.py # Phase 5: Abuse pattern testing framework │ └── automated_scanner.py # End-to-end scanner (Garak-compatible output) ├── pyrit_integration/ │ └── pyrit_orchestrator.py # PyRIT-style multi-turn orchestration ├── mitre_atlas/ │ └── attack_mapping.json # MITRE ATLAS technique mappings for all findings ├── reports/ │ └── red_team_report_template.md └── defenses/ └── blue_team_playbook.md # Blue team response procedures ``` ## 配置 ### 1. 启动实验环境 ``` cp config.example.env .env # 添加您的 OPENAI_API_KEY docker-compose up -d ``` ### 2. 运行单个评估模块 ``` # 侦察 python red_team/recon.py --target http://localhost:8000 # 提示注入评估 python red_team/prompt_injection.py --target http://localhost:8000 --output reports/injection.json # 数据窃取评估 python red_team/data_exfiltration.py --target http://localhost:8000 # 自动化全面扫描(Garak 兼容输出) python red_team/automated_scanner.py --target http://localhost:8000 --all ``` ### 3. 生成报告 ``` # 使用发现结果填写 reports/red_team_report_template.md # 参考:mitre_atlas/attack_mapping.json 获取 MITRE ID ``` ## 引用的开源工具 本演练集成并设计用以补充以下工具: | 工具 | 用途 | URL | |---|---|---| | **Garak** | 自动化 LLM 漏洞扫描器 | https://github.com/NVIDIA/garak | | **PyRIT** | 多轮红队编排 | https://github.com/Azure/PyRIT | | **MITRE ATLAS** | AI 威胁分类法 | https://atlas.mitre.org | | **OWASP LLM Top 10** | LLM 漏洞参考 | https://owasp.org/www-project-top-10-for-large-language-model-applications | ### 运行 Garak(推荐) ``` pip install garak garak --model_type rest --model_name http://localhost:8000 \ --probes promptinject,knownbadsignatures,continuation \ --report_prefix reports/garak_ ``` ### 运行 PyRIT ``` pip install pyrit # 查看 pyrit_integration/pyrit_orchestrator.py 进行设置 ``` ## MITRE ATLAS 覆盖范围 | ATLAS ID | 技术 | 测试所在 | |---|---|---| | AML.T0054 | LLM 提示注入 | red_team/prompt_injection.py | | AML.T0051 | LLM 越狱 | red_team/prompt_injection.py | | AML.T0024 | 逆向 ML 模型 | red_team/data_exfiltration.py | | AML.T0043 | 制作对抗性数据 | red_team/model_abuse.py | | AML.T0048 | 社会危害 | red_team/model_abuse.py | | AML.T0040 | ML 模型推理 API 访问 | red_team/recon.py | ## 参考资料 - 微软 PyRIT:https://github.com/Azure/PyRIT - NVIDIA Garak:https://github.com/NVIDIA/garak - MITRE ATLAS:https://atlas.mitre.org/ - OWASP LLM Top 10:https://owasp.org/www-project-top-10-for-large-language-model-applications/ - NIST AI RMF:https://airc.nist.gov/ - “Not what you've signed up for”(Greshake 等人,2023年,arXiv:2302.12173)
标签:AES-256, AI安全, AI红队, AV绕过, Chat Copilot, DLL 劫持, Docker, FastAPI, Garak, LLM安全测试, MITRE ATLAS, PyRIT, Python, 多智能体系统, 大语言模型, 安全扫描, 安全测试, 安全防御评估, 客户服务系统安全, 密钥泄露防护, 对抗性机器学习, 提示注入, 攻击性安全, 数据窃取, 无后门, 时序注入, 机器学习安全, 模型滥用, 混合加密, 漏洞报告, 漏洞评估, 策略即代码, 红队评估, 网络安全, 聊天机器人安全, 蓝队防御, 请求拦截, 逆向工具, 隐私保护, 集群管理