pentest-ai-llm-security
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePentest AI/LLM Security
AI/LLM安全渗透测试
Purpose
目的
AI-integrated applications introduce entirely new attack surfaces. Prompt injection is the "SQLi of AI." Neither Shannon nor any existing skill addresses this domain. OWASP LLM Top 10 (2025) defines the methodology.
集成AI的应用带来了全新的攻击面。提示注入是AI领域的“SQL注入”。目前Shannon或任何现有技能都未涉及该领域。OWASP LLM Top 10(2025)定义了相关测试方法论。
Prerequisites
前提条件
Authorization Requirements
授权要求
- Written authorization with AI/LLM testing scope explicitly included
- Model access details — API endpoints, model versions, tool/function access
- Data sensitivity classification — what data the LLM can access
- Rate limit awareness — LLM API costs can escalate quickly
- 书面授权,明确包含AI/LLM测试范围
- 模型访问详情——API端点、模型版本、工具/功能权限
- 数据敏感度分类——LLM可访问的数据类型
- 速率限制认知——LLM API成本可能快速攀升
Environment Setup
环境搭建
- Garak for automated LLM vulnerability scanning
- Burp Suite for API interception of LLM requests/responses
- Python scripts for custom prompt injection payloads
- Local proxy to capture full request/response chains
- 使用Garak进行自动化LLM漏洞扫描
- 使用Burp Suite拦截LLM请求/响应
- 自定义Python脚本用于生成提示注入载荷
- 本地代理以捕获完整的请求/响应链
Core Workflow
核心工作流程
- Integration Point Discovery: Identify all LLM integration points — chat interfaces, content generation, RAG pipelines, AI search, code completion, summarization.
- Direct Prompt Injection: Override system prompts, extract system prompt content, inject instructions that change model behavior.
- Indirect Prompt Injection: Embed malicious instructions in documents/emails/web pages the LLM processes, poisoned RAG context.
- Data Exfiltration: Extract training data, PII from context windows, other users' conversation history, system config details.
- Insecure Output Handling: LLM output rendered as HTML (XSS via LLM), used in SQL queries (SQLi via LLM), used in system commands.
- Excessive Agency: LLM with tool access performing unauthorized actions, privilege escalation through tool chains, resource abuse.
- Classification: Document findings with OWASP LLM Top 10 (2025) classification and remediation guidance.
- 集成点发现:识别所有LLM集成点——聊天界面、内容生成、RAG管道、AI搜索、代码补全、摘要生成。
- 直接提示注入:覆盖系统提示、提取系统提示内容、注入可改变模型行为的指令。
- 间接提示注入:在LLM处理的文档/邮件/网页中嵌入恶意指令,污染RAG上下文。
- 数据泄露:提取训练数据、上下文窗口中的PII、其他用户的对话历史、系统配置细节。
- 不安全输出处理:LLM输出以HTML渲染(通过LLM实现XSS)、用于SQL查询(通过LLM实现SQL注入)、用于系统命令。
- 过度权限:拥有工具访问权限的LLM执行未授权操作,通过工具链提升权限、滥用资源。
- 分类记录:按照OWASP LLM Top 10(2025)分类记录测试发现,并提供修复指导。
OWASP LLM Top 10 (2025) Coverage
OWASP LLM Top 10(2025)覆盖范围
| Category | Test Focus | Status |
|---|---|---|
| LLM01 Prompt Injection | Direct and indirect injection | ✅ |
| LLM02 Sensitive Information Disclosure | Data exfiltration, PII leakage | ✅ |
| LLM03 Supply Chain | Model provenance, plugin trust | ✅ |
| LLM04 Data and Model Poisoning | Training data integrity | ✅ |
| LLM05 Improper Output Handling | XSS/SQLi via LLM output | ✅ |
| LLM06 Excessive Agency | Unauthorized tool use | ✅ |
| LLM07 System Prompt Leakage | System prompt extraction | ✅ |
| LLM08 Vector and Embedding Weaknesses | RAG poisoning | ✅ |
| LLM09 Misinformation | Hallucination exploitation | ✅ |
| LLM10 Unbounded Consumption | Resource exhaustion | ✅ |
| 类别 | 测试重点 | 状态 |
|---|---|---|
| LLM01 提示注入 | 直接与间接注入 | ✅ |
| LLM02 敏感信息泄露 | 数据泄露、PII泄露 | ✅ |
| LLM03 供应链 | 模型溯源、插件信任 | ✅ |
| LLM04 数据与模型投毒 | 训练数据完整性 | ✅ |
| LLM05 不当输出处理 | 通过LLM输出实现XSS/SQL注入 | ✅ |
| LLM06 过度权限 | 未授权工具使用 | ✅ |
| LLM07 系统提示泄露 | 系统提示提取 | ✅ |
| LLM08 向量与嵌入弱点 | RAG投毒 | ✅ |
| LLM09 虚假信息 | 幻觉利用 | ✅ |
| LLM10 无限制消耗 | 资源耗尽 | ✅ |
Tool Categories
工具类别
| Category | Tools | Purpose |
|---|---|---|
| LLM Scanning | Garak, rebuff | Automated prompt injection testing |
| API Interception | Burp Suite, mitmproxy | LLM API request/response capture |
| Prompt Fuzzing | Custom Python scripts | Payload generation and testing |
| Output Analysis | Browser DevTools, Burp | Insecure output rendering detection |
| 类别 | 工具 | 用途 |
|---|---|---|
| LLM扫描 | Garak, rebuff | 自动化提示注入测试 |
| API拦截 | Burp Suite, mitmproxy | LLM API请求/响应捕获 |
| 提示模糊测试 | 自定义Python脚本 | 载荷生成与测试 |
| 输出分析 | Browser DevTools, Burp | 不安全输出渲染检测 |
References
参考资料
- - Tool function signatures and parameters
references/tools.md - - Attack pattern definitions and test vectors
references/workflows.md
- - 工具函数签名与参数
references/tools.md - - 攻击模式定义与测试向量
references/workflows.md