Topic 4 of 5 · 4 min read
Mitigations mapped to each OWASP risk
Goal: Choose the most effective mitigation for a given OWASP risk in a concrete design.
For each OWASP risk, pick the control that removes the harm even when the model misbehaves, and prefer a design change over a filter that tries to catch bad text. A filter can be bypassed with rewording. A permission the agent does not have cannot be abused.
Check yourself · 1 of 3
Which mitigation best reduces excessive agency in an email assistant?
Why it matters
Teams often answer every risk with "add a guardrail prompt" or "add a content filter". These help a little and fail often, because models follow instructions imperfectly and attackers try many phrasings. The strongest controls are structural: less access, fewer tools, checks in code and human confirmation for risky actions.
The control that helps most
| Risk | Strongest control | Weaker, still useful |
|---|---|---|
| LLM01 Prompt Injection | Treat all retrieved text as untrusted, and limit what the model can do after reading it. | Input filters, instruction hierarchy. |
| LLM02 Sensitive Information Disclosure | Keep secrets and other users' data out of the model's reach. | Output scanning. |
| LLM05 Improper Output Handling | Encode or validate output for its destination, like any user input. | Asking the model to be safe. |
| LLM06 Excessive Agency | Least privilege: fewer tools, narrow scopes, human approval for irreversible steps. | Prompt rules. |
| LLM07 System Prompt Leakage | Put no secrets in the prompt; enforce rules in code. | Telling the model not to reveal it. |
| LLM08 Vector Weaknesses | Apply access control at query time. | Separate indexes per tenant. |
| LLM10 Unbounded Consumption | Hard limits on tokens, rate, steps and spend. | Monitoring alone. |
| ASI03 Identity and Privilege Abuse | Task-scoped, short-lived credentials per agent. | Audit logs. |
How to choose
- State the worst outcome if the model does exactly what an attacker wants.
- Ask which control would make that outcome impossible, not unlikely.
- Add detection and logging as a second layer, never the only one.
Before and after
Weak plan: "Risk: the agent may delete customer files. Mitigation: system prompt says never delete files." Better plan: "Remove the delete tool. The agent gets read and create only. Deleting goes through a separate request that a person approves in the admin UI."
What goes wrong
- Filter-only defences. They block the demo attack and miss the next one.
- Secrets in prompts. Anything in the prompt can be extracted, so a prompt is not a vault.
- One control for many risks. A single guardrail layer does not fix identity, cost or retrieval access.
Examples
Fixing an excessive agency finding
Finding: a travel booking agent can cancel any booking. A weak fix adds "only cancel when asked" to the prompt. A strong fix has the cancel tool take the signed-in user's id from the session, refuse bookings owned by someone else, and ask for confirmation in the interface before it runs.
Key points
- Prefer controls that make harm impossible over controls that make it unlikely.
- Least privilege and narrow tools beat prompt rules for excessive agency.
- Model output is untrusted input to whatever consumes it.
- Access checks belong in the retrieval query and the tool code, not in the prompt.
- Detection and logging are a second layer, not a substitute for a structural fix.
Common mistakes
- Proposing a guardrail prompt as the only mitigation for a high-impact risk.
- Storing API keys or business rules in the system prompt and trusting it to stay private.
- Checking access in the prompt text instead of in the retrieval or tool code.
Check yourself · 2 of 3
Why should API keys not be placed in the system prompt?
Check yourself · 3 of 3
Where should per-user access checks for a RAG assistant be enforced?
Practice items, not counted towards your mastery.
Start here
- OWASP Top 10 for LLM Applications (opens in a new tab)DocsFree
The official 2025 list of ten LLM application risks, each with examples, attack scenarios and mitigations.
- OWASP Top 10 for Agentic Applications for 2026 (opens in a new tab)DocsFree
The official list of agent-specific risks, from goal hijack to rogue agents.
- LLM10:2025 Unbounded Consumption (OWASP GenAI) (opens in a new tab)ArticleFree
Describes denial of wallet, input overflow and model extraction with prevention steps.
More for this topic
- LLM Prompt Injection Prevention Cheat Sheet (OWASP) (opens in a new tab)ArticleFree
Practical controls for the top-ranked LLM risk, useful in reviews.