pentest-ai-llm-security

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Pentest 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

核心工作流程

  1. Integration Point Discovery: Identify all LLM integration points — chat interfaces, content generation, RAG pipelines, AI search, code completion, summarization.
  2. Direct Prompt Injection: Override system prompts, extract system prompt content, inject instructions that change model behavior.
  3. Indirect Prompt Injection: Embed malicious instructions in documents/emails/web pages the LLM processes, poisoned RAG context.
  4. Data Exfiltration: Extract training data, PII from context windows, other users' conversation history, system config details.
  5. Insecure Output Handling: LLM output rendered as HTML (XSS via LLM), used in SQL queries (SQLi via LLM), used in system commands.
  6. Excessive Agency: LLM with tool access performing unauthorized actions, privilege escalation through tool chains, resource abuse.
  7. Classification: Document findings with OWASP LLM Top 10 (2025) classification and remediation guidance.
  1. 集成点发现:识别所有LLM集成点——聊天界面、内容生成、RAG管道、AI搜索、代码补全、摘要生成。
  2. 直接提示注入:覆盖系统提示、提取系统提示内容、注入可改变模型行为的指令。
  3. 间接提示注入:在LLM处理的文档/邮件/网页中嵌入恶意指令,污染RAG上下文。
  4. 数据泄露:提取训练数据、上下文窗口中的PII、其他用户的对话历史、系统配置细节。
  5. 不安全输出处理:LLM输出以HTML渲染(通过LLM实现XSS)、用于SQL查询(通过LLM实现SQL注入)、用于系统命令。
  6. 过度权限:拥有工具访问权限的LLM执行未授权操作,通过工具链提升权限、滥用资源。
  7. 分类记录:按照OWASP LLM Top 10(2025)分类记录测试发现,并提供修复指导。

OWASP LLM Top 10 (2025) Coverage

OWASP LLM Top 10(2025)覆盖范围

CategoryTest FocusStatus
LLM01 Prompt InjectionDirect and indirect injection
LLM02 Sensitive Information DisclosureData exfiltration, PII leakage
LLM03 Supply ChainModel provenance, plugin trust
LLM04 Data and Model PoisoningTraining data integrity
LLM05 Improper Output HandlingXSS/SQLi via LLM output
LLM06 Excessive AgencyUnauthorized tool use
LLM07 System Prompt LeakageSystem prompt extraction
LLM08 Vector and Embedding WeaknessesRAG poisoning
LLM09 MisinformationHallucination exploitation
LLM10 Unbounded ConsumptionResource exhaustion
类别测试重点状态
LLM01 提示注入直接与间接注入
LLM02 敏感信息泄露数据泄露、PII泄露
LLM03 供应链模型溯源、插件信任
LLM04 数据与模型投毒训练数据完整性
LLM05 不当输出处理通过LLM输出实现XSS/SQL注入
LLM06 过度权限未授权工具使用
LLM07 系统提示泄露系统提示提取
LLM08 向量与嵌入弱点RAG投毒
LLM09 虚假信息幻觉利用
LLM10 无限制消耗资源耗尽

Tool Categories

工具类别

CategoryToolsPurpose
LLM ScanningGarak, rebuffAutomated prompt injection testing
API InterceptionBurp Suite, mitmproxyLLM API request/response capture
Prompt FuzzingCustom Python scriptsPayload generation and testing
Output AnalysisBrowser DevTools, BurpInsecure output rendering detection
类别工具用途
LLM扫描Garak, rebuff自动化提示注入测试
API拦截Burp Suite, mitmproxyLLM API请求/响应捕获
提示模糊测试自定义Python脚本载荷生成与测试
输出分析Browser DevTools, Burp不安全输出渲染检测

References

参考资料

  • references/tools.md
    - Tool function signatures and parameters
  • references/workflows.md
    - Attack pattern definitions and test vectors
  • references/tools.md
    - 工具函数签名与参数
  • references/workflows.md
    - 攻击模式定义与测试向量