Security Risks of AI Agents With Tool Access
What goes wrong when an AI agent gets credentials and tools: over-permissioning, confused deputy problems, and audit trails that cannot answer the question.

Here is a configuration that gets built most weeks somewhere. An agent is given a mailbox to watch, a database connection string, a document store, and permission to call an internal API. The credential it holds is the one that already existed and worked, which means it is probably a service account with far more access than the job requires. It runs on a schedule, nobody watches it, and its logs record the final answer rather than the steps.
Everything about that setup is reasonable from a delivery perspective and indefensible from a security one. The interesting part is that none of the problems are about AI. They are the oldest problems in access control, arriving in a component that can be talked into things.
What changes when a model gets hands
A model that only writes text has a person between it and the world. That person is a control, an unreliable one, but a control: they read the output, notice when it is wrong, and decide whether to act. Give the model tools and that control is gone by design, because removing it is the point.
Three properties then start to matter in a way they did not before.
It acts with borrowed authority. The agent's credential, not the requester's, determines what is possible. Whatever that credential can do, the agent can do, for anyone who can influence its instructions.
Its instructions come from untrusted places. An agent that reads email, fetches web pages, processes documents or consumes tool output is taking input from people who do not work for you. That is the prompt injection problem, and in an agent it converts from an embarrassment into an action.
It is non-deterministic. The same request on Tuesday may produce a different sequence of tool calls than it did on Monday. Testing shows you what can happen, not what will, and incident reconstruction cannot rely on replaying the input.
Over-permissioning: the credential is the blast radius
Ask what an agent can do and you will usually be told what it is supposed to do. These are different questions. The honest answer is the full set of operations its token permits, and in practice that set is wide because narrow credentials take longer to create.
The common ways this goes wrong:
- The convenient key. An existing integration key with broad scopes gets reused because provisioning a scoped one needed a ticket.
- Read access that is really read-everything. A database user with select on the whole schema, a document store token with tenant-wide scope, a mail account with full mailbox access rather than a single folder.
- Write access granted for one field. An agent needs to update a ticket status and receives permission to update tickets, which includes assignment, closure and deletion.
- Generic tools. A tool that executes arbitrary SQL, runs shell commands, or makes arbitrary HTTP requests cannot be constrained afterwards. Its permission set is whatever the runtime can reach.
- Standing rather than just-in-time access. The credential is live twenty-four hours a day for a task that runs for ten minutes.
- Secrets inside the context. Keys pasted into a system prompt or returned in tool output are now in a text stream that the model may be persuaded to reveal.
The fix is unexciting and effective. One identity per agent, never shared with humans or other agents. Scoped, short-lived credentials issued per task where your platform supports it. Tools that express a specific operation rather than a general capability, so the parameters constrain the action rather than the prompt. A written list of every tool with the worst single thing each one enables, reviewed by someone who did not build it. NIST's zero trust guidance is the right frame here: the agent is just another subject whose every request should be evaluated, not a trusted insider.
The confused deputy problem
This has a precise meaning worth keeping. A confused deputy is a program with legitimate privileges that is induced to exercise them on behalf of someone who lacks them. The classic example is a compiler that can write to a protected billing file being asked to use that file as its output destination. The compiler is authorized; the requester is not; the authorization check happens in the wrong place.
An AI agent is an almost perfect deputy. It holds privileges, it accepts instructions in natural language, and it is designed to be helpful about requests it has not seen before. Three variants show up in real deployments.
User-to-agent escalation
A low-privilege user asks the agent for something they could not do themselves. If the agent's tools authorize against the agent's own credential and the only thing standing in the way is a line in the system prompt saying "only answer questions about the user's own account", that line is the access control, and it is made of suggestion.
Content-to-agent escalation
The instruction arrives inside data. A supplier invoice, a web page, a calendar invite, a code comment in a dependency. The agent is acting for a legitimate user with real permissions, and the attacker supplies the intent. The victim's privileges, the attacker's instructions, and no credential theft anywhere.
Agent-to-agent escalation
In multi-agent systems, one agent's output becomes another's instruction. A planner agent summarizes an untrusted document and hands a task to an executor agent with write access. The executor trusts the planner because it is internal, and the planner has been steered. Tool descriptions advertised by external tool servers deserve the same suspicion, because they are text the model reads and acts on. OWASP's agentic threat material treats this trust chain as one of the primary new risks.
The structural answer in every case is the same: authorize at the resource, against the identity of the human being served, on every call. The agent should be a conduit for a user's existing permissions, not a holder of its own. If a request cannot be attributed to a person with the right to make it, the tool refuses, and no amount of persuasion changes that because the model is not the one deciding.
Where an agent genuinely needs standing privilege no user has, such as a maintenance job, then it should not be reachable by user input at all. Mixing those two modes in one agent is how most of these incidents will be written up.
Auditability: can you answer the question afterwards?
The test for an audit trail is not whether logs exist. It is whether you can sit down after a complaint and answer: what did this agent do, on whose behalf, on what instruction, with what result, and was it allowed to?
Most agent deployments cannot. Typical gaps:
- Only the outcome is recorded. You have the final message and no record of the twelve tool calls behind it.
- Tool arguments are missing or truncated. You know a record was updated and not which record or to what value.
- Identity collapses at the boundary. The downstream system logs the service account, so every action in the database is attributed to the agent and the human is unrecoverable.
- Retrieved content is not kept. If the agent was manipulated by a document, the document is the evidence, and it has been garbage collected.
- The model version is unrecorded. Behavior changed after an upgrade and you cannot establish when.
- Approvals are not tied to actions. A human clicked yes somewhere, and the log does not connect that click to the specific parameters executed.
A workable minimum, per agent step: timestamp, agent identity, the human principal being acted for, the triggering input with its source, the tool name and full arguments, the result or error, any approval with the approver and what they were shown, and the model identifier and version. Keep it for as long as you keep application audit logs, protect it from the agent's own write access, and make sure one query can produce a full session timeline. The OWASP logging guidance covers the general requirements, and none of this needs special tooling.
Two further points that get missed. Downstream systems should record the human as well as the agent, so passing the acting user through the call chain matters. And agent memory is part of the audit surface: anything the agent writes into persistent memory or a long-lived scratchpad becomes an instruction it will read later, which means memory writes need logging and, ideally, review.
Other failure modes worth designing against
Runaway loops and cost. An agent retrying a failing action is a denial of service against your own systems and your own budget. Hard limits on iterations, wall-clock time, spend and API calls per session, enforced outside the model.
Memory poisoning. A single injected instruction stored as a durable preference affects every future session. Treat memory as untrusted input, scope it per user, and give yourself a way to inspect and clear it.
Tool supply chain. Third-party tool servers can change their descriptions and behavior after approval. Pin versions, review changes, and allowlist which servers an agent may connect to.
Data aggregation. An agent with read access to several systems can assemble a picture no single system would have released. Review the combination rather than each grant in isolation.
No stop button. Know in advance how to disable an agent immediately: revoke its credential, disable its identity, stop its runtime. Test that the revocation actually takes effect mid-session rather than at the next token refresh.
A deployment sequence that works
- Write down the job. One or two sentences. If it takes a paragraph, split the agent.
- Enumerate tools and worst cases. For each tool, the most damaging single call, and whether it is reversible.
- Build scoped tools, not general ones. Specific operations with validated parameters, authorized at the resource against the acting user.
- Run it read-only in production. Real traffic, no write access, for long enough to see what it attempts. This exposes more than any test suite.
- Add writes one at a time, with approval gates on anything irreversible, financial, permission-changing or outbound.
- Verify the audit trail against a real question. Pick a past action and reconstruct it from logs alone.
- Red-team the deployment. Plant instructions in the documents, pages and tickets it reads, and watch for tool calls. Draw cases from MITRE ATLAS and rerun after every model, prompt or tool change.
- Set limits and a kill switch, then confirm both work.
- Review the permission set on a schedule, because scope creeps quietly as features are added.
Checking a message before an agent or a colleague acts on it? Paste the message or link into CyberWatch AI Scan for a free check.
The uncomfortable summary
Agent security is access control with a persuadable component in the middle. Every mitigation that holds up is one you would recognize from any other system: least privilege, short-lived scoped credentials, authorization at the resource against a real identity, mediated and specific capabilities, approval gates on irreversible actions, complete and tamper-resistant logs, and limits with a way to pull the plug. The NCSC's secure AI development guidelines and the NIST AI risk framework both land in the same place, which should be reassuring: you are not missing a new discipline, you are being asked to apply an old one to a component that will occasionally do what a stranger's document told it to.
What genuinely differs is that you cannot fix the component. You can only decide what it is allowed to touch. For the broader context of how AI is changing attacker behavior, see our guide to AI-powered cyberattacks, and for the organizational controls that sit underneath all of this, our small business cybersecurity guide covers the basics an agent deployment assumes you already have. Account-level hygiene matters too: the admin account security practices that keep a human administrator safe apply directly to the identity you give an agent.
Frequently asked questions
What makes an AI agent riskier than a chatbot?
A chatbot produces text that a person then decides what to do with. An agent holds credentials and takes actions directly, so a wrong decision becomes a real change to a system rather than a bad suggestion. The person who would have caught the mistake is no longer in the loop.
What is over-permissioning in this context?
Giving an agent a credential broader than the task needs, usually because the broad one was easier to create. An agent that only needs to read order status should not hold a token that can also refund, delete or export. The permissions on that token are the exact blast radius of any mistake or manipulation.
What is a confused deputy problem?
It is when a trusted component with high privileges is tricked into using them for someone who should not have them. An agent holding an admin API key is a textbook deputy: anyone who can influence its instructions, including through content it reads, can borrow that privilege.
Why is auditing AI agents hard?
Agents are non-deterministic, so the same prompt can produce different tool calls, and the reasoning that led to an action is not reliably recoverable from the output. Unless you log the inputs, every tool call with its arguments, the identity being acted for, and the model version, you cannot reconstruct what happened.
Should an agent have its own account or use the user's?
It should have its own identity so its actions are distinguishable in logs, but it should be authorized against the permissions of the human it is acting for. Sharing one powerful service account across all users is the single most common design mistake.
Can we rely on the agent asking for confirmation?
Only if the confirmation is enforced outside the model. If the model decides when to ask, an injected instruction can tell it not to. Build the approval gate into the tool so it cannot be skipped, and show the user the real parameters rather than the model's summary of them.
Are multi-agent systems more or less secure?
Usually less, at first. Each agent and each tool server adds a text channel the others trust, trust assumptions become implicit, and the audit trail fragments across components. Make one component accountable for authorization rather than distributing it.
What should we do before giving an agent write access?
Run it read-only in production long enough to see what it actually tries to do, put hard limits on rate and spend, define which actions always need human approval, make sure every action is attributable in logs, and confirm you have a way to stop it immediately.
Sources
- Agentic AI - OWASP Lists Threats and Mitigations, OWASP Gen AI Security Project
- OWASP Top 10 for LLM Applications 2025, OWASP Gen AI Security Project
- SP 800-207, Zero Trust Architecture, NIST
- Guidelines for secure AI system development, UK National Cyber Security Centre
- Machine learning principles, UK National Cyber Security Centre
- AI 100-2 E2025, Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations, NIST
- AI Risk Management Framework, NIST
- Logging Cheat Sheet, OWASP Cheat Sheet Series
- MITRE ATLAS, MITRE


