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 targetsModel weights, training data, decision boundaryPrompt, context, tools, retrieval data, output handling
Typical attacksEvasion, poisoning, extraction, inferencePrompt injection, jailbreak, leakage, excessive agency
Core weaknessModel learns statistical patterns, not intentInstructions 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).

#PhaseGoalAI-specific examples
1ReconLearn the targetWhich model/vendor? Is there RAG, tools, plugins? Probe error messages, system prompt hints, public papers, model cards
2Resource developmentPrepare attack materialBuild a surrogate model, craft poisoned data, prepare malicious docs/web pages
3Initial accessReach the AI systemChat input, API, uploaded file, email/web page the AI will read, public model hub, dependency
4Model access / stagingGet closer to the modelQuery API (black-box), obtain weights (white-box), train proxy model
5ExecutionMake the AI actPrompt injection, adversarial input, malicious model file (e.g. unsafe deserialization)
6Persistence / defense evasionStay and avoid filtersPoisoned memory/RAG entry, modified agent config, obfuscated/encoded prompts
7Collection / exfiltrationSteal somethingSystem prompt, training data, PII from context, files via tool calls, model weights
8ImpactCause harmWrong decisions, bad output to users, cost/DoS, unauthorized actions, reputational damage

Practical pentest loop for an LLM app:

  1. Map the app: inputs, tools, data sources, who sees the output.
  2. Identify trust boundaries: which text is attacker-controlled (user, web, email, docs)?
  3. Test basic attacks (section 3) per boundary.
  4. Chain: injection -> tool call -> data access -> exfil channel.
  5. 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)

IDName
LLM01Prompt Injection
LLM02Sensitive Information Disclosure
LLM03Supply Chain
LLM04Data and Model Poisoning
LLM05Improper Output Handling
LLM06Excessive Agency
LLM07System Prompt Leakage (new in 2025)
LLM08Vector and Embedding Weaknesses (new in 2025)
LLM09Misinformation
LLM10Unbounded Consumption

Note: for autonomous agents there is a separate OWASP Top 10 for Agentic Applications on top of this list.


5. Attacker knowledge levels

LevelAccessTypical attacks
White-boxWeights, architecture, gradientsGradient-based adversarial examples, backdoor insertion
Gray-boxPartial info (architecture, data type)Surrogate models, transfer attacks
Black-boxOnly 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]