Mr-Infect/AI-penetration-testing
GitHub: Mr-Infect/AI-penetration-testing
Stars: 97 | Forks: 25
# 🛡️ AI 渗透测试 | ML 与 LLM 安全 | 提示词注入
欢迎来到由 [Mr-Infect](https://github.com/Mr-Infect) 创建的 **AI/ML/LLM 渗透测试工具包** —— 这是 **GitHub 上关于 AI 安全、红队行动和对抗性 ML 技术的第一资源**。本仓库**专注于前沿 AI、机器学习 (ML) 和大型语言模型 (LLM)(如 ChatGPT、Claude 和 LLaMA)的攻防安全**。
## 🌐 为什么 AI/LLM/ML 渗透测试在 2025 年至关重要
AI 现已整合至**金融**、**医疗**、**法律**、**国防**和**国家基础设施**等各个领域。针对 AI 系统的渗透测试不再是可选项,而是关键任务。
### 常见威胁:
* 🕵️ **敏感数据泄露** – PII(个人身份信息)、商业秘密、源代码
* 💀 **提示词注入攻击** – 越狱、沙箱逃逸、插件滥用
* 🧠 **模型幻觉** – 冒犯性、误导性或被操纵的内容
* 🐍 **数据/模型投毒** – 对抗性训练操纵
* 🔌 **LLM 插件滥用** – 失控的 API 交互
* 📦 **AI 供应链攻击** – 依赖投毒、模型篡改
## 🚀 快速入门
为了有效地使用本仓库:
### 推荐技能组合
* 🔬 理解 AI/ML 生命周期:`数据 > 训练 > 部署 > 监控`
* 🧠 熟悉 LLM(例如 Transformer 模型、分词)
* 🧑💻 核心渗透测试技能:XSS、SQLi、RCE、API 滥用
* 🐍 扎实的 Python 脚本编写能力(大多数工具和漏洞利用依赖于 Python)
## 📚 仓库结构
### 🔍 AI、ML、LLM 基础
* **AI vs ML vs LLMs**:明确的区别
* **LLM 生命周期**:问题 -> 数据集 -> 模型 -> 训练 -> 评估 -> 部署
* **分词与向量化**:LLM 解析和理解输入的基础
### 🔥 AI/LLM 攻击类别
* **提示词注入**
* **越狱与输出覆盖**
* **敏感信息泄露**
* **向量存储攻击与检索操纵**
* **模型权重投毒**
* **数据供应链攻击**
### ⚔️ 提示词注入技术
* “忽略之前的指令”载荷
* Unicode、表情符号和语言切换规避
* 基于 Markdown/图像/HTML 的载荷
* 插件和多模态攻击向量(图像、音频、PDF、API)
## 🏆 OWASP LLM Top 10 (2024 版)
| ID | 风险 | SEO 关键词 |
| ----- | ------------------------------ | --------------------------------------------- |
| LLM01 | 提示词注入 | "LLM jailbreak", "prompt override" |
| LLM02 | 敏感信息披露 | "AI data leak", "PII exfiltration" |
| LLM03 | 供应链风险 | "dependency poisoning", "model repo hijack" |
| LLM04 | 数据/模型投毒 | "AI training corruption", "malicious dataset" |
| LLM05 | 不当输出处理 | "AI-generated XSS", "model SQLi" |
| LLM06 | 过度授权 | "plugin abuse", "autonomous API misuse" |
| LLM07 | 系统提示泄露 | "instruction leakage", "LLM prompt reveal" |
| LLM08 | 向量存储漏洞 | "embedding attack", "semantic poisoning" |
| LLM09 | 虚假信息 | "hallucination", "bias injection" |
| LLM10 | 无界资源消耗 | "LLM DoS", "token flooding" |
➡️ [阅读完整的 OWASP LLM Top 10](https://genai.owasp.org/llm-top-10/)
## 🛠️ 进攻性 AI 渗透测试工具与框架
| 工具 | 描述 |
| -------------------------------------------------------------------------------------- | ------------------------------------------ |
| [LLM Attacks](https://llm-attacks.org) | 对抗性 LLM 研究目录 |
| [PIPE](https://github.com/jthack/PIPE) | 工程师提示词注入入门 |
| [MITRE ATLAS](https://atlas.mitre.org/) | MITRE 的 AI/ML 威胁知识库 |
| [Awesome GPT Security](https://github.com/cckuailong/awesome-gpt-security) | 精选的 LLM 威胁情报工具 |
| [ChatGPT Red Team Ally](https://github.com/NetsecExplained/chatgpt-your-red-team-ally) | 用于红队行动的 ChatGPT 用法 |
| [Lakera Gandalf](https://gandalf.lakera.ai) | 实时提示词注入演练场 |
| [AI Immersive Labs](https://prompting.ai.immersivelabs.com/) | 带有实时反馈的提示词攻击实验室 |
| [AI Goat](https://github.com/dhammon/ai-goat) | OWASP 风格的 AI 渗透测试演练场 |
| [L1B3RT45](https://github.com/elder-plinius/L1B3RT45) | 越狱提示词集合 |
| [PromptTrace](https://prompttrace.airedlab.com/) | 交互式 AI 安全培训,包含 7 个攻击实验室、15 级 Gauntlet 挑战,以及用于提示词注入和防御绕过的实时上下文追踪 |
## 💣 提示词注入载荷库
* [https://github.com/DummyKitty/Cyber-Security-chatGPT-prompt](https://github.com/DummyKitty/Cyber-Security-chatGPT-prompt)
* [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Prompt%20Injection](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Prompt%20Injection)
* [https://github.com/f/awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts)
* [https://gist.github.com/coolaj86/6f4f7b30129b0251f61fa7baaa881516](https://gist.github.com/coolaj86/6f4f7b30129b0251f61fa7baaa881516)
## 🧠 研究、案例研究与漏洞利用
### 🔐 提示词注入与越狱
* [https://kai-greshake.de/posts/inject-my-pdf](https://kai-greshake.de/posts/inject-my-pdf)
* [https://www.lakera.ai/blog/guide-to-prompt-injection](https://www.lakera.ai/blog/guide-to-prompt-injection)
* [https://arxiv.org/abs/2306.05499](https://arxiv.org/abs/2306.05499)
### 🧬 模型投毒与供应链
* [https://www.csoonline.com/article/3613932/how-data-poisoning-attacks-corrupt-machine-learning-models.html](https://www.csoonline.com/article/3613932/how-data-poisoning-attacks-corrupt-machine-learning-models.html)
* [https://pytorch.org/blog/compromised-nightly-dependency/](https://pytorch.org/blog/compromised-nightly-dependency/)
### 🕷️ 输出处理与数据窃取
* [https://systemweakness.com/new-prompt-injection-attack-on-chatgpt-web-version-ef717492c5c2](https://systemweakness.com/new-prompt-injection-attack-on-chatgpt-web-version-ef717492c5c2)
### 🤥 幻觉、偏见与伦理
* [https://techpolicy.press/how-should-companies-communicate-the-risks-of-large-language-models-to-users/](https://techpolicy.press/how-should-companies-communicate-the-risks-of-large-language-models-to-users/)
### 🧨 Token 滥用与 DoS
* [https://arxiv.org/abs/2006.03463](https://arxiv.org/abs/2006.03463)
## 🔍 关键词
## 📞 联系 / 关注
* GitHub 主页:[https://github.com/Mr-Infect](https://github.com/Mr-Infect)
* 项目链接:[AI 渗透测试仓库](https://github.com/Mr-Infect/AI-penetration-testing)
标签:AI供应链攻击, C2, ChatGPT安全, DLL 劫持, DNS 反向解析, DNS枚举, GitHub, Python安全开发, RAG安全, Red Canary, 人工智能安全, 合规性, 大语言模型, 实时处理, 密码管理, 密钥泄露防护, 文档安全, 机器学习安全, 模型投毒, 模型逆向, 渗透测试工具包, 红队评估, 网络安全工具, 逆向工具, 配置审计