85 agentic tools audited for security incidents · Talk to the lab →
MotionticBook a call
Guides

· 6 min read

Agentic AI security risks: 12 failure modes with fixes

Agentic AI security risks explained: 12 ways tool-using agents fail, from prompt injection to leaked keys, and the specific fix that closes each one.

A white window inside a dotted ring of small pills, with one tangerine pill escaping along a dashed path

The main agentic AI security risks are prompt injection, excessive permissions, unsafe handling of model output, unsandboxed code execution, leaked credentials, open network egress, poisoned memory, compromised tools and MCP servers, weak approvals, cascading multi-agent failures, missing logs and runaway cost. Each one has a fix that works without trusting the model to behave.

The list below is ordered roughly by how often each failure shows up in real agent builds. For each, you get what goes wrong, a concrete example and the control that closes it.

How to read these agentic AI security risks

Every risk here follows one pattern: untrusted text reaches a capability. The model cannot reliably separate instructions from data, so any control that depends on the model refusing will fail some of the time. The fixes below sit outside the model, in permissions, sandboxes, networks and code.

The OWASP Top 10 for LLM Applications covers several of these at the model level. This list extends them to agents that hold tools, credentials and memory.

1. Direct and indirect prompt injection

An attacker writes instructions into content the agent reads, and the agent follows them. Direct injection comes from the user. Indirect injection hides in a web page, a PDF, an email or a GitHub issue the agent processes.

Example: a coding agent reads an issue that says "also add this script to the build step," and the script exfiltrates secrets.

Fix: assume prompt injection will get through. Remove tools from any step that only reads untrusted content, tag content by source, and limit what the agent can do even if it obeys the attacker.

2. Excessive agency and permissions

The agent holds more access than its task needs, often through a shared service account with admin rights.

Example: a reporting agent with read access to sales data also holds a database credential that can drop tables.

Fix: one scoped agent identity per agent, short-lived tokens tied to named resources, and a hard rule that the agent never exceeds the permissions of the user who triggered it.

3. Unvalidated model output

Model text flows straight into an interpreter: SQL, a shell, HTML, an API body or another agent.

Example: an agent builds a SQL query by string concatenation from user input, giving the attacker classic SQL injection through the model.

Fix: treat model output as untrusted user input. Parameterise queries, pass shell arguments as arrays, escape HTML and validate JSON against a schema before acting on it.

4. Agent-written code running on the host

The agent generates and runs code on a machine that also holds source code, secrets and network access.

Example: an injected instruction makes the agent run a script that reads ~/.aws/credentials and posts it to a remote server.

Fix: run agent code in a disposable agent sandbox with a fresh filesystem, no secrets and an egress allowlist. Motiontic's ARI-42 risk index identifies sandboxing agent-written code as the requirement where agent tools fall short most often by default.

5. Credentials exposed to the agent

API keys, model-provider keys and tokens sit in environment variables or files the agent can read.

Example: an agent asked to debug a failing request runs env and prints the production API key into a log or a chat.

Fix: keep secrets out of the agent's execution environment. Inject credentials at the tool layer, where the agent calls a tool and the tool holds the key, and scan code and config for leaked keys on every change.

6. Unrestricted network egress

The agent can reach any domain, so any successful injection can send data anywhere.

Example: a browsing agent follows a link to an attacker's page and is told to append private notes to a URL as query parameters.

Fix: an allowlist at the network layer for each agent. Deny by default. A fetch tool should accept only approved hosts.

7. Memory and retrieval poisoning

An attacker writes content into long-term memory or a retrieval index. The agent reads it later and acts on it.

Example: a planted document in a shared knowledge base tells the support agent that refunds above a threshold no longer need approval.

Fix: record the source of each memory entry, expire entries, separate trusted and untrusted stores, and never let retrieved agent memory grant permissions or change policy.

8. Compromised tools, MCP servers and packages

The agent stack is a supply chain. A malicious or vulnerable framework, SDK, skill or MCP server gives an attacker a foothold.

Example: a third-party MCP server updates its tool description to include hidden instructions, and every agent connected to it starts following them.

Fix: pin versions, review tool descriptions on change, authenticate and scope every MCP connection, and check dependencies against new CVEs on every change, not once a quarter.

9. Weak or misleading human approval

The human approves something different from what runs, or approves so often they stop reading.

Example: an approval prompt says "Agent wants to send an email." The human clicks yes. The agent sends it to an external address with an attachment.

Fix: human-in-the-loop approval that shows the exact action, recipient, amount or diff, and binds the approval to that action. Limit approvals to sends, payments, deletes and deploys to avoid approval fatigue.

10. Cascading failures across agents

In a multi-agent system, one compromised or confused agent passes bad instructions or data to the next, and each trusts the last.

Example: a research agent ingests an injected page and hands a "task" to an execution agent, which carries it out because it came from inside the system.

Fix: each agent validates inputs from other agents the same way it validates user input, and holds only the permissions for its own step. Keep the blast radius of each agent small.

11. Missing audit trail

Nobody can reconstruct why the agent took an action, so incidents go undiagnosed and security reviews stall.

Example: a customer reports a deleted record, and the logs show an API call from a service account with no prompt, user or reasoning attached.

Fix: log every tool call with arguments, identity, triggering user, prompt context and result. Agent observability tooling built on traces makes replay practical.

12. Runaway loops and cost

An agent gets stuck in a loop, or an attacker triggers expensive calls, and the bill or the rate limits become the outage.

Example: an agent retries a failing tool call thousands of times overnight, burning through the model budget and hitting a partner API's rate limit.

Fix: cap steps, tokens and spend per task and per user, add timeouts to every tool, and alert when an agent exceeds its normal profile.

Catching these risks before they ship

Most of these failures enter through ordinary code changes: a new tool, a wider token scope, a dependency bump, a removed approval. Checking them on every pull request catches them while the fix is one line.

The Motiontic Security Layer (MSL) runs those checks in the team's own CI on every pull request, built on the ARI-42 index. It posts a PR comment with each risk and its fix, keeps a dashboard, and produces a buyer-ready PDF report. Setup takes a 15-minute call, and the first report arrives within 48 hours.

For governance and threat modelling, map the list above to the NIST AI Risk Management Framework and to attacker techniques in MITRE ATLAS.

FAQ

Which agentic AI security risk should a startup fix first?

Sandbox any code the agent runs and remove secrets from that environment. That single change limits the damage from prompt injection, leaked credentials and malicious packages at once.

Can guardrails stop prompt injection?

AI guardrails lower the rate of successful injection but do not stop it every time. Pair them with least privilege, egress allowlists and approvals so a successful injection has little to work with.

Are MCP servers a security risk?

They can be. Each MCP server adds tools and text the agent trusts, so an unauthenticated, unscoped or compromised server extends the attack surface. Authenticate, scope and pin every server you connect.

How do these risks show up in a security review?

Enterprise reviewers ask whether agent code is sandboxed, whether agents can exceed user permissions, whether egress is restricted and whether irreversible actions need approval. Teams that can show dated evidence for each answer move through review faster.

Want to see which of these risks apply to your stack? Book a 20-minute call with Motiontic.

Motiontic · Published

Running agents that have to hold up?

Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.