Simple definition#
AI security protects systems built on machine learning, especially large language models (LLMs) and AI agents, from manipulation, data leakage, misuse and failure. It also protects people and organisations from harm caused by those systems.
The problem#
LLMs mix instructions and data in the same channel (text). Any text the model reads, whether a user prompt, an email, a web page, a PDF or a tool result, can try to change its behaviour. When the model can also act by calling tools, moving money, sending emails or running code, a manipulated model becomes a manipulated employee with system access.
Threat landscape#
OWASP Top 10 for LLM Applications (2025)#
| # | Risk | One-line example |
|---|---|---|
| LLM01 | Prompt Injection | A hidden instruction in an uploaded document makes the assistant leak data |
| LLM02 | Sensitive Information Disclosure | The model reveals other customers’ data or secrets |
| LLM03 | Supply Chain | A poisoned model, dataset, plugin or package |
| LLM04 | Data and Model Poisoning | Manipulated training or fine-tuning data plants a backdoor |
| LLM05 | Improper Output Handling | Model output rendered as HTML or executed as SQL causes XSS or injection |
| LLM06 | Excessive Agency | The agent has more tools, permissions or autonomy than needed |
| LLM07 | System Prompt Leakage | Secrets or logic in system prompts get exposed |
| LLM08 | Vector and Embedding Weaknesses | RAG returns documents the user may not see; embedding inversion |
| LLM09 | Misinformation | Confident hallucinations drive wrong decisions |
| LLM10 | Unbounded Consumption | Token floods, runaway agent loops, denial of wallet |
OWASP Top 10 for Agentic Applications (2026)#
Published in December 2025 for agents that plan, use tools and act:
| ID | Risk |
|---|---|
| ASI01 | Agent Goal Hijack: content the agent reads redirects its objective |
| ASI02 | Tool Misuse and Exploitation |
| ASI03 | Identity and Privilege Abuse: agents inheriting or escalating credentials |
| ASI04 | Agentic Supply Chain Vulnerabilities: tools, MCP servers, agent registries |
| ASI05 | Unexpected Code Execution |
| ASI06 | Memory and Context Poisoning |
| ASI07 | Insecure Inter-Agent Communication |
| ASI08 | Cascading Failures |
| ASI09 | Human–Agent Trust Exploitation: users over-trusting or being manipulated |
| ASI10 | Rogue Agents: needs behavioural monitoring and kill switches |
MITRE ATLAS catalogues real adversarial tactics and techniques against AI systems, in ATT&CK style, for red teaming and detection.
Prompt injection: why it is hard#
- Direct injection: the user types “ignore previous instructions…”.
- Indirect injection: the attack is in content the model processes, such as an email, web page, PDF, code comment, calendar invite or tool output. The user may be the victim, not the attacker.
- There is no complete fix today. Models cannot reliably separate instructions from data. Classifiers and “guardrail” models reduce the risk but can be bypassed.
Design patterns that limit the blast radius:
| Pattern | Idea |
|---|---|
| Least agency | Expose only the tools and permissions the task needs; read-only by default |
| Human-in-the-loop | Require approval for consequential actions (payments, emails, deletions) |
| User-scoped credentials | Tools act as the user (delegated OAuth), never with a god-mode service account |
| Plan-then-execute / dual LLM | A privileged planner never reads untrusted content; a quarantined model processes untrusted data and returns structured, validated values |
| Action-selector | The model picks from a fixed set of safe actions instead of generating free-form calls |
| Taint tracking (CaMeL-style) | Track which values came from untrusted sources and block them from flowing into sensitive tool parameters |
| Output encoding and validation | Treat model output as untrusted input: escape it, validate it against schemas, and never execute it directly |
Reference architecture: defence in depth#
| Layer | Controls |
|---|---|
| AI gateway | Authentication, rate and token limits, input and output guardrails (injection and jailbreak classifiers, PII detection and redaction, topic filters), model routing, cost quotas |
| Application / agent | Hardened system prompts (no secrets in them), structured outputs, tool allow-lists, step and budget limits, loop detection |
| Retrieval (RAG) | Permission-aware retrieval (filter by the user’s ACLs at query time), document classification, source attribution, content sanitisation |
| Tools / MCP | Least privilege, user-delegated OAuth, input validation, sandboxed execution, approval for risky actions, idempotency |
| Authorisation | A policy engine (OPA, Cedar) decides each tool call from user, agent, action, resource and context |
| Model | Vetted provider or model with a contract (no training on your data, data residency); or self-hosted with signed weights |
| Observability | Full traces of prompts, retrieved documents, tool calls and decisions (with PII handling); anomaly detection; evaluation results |
RAG and data leakage#
- Never put all documents in one shared index and rely on the prompt to “only answer from allowed docs”. Filter in the retriever using the requesting user’s entitlements, and propagate document ACLs into vector metadata.
- Classify documents and exclude restricted classes from general assistants.
- Watch for embedding inversion and membership inference. Treat embeddings as sensitive as their sources.
- Sanitise retrieved content (strip hidden text and active content) and mark it as untrusted data in the prompt.
Tool, MCP and agent security#
- MCP (Model Context Protocol) servers are code with access. Vet them like dependencies:
- pin versions and verify publishers
- run them in sandboxes
- restrict network egress
- use the protocol’s OAuth-based authorisation for remote servers
- beware tool poisoning (malicious tool descriptions) and rug pulls (tools changing after approval).
- Agent identity: give each agent its own identity (workload identity, SPIFFE), scoped credentials and an audit trail. Distinguish “agent acting on behalf of user X” from “agent acting autonomously”.
- Inter-agent communication (A2A and similar protocols): authenticate agents, sign messages, validate inputs, and do not let one agent’s output become another’s instructions without checks.
- Kill switches and budget limits for autonomous agents; behavioural monitoring for rogue behaviour.
Supply chain and model integrity#
- Use models and datasets from trusted sources; verify hashes and signatures (model signing with Sigstore-based tooling, OpenSSF model signing); scan model files (pickle deserialisation risks); prefer safetensors.
- Keep an AI-BOM: models, versions, datasets, prompts, tools.
- Control fine-tuning data provenance to prevent poisoning.
Red teaming and evaluation#
- Before release: automated adversarial testing (open-source tools such as garak, PyRIT and promptfoo), plus human red teaming focused on your tools and data.
- Evaluate continuously: injection resistance, data leakage, harmful output, hallucination rate on your domain, tool-use correctness.
- Regression-test every prompt, model or tool change, the same way as code.
Governance frameworks#
| Framework | What it gives you |
|---|---|
| NIST AI RMF 1.0 + Generative AI Profile (NIST AI 600-1) | Govern, Map, Measure, Manage functions; GenAI-specific risks and actions |
| ISO/IEC 42001:2023 | Certifiable AI management system |
| ISO/IEC 23894 | AI risk management guidance |
| EU AI Act | Risk-based legal obligations (see FinTech regulations) |
| OWASP AI Exchange, CSA AI Controls Matrix | Control catalogues |
| Sector guidance | For example RBI’s FREE-AI framework (2025) for responsible AI in Indian financial services, and supervisory statements by the ECB, EBA and FCA |
Common mistakes#
Quick check#
What is indirect prompt injection? Malicious instructions hidden in content the model processes (documents, web pages, emails, tool outputs), rather than typed by the user.
Why can’t you just filter prompt injection? Models cannot reliably distinguish instructions from data. Classifiers reduce the risk but can be bypassed, so you must limit what a manipulated model can access and do.
What is excessive agency? Giving an LLM or agent more tools, permissions or autonomy than its task needs, which amplifies the damage from manipulation or errors.
How should RAG enforce access control? Filter retrieval by the requesting user’s entitlements, using ACL metadata on chunks. Never rely on the prompt to restrict answers.
Name three agentic-specific risks from the OWASP 2026 list. Agent goal hijack, tool misuse, identity and privilege abuse, memory poisoning, insecure inter-agent communication, cascading failures, rogue agents.
Which frameworks help govern AI risk? The NIST AI RMF with its Generative AI Profile, ISO/IEC 42001, the EU AI Act and sector guidance such as RBI FREE-AI.
Summary#
- Assume prompt injection succeeds; put the security boundary outside the model.
- Use least agency, user-scoped credentials, approvals, permission-aware RAG and validated outputs.
- Secure the supply chain (models, tools, MCP servers) and give agents identities and kill switches.
- Red-team, evaluate continuously, and govern with the NIST AI RMF, ISO 42001 and the EU AI Act.
References#
- OWASP GenAI Security Project, Top 10 for LLM Applications 2025 and Top 10 for Agentic Applications 2026.
- MITRE, ATLAS.
- NIST, AI Risk Management Framework and AI 600-1 Generative AI Profile.
- ISO/IEC 42001:2023.
- Model Context Protocol, Security best practices.
- Google DeepMind, Defeating Prompt Injections by Design (CaMeL).