Where an LLM application can break

Unit 1 of 5 in Securing LLM applications.

You will be able to draw the pipeline of an LLM application, place the OWASP Top 10 risks on it and state three rules that carry through the class.

Lesson

A pipeline with one text channel

Most LLM applications do the same few things. They take a request from a user, build a prompt from a fixed instruction text, the request and sometimes retrieved documents, send it to a model, then use the model's answer: show it in a page, put it into a database query, or call a tool. Draw those steps as boxes. Each arrow between boxes is a place where a defender asks 'who controls this text?'.

The OWASP prompt injection cheat sheet explains what is new. In most designs the natural language instructions and the data are processed together, without a clear separation. In a web application, a database query keeps code and data apart with parameters; in a prompt, both are just words. The same cheat sheet describes the typical weakness plainly: a program that joins its own instructions and the user's input into one string, so the model treats an instruction hidden in the input as a legitimate change of instructions. Everything else in this class follows from that one fact.

The OWASP Top 10 for LLM applications as a map

The OWASP GenAI Security Project's 2025 list has ten entries: prompt injection, sensitive information disclosure, supply chain, data and model poisoning, improper output handling, excessive agency, system prompt leakage, vector and embedding weaknesses, misinformation and unbounded consumption. Read them as places on your pipeline, not as a checklist of unrelated bugs. This grouping is our own, for learning: what comes in (prompt injection), what is fed in (data and model poisoning, vector and embedding weaknesses), what you downloaded (supply chain), what comes out (improper output handling, sensitive information disclosure, system prompt leakage, misinformation), what the system can do (excessive agency) and what it costs (unbounded consumption).

The page describes improper output handling as insufficient validation, sanitization and handling of model outputs before they are passed to other components, and excessive agency as the ability to call functions or interface with other systems that a developer grants an LLM system. Units 2 to 5 of this class take these in turn.

NIST's vocabulary for attacks on AI systems

NIST published AI 100-2 E2025, a taxonomy and terminology of adversarial machine learning attacks and mitigations, in March 2025. Its abstract says the report classifies attacks by the type of machine learning method, the life cycle stage of the attack, and the attacker's goals, objectives, capabilities and knowledge, and describes methods for mitigating and managing their consequences. Its keywords include data poisoning, evasion, privacy breach and abuse, with large language models and chatbots among the subjects.

You do not need the whole report to benefit. The point is that attacks are classified by when they strike (training, deployment) and what the attacker wants, which is a better start for a threat model than a list of scary prompts. A shared vocabulary also lets you read a vendor advisory or a paper without translating.

Three rules that carry the class

Rule 1: treat the model as an untrusted user. OWASP's guidance on output handling says to treat the model like any other user, with a zero-trust approach, and to validate what comes back from it before it reaches backend functions. Rule 2: keep power outside the model. OWASP's guidance on excessive agency says to implement authorization in downstream systems rather than relying on the model to decide whether an action is allowed, and the prompt injection cheat sheet says to keep authorization and least-privilege controls outside the model. Rule 3: test, and say what the test does not prove. The same cheat sheet's own examples are labelled a smoke test, not a security benchmark.

The agent cheat sheet adds a fourth worry that belongs on your list from the start: sensitive data, such as personal data or credentials, can end up in an agent's context or logs without anyone intending it. Know what your application sends and stores before you decide what to defend.

Key points

Sources

Lecture

Security engineering for AI systems: A plain-words tour of the new risks in AI and LLM systems, the map this class then walks unit by unit.

Practice in the labs

Start with three small, beginner labs about what an AI assistant sends and receives, and what a browser extension may see.

Knowledge check

  1. Why is prompt injection different from SQL injection? Answer: In most LLM designs instructions and data travel together as natural language, with no clear separation like a query parameter. The OWASP cheat sheet says prompt injection exploits the common design where natural language instructions and data are processed together without clear separation. A parameterized query separates code from data; a prompt has no equivalent boundary.
  2. Where should authorization for an agent's action be enforced? Answer: In the downstream system, outside the model. OWASP's excessive agency guidance calls this complete mediation: validate every request to downstream systems against policy instead of relying on the model to decide if an action is allowed.
  3. What does 'treat the model as an untrusted user' mean for a developer? Answer: Validate and encode its output before using it in a page, a query or a command. OWASP's output handling guidance says to apply a zero-trust approach and validate responses from the model before passing them to backend functions, because model output can be influenced by prompt input.
  4. What is NIST AI 100-2 E2025 mainly useful for? Answer: A shared taxonomy and terminology of attacks on AI systems and their mitigations. NIST describes it as a taxonomy and terminology of adversarial machine learning attacks and mitigations, classified by method, life cycle stage and attacker goals, meant to give a common language for assessing and managing AI security.

Back to the syllabus or see all classes.

Related