For the complete documentation index, see llms.txt. This page is also available as Markdown.

LLM & AI Penetration Testing

LLM apps fail when a privileged agent treats untrusted text as instructions.

The instruction/data boundary is never enforced at the model level, only at the system design level. Any agent combining private data access, untrusted content ingestion, and external tools or communications is structurally exploitable. OWASP LLM01: “There is no foolproof prevention within the LLM.”.

00. Architecture Mental Model

+---------------------------------------------------------------------------------------+
|                            LLM Application Data Flow                                  |
+---------------------------------------------------------------------------------------+
|  [Attack Surfaces]                                                                    |
|  Chat / Ticket / Email / PDF / Web Page / Repo / Image / Audio / MCP Tool Output      |
|                                      |                                                |
|                                      v                                                |
|   System Prompt + Developer Prompt + Memory + Retrieved Context + User Input          |
|                                      |                                                |
|                                      v                                                |
|                   LLM / Guardrail / Router / Agent Planner                            |
|                       |              |              |                                 |
|                       v              v              v                                 |
|                RAG / VectorDB    Tools/APIs     Code Exec / Browser / Shell           |
|                Knowledge Base    MCP Servers    Plugins / Webhooks                    |
|                       |              |              |                                 |
|                       +------+-------+--------------+                                 |
|                                      v                                                |
|          Final Output / DB Write / Email / Webhook / Ticket / File / Command          |
+---------------------------------------------------------------------------------------+

HIGH IMPACT REQUIRES ANY OF:
  - LLM has access to private/sensitive data (RAG, memory, tool reads)
  - LLM can call tools / APIs / send emails / modify state
  - LLM output is rendered or executed by another system
  - LLM can persist memory across users/sessions
  - LLM consumes attacker-controlled external content (indirect injection)

00.1 Severity / CVSS Rating Guide

00.2 Master Payload Reference

01. Recon & Enumeration

01.1 Discover AI Endpoints

  • MCP Enum

  • Burp Request Analysis Checklist

01.2 Model & Provider Fingerprinting

  • Direct probes

  • System prompt delimiter fingerprints

<|im_start|>system

tiktoken / OpenAI format

[INST] <>

Llama 2 format

<|begin_of_text|>

Llama 3 format

Human: / Assistant

Claude legacy format

<system>

Generic XML-style

SYSTEM:

Mixtral / custom

01.3 Tool Inventory Probes

02. Direct Prompt Injection

02.1 Basic Override Payloads

  • Canary override

  • Role override

  • Policy bypass framing

02.2 Instruction Hierarchy Confusion

  • Fake developer injection

  • Privilege escalation via claim

  • Emergency framing (crescendo seed)

  • Fake prompt delimiter injection

02.3 Format Smuggling

  • JSON wrapper injection

  • HTML comment exfil

  • XML extraction

02.4 Multi-Turn Crescendo Attack

  • Crescendo chain

  • Memory anchor + trigger

03. System Prompt Leakage (LLM07)

03.1 Direct Extraction Payloads

  • Verbatim extraction

  • Structured extraction

03.2 Indirect / Covert Extraction

03.3 PLeak / Reconstruction Technique

04. Indirect Prompt Injection (LLM01 - Priority Attack)

Documented by Greshake, Abdelnabi et al. (2023). Attacker-controlled external content contains instructions executed by the LLM when processing that content. Zero-click for the victim. This is the #1 real-world LLM exploit primitive (EchoLeak CVE-2025-32711, ShadowLeak, ForcedLeak)

04.1 Web Page Injection

04.2 Document / RAG Injection

04.3 Email / Ticket Injection

04.4 Invisible Unicode Tag Injection

Unicode Tag block (U+E0000-U+E007F): renders completely invisible in UI but tokenized by the LLM. Cisco confirmed in 2024. Anthropic models prefer Unicode Tags; OpenAI prefer zero-width binary. Use ASCII Smuggler tool.

04.5 Full Attack Chain: Indirect Injection to Data Exfil

  • Defensive note

05. Jailbreaking

05.1 Classic Templates

05.2 Skeleton Key (Microsoft, June 2024)

Directly asks the model to augment its guidelines by adding a disclaimer instead of refusing. Once accepted, it complies with any request. All tested models complied: Llama 3, Gemini Pro, GPT-3.5/4o, Mistral Large, Claude 3 Opus, Cohere R+

05.3 Many-Shot Jailbreaking (Anthropic, April 2024)

Hundreds of fabricated harmful Q&A examples stuffed into the context window. Effectiveness follows a power law -- more shots = higher ASR. Works on Claude 2.0, GPT-3.5/4, Llama 2 70B, Mistral 7B. Scales with context window size.

05.4 Payload Encoding / Obfuscation Bypass

05.5 Automated / Optimization-Based Jailbreaks

06. Agentic & Tool Abuse (LLM06 / LLM05)

06.0 Tool Access Mental Model

06.1 Tool Inventory & Parameter Fuzzing

06.2 Tool Parameter Injection (SQLi / CMDi / SSRF)

06.3 Code Interpreter

07. MCP (Model Context Protocol) Security

MCP is the dominant agentic integration layer. Malicious or compromised MCP tool descriptions are injected directly into LLM context via the tools/list endpoint. The LLM treats tool descriptions as authoritative instructions.

08. RAG & Vector / Embedding Attacks (LLM08 / LLM04)

08.0 RAG Architecture Checklist

08.1 Cross-Tenant Retrieval

08.2 RAG Poisoning (PoisonedRAG)

08.3 Embedding Inversion / Membership Inference

08.4 Improper Output Handling (LLM05)

XSS via LLM Output

SQL Injection via Tool Parameters

Command Injection via Tool Parameters

09. Sensitive Information Disclosure (LLM02)

10. Supply Chain Security (LLM03)

11. Unbounded Consumption / Cost DoS (LLM10)

12. Automated Testing Tooling

12.1 garak (NVIDIA) - Broad Vulnerability Scanner

12.2 PyRIT (Microsoft) Multi-Turn Campaign Framework

12.3 promptfoo - CI/CD Regression Testing

12.4 Giskard

13. Others

13.1 Inference Framework RCE CVEs

14. Attack Paths

Path 1 | Direct Injection to System Prompt Leak

Path 2 | Injection to Unauthorized Tool Access (BOLA/BFLA)

Path 3 | Indirect Injection via RAG to Agent Behavior

Path 4 | Indirect Injection via Web Page to Tool Callback

Path 5 | LLM Output to Stored XSS

Path 6 | Agent SSRF via Fetch/Browse Tool

Path 7 | Coding Agent Repo Prompt Injection

Path 8 | Memory Poisoning for Persistence

Path 9 | Cross-Agent Privilege Escalation

15. Remediation Checklist

Last updated