Guide
AI Agent Security Risks: A Field Guide
The security risks AI agents bring into production: prompt injection, excessive agency, privilege abuse, tool poisoning, exfiltration and drift, with the controls for each.
Updated
An AI agent is a language model with credentials and tools. It reads untrusted content, decides what to do next, and acts on real systems: it sends email, queries databases, opens pull requests, moves files. That is why its security risks are different from a chatbot's. A chatbot that is fooled says something wrong; an agent that is fooled does something wrong, with whatever access it was given.
This guide lists the risks security teams run into once agents leave the demo and reach production, where each one lives, how it shows up, and the controls that contain it. Where a risk matches a category in the OWASP Top 10 for Agentic Applications, the category is named so you can map it to your own threat model. Each risk links to the articles on this site that go deeper.
At a glance
| Risk | Where it lives | First control |
|---|---|---|
| Prompt injection and goal hijack (ASI01) | Everything the agent reads | Scope tools so an injection can't reach much |
| Excessive agency and tool misuse (ASI02) | The tools an agent may call | Enforce per-call policy on each tool |
| Identity and privilege abuse (ASI03) | Credentials and roles the agent holds | One identity and one owner per agent |
| Credential and secret exposure | API keys, tokens and environment variables | Broker secrets so the model never sees them |
| Tool poisoning and supply chain compromise (ASI04) | MCP servers, plugins and tool registries | Allow-list and pin every tool server |
| Unexpected code execution (ASI05) | Agents that write and run code | Sandbox execution and lock down egress |
| Memory and context poisoning (ASI06) | Long-term memory and retrieval stores | Control who can write to agent memory |
| Insecure communication between agents (ASI07) | Agent-to-agent messages and sessions | Authenticate and sign agent-to-agent traffic |
| Data exfiltration | Sensitive data the agent can read | Scope data access and restrict egress |
| Cascading failures (ASI08) | Multi-agent workflows | Separate duties between agents |
| Human-agent trust exploitation (ASI09) | The person approving the agent's actions | Approve only high-stakes actions, shown exactly |
| Rogue behaviour and drift (ASI10) | Agents running for weeks or months | Baseline each agent and alert on drift |
| Shadow agents | Agents nobody approved | Build an inventory of every running agent |
| Missing audit trail | Logs of what the agent did | Log every action with its context and identity |
The risks, one by one
1. Prompt injection and goal hijack
OWASP Agentic Top 10: ASI01
An agent's instructions and its data arrive in the same channel: natural language. Text planted in a web page, PDF, email, ticket or tool response can be read as an instruction and quietly change what the agent is trying to do. The user never has to type anything malicious; the agent only has to read it.
How it shows up
- The agent takes an action no one asked for right after reading external content.
- Tool calls whose parameters (recipients, URLs, file paths) don't come from the user's request.
- Hidden text, odd formatting or instructions addressed to 'the assistant' inside retrieved documents.
What contains it
- Treat everything retrieved as data, never as instruction, and keep it out of the system prompt.
- Limit what a successful injection can reach: scope tools and credentials to the task, not the user.
- Require approval before irreversible actions that follow from external content.
- Test with injected documents before release and keep testing after.
Go deeper
2. Excessive agency and tool misuse
OWASP Agentic Top 10: ASI02
The agent never touches a forbidden tool; it uses an allowed one in a way nobody intended. Broad tools (run any shell command, call any API endpoint, write any table) and missing limits on their parameters turn small mistakes or manipulations into large actions.
How it shows up
- A low-risk tool called at unusual volume or with unusual arguments.
- Chains where a harmless call's output feeds a more powerful one.
- Tools that can do far more than the workflow needs, 'just in case'.
What contains it
- Give each tool the narrowest interface the task needs, with allowed and forbidden parameter ranges.
- Enforce policy at runtime, on each call, rather than only logging calls afterwards.
- Put an authorization gate between low-privilege calls and high-privilege ones.
- Rate-limit tools and validate tool output before it feeds the next step.
Go deeper
3. Identity and privilege abuse
OWASP Agentic Top 10: ASI03
Agents often run under a human's credentials or a shared service account, so their reach is whatever that identity has accumulated, not what the task requires. Delegation hides who actually acted, and an agent that caches a session can reuse it for something unrelated later.
How it shows up
- Agents authenticating as people, or many agents sharing one service account.
- Long-lived tokens with broad scopes and no owner on record.
- Audit logs that can't tell the agent's actions from the user's.
What contains it
- Give every agent its own identity, with a named owner.
- Apply least privilege per task, and prefer short-lived, just-in-time grants over standing access.
- Use delegated tokens that carry both the user and the agent, so actions stay attributable.
- Review agent permissions on a schedule and when the agent's job changes.
Go deeper
4. Credential and secret exposure
Agents handle secrets constantly: they read config files, print environment variables while debugging, paste tokens into tool calls and write them into logs, memory or generated code. A leaked agent credential is usually a machine credential, without the MFA or behavioural checks that would slow down misuse of a human's.
How it shows up
- Keys in prompts, traces, agent memory or committed code.
- Secrets shipped to the browser in a front-end bundle.
- Credentials that are never rotated because nobody knows which agent uses them.
What contains it
- Keep secrets in a vault and broker them to tools server-side, so the model never sees them.
- Scan prompts, logs and agent-written code for secrets, not only commits.
- Rotate keys on a schedule and revoke them when an agent is retired.
Go deeper
5. Tool poisoning and supply chain compromise
OWASP Agentic Top 10: ASI04
Agents assemble their capabilities at runtime from MCP servers, plugins and registries. A tool's description is read by the model as instruction, so a malicious or silently updated tool can steer the agent from the moment it is registered, and impersonated services can intercept what the agent sends them.
How it shows up
- Tool descriptions that contain instructions unrelated to the tool's job.
- Third-party servers that change behaviour or descriptions between versions.
- Agents connecting to tools nobody approved.
What contains it
- Allow-list tools and MCP servers; pin versions and review description changes.
- Authenticate the servers agents connect to, and scope each one's authorization.
- Monitor tool registration and calls at runtime, since build-time scanners don't see them.
Go deeper
6. Unexpected code execution
OWASP Agentic Top 10: ASI05
Coding agents and agents with a shell generate code and run it, so the agent can produce its own exploit, or simply run a destructive command because it misread the situation. A weak sandbox turns either into access to the host, the network and production data.
How it shows up
- Agents running code on developer machines or shared hosts with real credentials.
- Unrestricted outbound network access from agent containers.
- Destructive commands (deletes, migrations, force pushes) with no approval step.
What contains it
- Run agent code in isolated sandboxes with no standing production credentials.
- Restrict egress to the hosts the task needs, and filter syscalls at the kernel.
- Gate destructive operations behind human approval or a separate, narrower identity.
Go deeper
7. Memory and context poisoning
OWASP Agentic Top 10: ASI06
Agents keep memory across sessions and draw on shared retrieval stores. Anyone who can write to them can bias every later decision without touching the model or a prompt. Memory also collects sensitive data as a side effect, so it becomes a store that needs the same protection as a database.
How it shows up
- Retrieval stores that many systems or users can write to without review.
- Customer or personal data persisting in agent memory beyond the task.
- Agent behaviour that changes after a memory update rather than a code change.
What contains it
- Control and log who can write to memory and vector stores; separate them per tenant.
- Set retention limits and redact sensitive data before it is stored.
- Track where each memory entry came from so poisoned entries can be found and removed.
Go deeper
8. Insecure communication between agents
OWASP Agentic Top 10: ASI07
In multi-agent systems, messages between agents carry instruction-level authority, yet they often lack authentication, integrity checks and replay protection. A spoofed or tampered message, or a hijacked session, lets an attacker speak with another agent's authority.
How it shows up
- Agents accepting instructions from any peer that can reach them.
- Sessions and tokens reused across steps or agents.
- No way to tell, after the fact, which agent sent which instruction.
What contains it
- Authenticate agents to each other and sign messages.
- Negotiate capabilities explicitly, and grant each peer only what it needs.
- Bind sessions to a single workflow and expire them when it ends.
Go deeper
9. Data exfiltration
An agent with read access to sensitive data and any outbound channel (email, web requests, tool parameters, even DNS lookups) can be used to move that data out. The transfer looks like the agent's ordinary work, which is why tools built to spot human exfiltration patterns tend to miss it.
How it shows up
- Sensitive records appearing in tool parameters, URLs or outbound messages.
- Agents reading far more data than their task needs.
- New external destinations in agent traffic.
What contains it
- Scope data access per task, down to rows and fields where you can.
- Restrict outbound channels and destinations, and inspect what goes through them.
- Watch agent actions in real time rather than relying on logs reviewed later.
Go deeper
10. Cascading failures
OWASP Agentic Top 10: ASI08
One compromised or confused agent passes bad data, instructions or actions to every agent downstream, at machine speed. The more tightly agents are connected, the further a single fault travels before a person sees it.
How it shows up
- Agents that accept each other's outputs without validation.
- One agent able to both propose and approve an action.
- No way to pause one agent without stopping the whole workflow.
What contains it
- Validate data at each hand-off between agents.
- Separate duties: the agent that proposes a change isn't the one that approves or executes it.
- Build kill switches and circuit breakers into each stage.
Go deeper
11. Human-agent trust exploitation
OWASP Agentic Top 10: ASI09
A human in the loop is only a control if the human actually decides. Fluent, confident agents and a steady stream of approval requests produce automation bias and decision fatigue, until approvals are clicked through. An agent, or whoever controls it, can also frame a request so that a harmful action looks routine.
How it shows up
- Approval rates near 100% and approval times of a few seconds.
- Approval prompts that summarise an action rather than show it.
- The same few people approving everything, across many agents.
What contains it
- Reserve approvals for high-stakes, irreversible actions so they stay meaningful.
- Show the exact action and its parameters, not the agent's description of it.
- Measure approval behaviour and review it like any other control.
Go deeper
12. Rogue behaviour and drift
OWASP Agentic Top 10: ASI10
No attacker is needed. A long-running agent's behaviour can shift step by step until it no longer matches what it was built to do, or it can satisfy its stated goal in a way its operators never wanted. Each step looks fine; only the pattern is wrong, and dashboards stay green.
How it shows up
- Agents doing tasks outside their stated scope.
- Gradual changes in which tools an agent uses, and how often.
- Outputs that pass checks but no longer serve the original purpose.
What contains it
- Baseline normal behaviour per agent and alert on deviation.
- Detect out-of-scope tasks against an explicit statement of the agent's job.
- Version the agent as a whole (model, prompt, tools, config) so changes can be traced and rolled back.
Go deeper
13. Shadow agents
Teams adopt agents inside approved SaaS tools, browser extensions and scripts long before security hears about them. An agent nobody knows about has no owner, no reviewed permissions and no monitoring, so every other risk on this list applies to it unchecked.
How it shows up
- OAuth grants and API keys issued to tools security has never reviewed.
- Automated activity from user accounts at hours or volumes no person keeps.
- No single list of the agents running in the organisation.
What contains it
- Keep an inventory of agents, their owners, identities and permissions.
- Discover agents from identity, network and SaaS audit data, not only from requests to approve them.
- Give teams an approved path to deploy agents, so they don't need a shadow one.
Go deeper
14. Missing audit trail
When something goes wrong, you need to know what the agent saw, what it decided and what it did, step by step. Most logging was built for requests and users, not for multi-step reasoning across tools, so incidents can't be reconstructed and compliance evidence can't be produced.
How it shows up
- Logs that show API calls but not the prompt or context that led to them.
- Traces that break at each tool boundary.
- No record tying an agent action to the user or business transaction behind it.
What contains it
- Log each agent action with its inputs, tool calls, outputs and the identity it acted as.
- Trace across multi-step tool calls with a single ID per run.
- Write incident response playbooks for agent failures before you need one.
Go deeper
Where to start
- List every agent you run, who owns it, and what it can access.
- Give each agent its own identity and remove access its task doesn't need.
- Keep secrets out of prompts, memory and logs; broker them server-side.
- Allow-list the tools and MCP servers agents may use, and pin their versions.
- Sandbox any agent that runs code, and restrict its outbound network.
- Put approval gates on irreversible actions, and keep them rare enough to be read.
- Enforce policy on each action at runtime, and log each action with its context.
- Baseline normal behaviour and alert when an agent drifts from it.
Frequently asked questions
What is the biggest security risk with AI agents?
Prompt injection is ranked first in the OWASP Top 10 for Agentic Applications (as ASI01, agent goal hijack), because an agent cannot reliably tell instructions from data. In practice, how bad an injection gets depends on what the agent can reach, so excessive agency and over-broad privileges decide the damage.
How are AI agent risks different from LLM risks?
An LLM application produces text; an agent acts. Agents inherit the LLM risks (injection, data leakage, unsafe output) and add new ones that come from tools, credentials, memory and autonomy: tool misuse, privilege abuse, cascading failures and drift. OWASP keeps a separate Top 10 for each.
Can prompt guards or output filters solve these risks?
They help, but they inspect what an agent says, not what it does. The controls that contain agent risk sit around the agent: scoped identities and tools, runtime policy enforcement, sandboxing, approval gates and monitoring of actions.
Which framework should I use to assess AI agent risks?
The OWASP Top 10 for Agentic Applications gives a shared vocabulary of risks; threat-modeling methods adapted for agents help you find where each one applies in your own system. Check the OWASP GenAI Security Project's site (genai.owasp.org) for the current version of the list.