Skip to content
Ameen Abozaid
MID-071

AI application threats

  • 6 Lessons
  • 2.5 h practice (estimate)
On this page 8 topics

Overview

Topics

  • Indirect prompt injection through retrieved content
  • excessive agency
  • data exfiltration
  • cost abuse
  • mitigations

Learn first

2.5 h of practice (estimate)

Learning outcomes

  1. Explain the OWASP Top 10 for LLM Applications categories, including prompt injection, sensitive information disclosure, improper output handling, excessive agency, system prompt leakage, vector and embedding weaknesses, and unbounded consumption.
  2. Demonstrate indirect prompt injection through retrieved content and mitigate it (content provenance, separation of instructions and data, tool restrictions, output checks).
  3. Prevent data exfiltration through tools, links, and rendered output.
  4. Protect against cost and resource abuse with per-user quotas, input limits, and loop limits.
  5. Add these threats to the service's threat model and to automated security tests.

Lessons

  1. 01The LLM threat landscape
  2. 02Indirect prompt injection through retrieved content
  3. 03Excessive agency and improper output handling
  4. 04Sensitive data disclosure and system prompt leakage
  5. 05Unbounded consumption and cost abuse
  6. 06Demo: a poisoned help article hijacks the assistant, then the fix

Lab and exercises

Lab

MID-071-LAB1 · Attack the assistant

Outcomes: 1–5 · Time: ~3 h Write automated tests for: direct injection, indirect injection (a planted help article), reading another customer's data through tools, exfiltration through a generated link, and quota exhaustion. Run them, fix what fails, and update the threat model. Acceptance: all attack tests run in CI and pass after the fixes; threat model updated.

Exercises (assessment: threat-model the assistant)

IDOutcomeTask
MID-071-EX011Map five OWASP LLM categories to concrete threats against the order-support assistant.
MID-071-EX022Write a planted help article and a test that proves the assistant does not follow it.
MID-071-EX032Explain why the system-prompt defense alone fails and list three stronger layers.
MID-071-EX043The assistant renders markdown. Design the control that stops data leaking through image and link URLs.
MID-071-EX054Define quotas and loop limits for the assistant, with values and the alert on breach.
MID-071-EX065Add three assistant threats to the STRIDE table with mitigations and the test that covers each.
Show solutions
  • EX01 Example: prompt injection (planted article), sensitive disclosure (other customers' orders), improper output handling (HTML in answers), excessive agency (refund tool), unbounded consumption (long loops).
  • EX02 The article instructs a refund; the test asks about the order and asserts no refund request was created and no foreign link is in the answer.
  • EX03 Models can be talked out of rules. Layers: untrusted-data labeling, tool restriction and approval, output validation, domain allowlist, least-privilege tokens.
  • EX04 Allowlist of image and link domains, strip other URLs, no auto-loading of remote images, escape output.
  • EX05 Example: 4 000 input characters, 6 steps, 30 s, 50 000 tokens per user per day; alert when daily spend exceeds the budget or one user exceeds 5x the median.
  • EX06 Each row: element, STRIDE letter, threat, mitigation, test ID; the tests are those from the lab.

Outcome 1 is also covered by quiz Q01–Q03; outcome 5 by the lab criterion "threat model updated".

Quiz

Outcomes: O1 OWASP LLM categories · O2 indirect injection · O3 exfiltration · O4 cost abuse · O5 threat model and tests.

A self-check for you: nothing is graded, saved or sent anywhere. Choose an answer, then check it. You can try again as often as you like.

  1. 1Why are LLM apps prone to injection?O1
  2. 2"Excessive agency" means:O1
  3. 3Treating model output as raw HTML is:O1
  4. 4Indirect prompt injection arrives through:O2
  5. 5Which defense is enforced outside the model?O2
  6. 6Content from your own index should be:O2
  7. 7To stop exfiltration via links in output:O3
  8. 8Secrets in the system prompt should be:O3
  9. 9A control against cost abuse is:O4
  10. 10Attack tests for the assistant should:O5

Practical part

Threat-model the assistant (rank the top five risks with mitigations) plus lab MID-071-LAB1. Pass: quiz at least 8/10, all attack tests in CI and passing after fixes, and an updated threat model.

Common mistakes

Relying on "ignore malicious instructions" in the system prompt as the only defense; trusting content because it came from your own index; rendering model output as HTML or executing it.

Assessment

Threat-model the order-support assistant and rank the top five risks with mitigations.

Career relevance

AI security architecture (ARC-046) and responsible AI (SRA-022).

Type to search levels, phases, modules and lessons.