Prompt injection threat modeling means mapping every place untrusted text can reach your model, every action the model can take, and every route data can leave, then deciding which combinations are too risky. It's the same exercise security teams already do for web apps, with one big assumption added: anything the model reads can give it instructions.
You don't need special software. A whiteboard, an hour and the four questions below will get you most of the way.
The four questions
A 2024 paper on threat modeling LLM apps builds on Adam Shostack's four question framework (Tete, arXiv):
- What are we working on?
- What can go wrong?
- What are we going to do about it?
- Did we do a good job?
The rest of this post answers each one for prompt injection.
Step 1: Draw the data flow
Sketch your app as boxes and arrows. Include:
- Where user input comes in.
- Every outside source the model reads: web pages, uploaded files, emails, search results, tool responses, other agents.
- Every tool or API the model can call.
- Every data store it can read.
- Every way output leaves: the chat window, rendered links and images, emails, API calls, files.
In a June 2023 threat model for LLM apps, Gavin Klondike drew three trust boundaries: between users or outside sources and the model, between the model and backend tools, and between the model and private data (AI Village). He treated the first boundary as two way, because the model's output can't be trusted either.
Step 2: Ask what can go wrong with STRIDE
STRIDE is a checklist of six threat types. The Tete paper calls it the "ideal foundational model" for LLM apps and places prompt injection under Tampering. Here's how each category tends to show up:
| STRIDE | What it looks like in an LLM app |
|---|---|
| Spoofing | Injected text pretends to be the system or an admin |
| Tampering | Instructions hidden in a document change the model's task |
| Repudiation | No log of which document caused an action |
| Information disclosure | The model leaks private data or its system prompt |
| Denial of service | Injected loops or huge outputs burn tokens |
| Elevation of privilege | The model uses a tool the user couldn't use directly |
To score each threat, the same paper uses DREAD: damage, reproducibility, exploitability, affected users and discoverability. Even a rough high, medium or low rating is enough to sort your list.
Step 3: Look for the lethal trifecta
Simon Willison names one combination worth checking for first. An agent with access to private data, exposure to untrusted content, and a way to communicate externally can be tricked into stealing that data (Simon Willison). His advice is to avoid combining all three.
On your diagram, mark each component that:
- reads private data,
- reads anything an outsider could write, and
- can send data out, including by rendering an image or link.
If one flow touches all three, that's your top risk. Read more in The Lethal Trifecta.
Step 4: Decide what to do about it
Klondike's recommendations still hold up well:
- Treat all model output as untrusted. Validate it before it reaches other functions, the browser or a database.
- Enforce authorization outside the model. As he puts it, LLMs "do not adhere to authorization controls internally." Give the model the same access checks as a normal user.
- Limit the attack surface. Expose only the tools and data the task needs.
- Filter what tools return before it goes back into the model.
For each threat in your table, write down which control addresses it, who owns it, and what's left over. Common answers include removing a tool, requiring a human to approve risky actions, blocking external images, and separating untrusted content. How to Prevent Prompt Injection covers the full set.
Step 5: Check your work
A threat model is a set of guesses until you test it. For each high-risk flow, write a test that tries to cross the boundary with a harmless payload. If you're worried a web page could make your agent send email, plant a page that asks it to email [email protected] and confirm it doesn't. Our canary payloads cover the common paths.
Then revisit the model whenever you add a tool, a data source or an output channel. Those are exactly the changes that create new routes for injection.
A one page template
- System: name and purpose
- Untrusted inputs: list each source
- Private data: list each store
- Actions and outputs: list each tool and channel
- Trifecta flows: any path touching all three
- Top threats: STRIDE category, rating, control, owner
- Tests: one canary per high risk flow
- Review date
For agent-specific risks to add to your list, see AI Agent Prompt Injection. Then start testing your highest risk flow with our canary payloads.