AI Attacks Cheat Sheet
Attacks on AI – Cheat Sheet
Scope: conceptual overview (workflow, basic attack classes, how they work, defenses). No weaponized payloads. Verified against web sources (Oct 2026): OWASP Top 10 for LLM Applications 2025 (list names/order), MITRE ATLAS (exists, ATT&CK-style, ~16 tactics; technique counts differ between sources/versions, so check atlas.mitre.org for the current number). Marked [memory] = recalled from general knowledge, not checked against a source in this session.
1. Two worlds: classic ML vs. LLM apps
| Classic ML (classifiers, vision, fraud) | LLM / GenAI apps (chatbot, RAG, agents) | |
|---|---|---|
| Typical targets | Model weights, training data, decision boundary | Prompt, context, tools, retrieval data, output handling |
| Typical attacks | Evasion, poisoning, extraction, inference | Prompt injection, jailbreak, leakage, excessive agency |
| Core weakness | Model learns statistical patterns, not intent | Instructions and data share one channel (natural language) |
Key idea: an LLM cannot reliably separate instructions from data. This is the root cause of most LLM attacks.
2. Attack workflow (generic kill chain)
Maps loosely to MITRE ATLAS tactics (ATT&CK-style, left to right).
| # | Phase | Goal | AI-specific examples |
|---|---|---|---|
| 1 | Recon | Learn the target | Which model/vendor? Is there RAG, tools, plugins? Probe error messages, system prompt hints, public papers, model cards |
| 2 | Resource development | Prepare attack material | Build a surrogate model, craft poisoned data, prepare malicious docs/web pages |
| 3 | Initial access | Reach the AI system | Chat input, API, uploaded file, email/web page the AI will read, public model hub, dependency |
| 4 | Model access / staging | Get closer to the model | Query API (black-box), obtain weights (white-box), train proxy model |
| 5 | Execution | Make the AI act | Prompt injection, adversarial input, malicious model file (e.g. unsafe deserialization) |
| 6 | Persistence / defense evasion | Stay and avoid filters | Poisoned memory/RAG entry, modified agent config, obfuscated/encoded prompts |
| 7 | Collection / exfiltration | Steal something | System prompt, training data, PII from context, files via tool calls, model weights |
| 8 | Impact | Cause harm | Wrong decisions, bad output to users, cost/DoS, unauthorized actions, reputational damage |
Practical pentest loop for an LLM app:
- Map the app: inputs, tools, data sources, who sees the output.
- Identify trust boundaries: which text is attacker-controlled (user, web, email, docs)?
- Test basic attacks (section 3) per boundary.
- Chain: injection -> tool call -> data access -> exfil channel.
- Document with OWASP LLM ID + ATLAS technique, impact, fix.
3. Basic attacks and how they work
3.1 Prompt injection (OWASP LLM01)
- Direct: attacker types instructions that override the developer’s intent.
- Idea: “Ignore previous instructions and …” (classic, simple form).
- Indirect: instructions hidden in content the AI later reads (web page, email, PDF, ticket, image text, code comment).
- User never sees the attack; the AI treats the content as instructions.
- Real-world example class: zero-click email-based data leakage in an AI assistant (EchoLeak, CVE-2025-32711, reported 2025).
- Why it works: one text stream; the model follows the most persuasive/recent instruction.
- Defenses: treat all external content as untrusted, privilege separation, least-privilege tools, human approval for sensitive actions, output filtering, no secrets in prompts.
3.2 Jailbreaking
- Goal: bypass safety training/policies (distinct from prompt injection, which targets the app’s instructions).
- Common techniques (conceptual): role-play/persona framing, hypothetical/fiction framing, splitting a request across turns, encoding/obfuscation (base64, other languages, typos), many-shot examples in long context.
- Why it works: safety is learned behavior, not a hard rule; context can shift the model’s behavior.
- Defenses: layered input/output classifiers, adversarial training, red teaming, rate limiting, monitoring for repeated probing.
3.3 Sensitive information disclosure / system prompt leakage (LLM02, LLM07)
- Extract system prompt, hidden instructions, API keys placed in prompts, other users’ data in context, memorized training data.
- Why it works: the model can repeat anything in its context; training data can be memorized.
- Defenses: never put secrets in prompts, enforce access control outside the model, data minimization, output scanning.
3.4 Improper output handling (LLM05)
- LLM output is passed unchecked to a browser, shell, SQL, or API.
- Result: classic vulns via the LLM (XSS, SQLi, SSRF, command injection, markdown image exfiltration).
- Defenses: treat model output as untrusted user input; encode, validate, parameterize, sandbox.
3.5 Excessive agency (LLM06)
- Agent has too many tools/permissions/autonomy; an injected instruction triggers real actions (send mail, delete data, run code).
- Defenses: least privilege, scoped tokens, allowlists, confirmation for destructive/external actions, audit logs.
3.6 Data and model poisoning (LLM04)
- Attacker manipulates training, fine-tuning, or RAG data.
- Availability/untargeted: degrade accuracy.
- Targeted/backdoor: model behaves normally except on a trigger (specific phrase/pattern) [memory: terminology from NIST AI 100-2 / academic literature].
- Why it works: models trust their data; web-scale data is hard to vet.
- Defenses: data provenance, validation, anomaly detection, trusted sources, evaluate on held-out/backdoor tests.
3.7 Supply chain attacks (LLM03)
- Malicious or tampered pre-trained models, datasets, plugins, packages; unsafe model file formats that execute code on load (e.g. pickle-based) [memory].
- Defenses: verify hashes/signatures, prefer safe formats (e.g. safetensors) [memory], scan models, pin dependencies, private registries.
3.8 Vector and embedding weaknesses (LLM08)
- RAG-specific: poisoned documents in the vector DB, weak access control across tenants, retrieval of data the user must not see.
- Defenses: per-document/tenant access control at retrieval time, validate ingested content, monitor retrieval.
3.9 Adversarial examples / evasion (classic ML)
- Tiny, often imperceptible input changes cause misclassification (e.g. image noise, patches/stickers, malware byte tweaks).
- How: compute the gradient of the loss w.r.t. input (white-box, e.g. FGSM/PGD [memory]) or query repeatedly (black-box); examples often transfer between similar models.
- Defenses: adversarial training, input preprocessing, ensembles, robustness testing, don’t expose raw confidence scores.
3.10 Model extraction / theft
- Query the API many times, train a copy from input/output pairs.
- Defenses: rate limits, query monitoring, output rounding/limiting, watermarking, auth + quotas.
3.11 Privacy attacks (classic ML and LLMs)
- Membership inference: was this record in the training set? (model is more confident on training data)
- Model inversion / training data extraction: reconstruct or regurgitate training data.
- Defenses: differential privacy, regularization, deduplicate training data, limit output detail.
3.12 Unbounded consumption (LLM10)
- Resource exhaustion: huge prompts, loops in agents, token floods, “denial of wallet”, also used for extraction.
- Defenses: input/output limits, rate limiting, budgets, timeouts, loop detection.
3.13 Misinformation / overreliance (LLM09)
- Hallucinations or manipulated outputs trusted without verification (e.g. package-name hallucination leading to dependency confusion [memory]).
- Defenses: grounding/RAG with trusted sources, citations, human review, verify dependencies.
4. OWASP Top 10 for LLM Applications 2025 (quick list, verified)
| ID | Name |
|---|---|
| LLM01 | Prompt Injection |
| LLM02 | Sensitive Information Disclosure |
| LLM03 | Supply Chain |
| LLM04 | Data and Model Poisoning |
| LLM05 | Improper Output Handling |
| LLM06 | Excessive Agency |
| LLM07 | System Prompt Leakage (new in 2025) |
| LLM08 | Vector and Embedding Weaknesses (new in 2025) |
| LLM09 | Misinformation |
| LLM10 | Unbounded Consumption |
Note: for autonomous agents there is a separate OWASP Top 10 for Agentic Applications on top of this list.
5. Attacker knowledge levels
| Level | Access | Typical attacks |
|---|---|---|
| White-box | Weights, architecture, gradients | Gradient-based adversarial examples, backdoor insertion |
| Gray-box | Partial info (architecture, data type) | Surrogate models, transfer attacks |
| Black-box | Only inputs/outputs (API, chat) | Prompt injection, jailbreaks, extraction, query-based evasion |
6. Defense checklist (short)
- Threat model the whole pipeline (data -> training -> deployment -> tools -> output)
- Treat all model input and output as untrusted
- Least privilege for tools, tokens, data access; enforce authz outside the model
- No secrets in system prompts
- Human-in-the-loop for high-impact actions
- Validate/sanitize outputs before they reach interpreters (browser, shell, DB)
- Vet models, datasets, plugins; verify hashes; safe file formats
- Rate limits, quotas, logging, anomaly detection on queries
- Regular AI red teaming; map findings to OWASP LLM / MITRE ATLAS
- Incident process for model rollback and data/RAG cleanup
7. Frameworks and references
- OWASP Top 10 for LLM Applications 2025 (v2.0): https://genai.owasp.org
- MITRE ATLAS (ATT&CK-style matrix for AI): https://atlas.mitre.org
- NIST AI 100-2, Adversarial Machine Learning taxonomy [memory: check current edition]
- Practice (legal, intentionally vulnerable): Gandalf (Lakera), TryHackMe/HTB AI rooms, PortSwigger LLM labs [memory: verify current availability]