Skip to content

What is AI agent security?

Sergey Almyashev

Definition

AI agent security is the practice of keeping AI agents that act with real credentials and tools from being hijacked or misused, and limiting the damage when they are. It covers the threat model, each agent's identity and permissions, tool and MCP server risks, code sandboxing, memory, logging and incident response.

What does AI agent security cover?

A chatbot can say something wrong. An agent can do something wrong, with your credentials, in your systems. AI agent security is the work of limiting what that agent can be tricked into doing and of noticing when it happens.

A useful threat model for one agent has four parts:

PartQuestion to answerExamples
ReachWhat can the agent touch?Databases, APIs, file systems, email, payment tools
InputsWhat text can steer it?User messages, documents, web pages, tool results, memory, other agents
AuthorityWhose rights does it act with?Its own service identity, a delegated user token, a shared admin key
EvidenceHow would you know what it did?Tool call logs, inter-agent messages, approvals

OWASP adds a design rule it calls least agency: do not deploy agentic behavior where it is not needed, because autonomy expands the attack surface without adding value. Least privilege limits what an agent may touch. Least agency limits whether you build an agent at all.

What are the OWASP Top 10 risks for agentic applications?

The OWASP Top 10 for Agentic Applications for 2026, published on December 9, 2025, is the current shared vocabulary. Each entry below is summarized from the list, with one of the mitigations it recommends.

IDRiskWhat goes wrongOne mitigation OWASP lists
ASI01Agent goal hijackInjected content redirects the agent's goals, task selection or planTreat all natural-language input, including retrieved content, as untrusted
ASI02Tool misuse and exploitationThe agent uses a tool it is allowed to use in an unsafe wayPer-tool least-privilege profiles: scopes, rate limits, egress allowlists
ASI03Identity and privilege abuseDelegated or inherited credentials let the agent exceed its rightsTask-scoped, time-bound permissions with per-agent identities
ASI04Agentic supply chain vulnerabilitiesTools, models, MCP servers or other agents arrive malicious or tamperedSigned manifests and tool definitions, curated registries
ASI05Unexpected code executionGenerated or injected code runs on a host or containerNo eval in production agents; sandboxed containers, never as root
ASI06Memory and context poisoningPoisoned memory or RAG data biases later decisionsScan memory writes before commit; segment memory per session
ASI07Insecure inter-agent communicationMessages between agents are spoofed, intercepted or alteredMutual authentication and signed messages between agents
ASI08Cascading failuresOne fault spreads across agents into system-wide harmIsolation and trust boundaries to contain propagation
ASI09Human-agent trust exploitationA persuasive agent gets a person to approve a harmful actionExplicit confirmation steps and tamper-proof logs
ASI10Rogue agentsAn agent drifts from its intended scope and acts harmfullyKill switches and credential revocation

On November 10, 2026, OWASP also published Securing Agentic Applications V2, a builder and defender guide that covers secure architectures, identity and access controls, runtime protection and assurance testing.

Why is identity the center of agent security?

The damage an agent can do is bounded by the authority it holds, not by the text it reads. OWASP's ASI03 entry describes an "attribution gap": an agent without a distinct, governed identity of its own cannot be held to least privilege. Three failure patterns from that entry show up in real designs:

  • Unscoped inheritance. A manager agent passes its full access to a narrow worker agent.
  • Confused deputy. A low-privilege agent relays a valid-looking request to a high-privilege agent, which runs it without checking what the original user wanted.
  • Time of check vs time of use. Rights are checked when the workflow starts, then revoked, and the agent keeps acting on the old decision.

The mitigations OWASP gives are concrete: short-lived tokens scoped to one task, authorization re-checked on every privileged action, tokens bound to subject, audience, purpose and session, and agents managed as non-human identities in your IAM. NIST is working on the same problem. Its National Cybersecurity Center of Excellence released a concept paper on software and AI agent identity and authorization on February 5, 2026, asking for input on identifying and authorizing agents, auditing and non-repudiation of their actions, and controls against prompt injection.

Example: per-action authorization for an agent tool call

This check runs before each tool call. Unlike an allowlist of tools, it asks whose authority the call carries: the token must belong to this agent, this tool and this task, and the user it acts for must still hold the right at the moment of the call. It runs with plain Node.js and no packages; the output is from Node 22.9 running this file.

// Per-action authorization for an agent tool call. Runs with plain Node.js, no packages.
const NOW = Date.parse("2026-11-19T10:05:00Z"); // fixed clock so the output is reproducible

// What each user may do right now, read from your identity system at call time.
const userRights = { "u-anna": new Set(["orders:read", "refunds:create"]) };
const NEEDS_APPROVAL = new Set(["refunds:create"]);

// A short-lived token minted for one agent, one task, one tool, on behalf of one user.
const token = {
  agent: "support-agent", onBehalfOf: "u-anna", task: "t-981", audience: "orders-api",
  scopes: ["orders:read", "refunds:create"], expires: "2026-11-19T10:15:00Z",
};

function authorize(call, tok) {
  if (tok.agent !== call.agent) return "deny: token belongs to another agent";
  if (tok.audience !== call.tool) return "deny: token not issued for this tool";
  if (NOW > Date.parse(tok.expires)) return "deny: token expired";
  if (tok.task !== call.task) return "deny: token bound to a different task";
  if (!tok.scopes.includes(call.scope)) return "deny: scope not granted";
  if (!userRights[tok.onBehalfOf]?.has(call.scope)) return "deny: user lacks this right now";
  if (NEEDS_APPROVAL.has(call.scope) && !call.approvedBy) return "hold: needs human approval";
  return "allow";
}

const base = { agent: "support-agent", tool: "orders-api", task: "t-981" };
const cases = [
  ["read orders",            { ...base, scope: "orders:read" }],
  ["other agent reuses it",  { ...base, agent: "billing-agent", scope: "orders:read" }],
  ["relayed from task t-555", { ...base, task: "t-555", scope: "orders:read" }],
  ["refund, no approval",    { ...base, scope: "refunds:create" }],
  ["refund, approved",       { ...base, scope: "refunds:create", approvedBy: "u-lead" }],
];
for (const [label, call] of cases) console.log(label.padEnd(24), authorize(call, token));

userRights["u-anna"].delete("refunds:create"); // Anna's refund right is revoked mid-task
console.log("refund after revocation".padEnd(24), authorize(cases[4][1], token));
read orders              allow
other agent reuses it    deny: token belongs to another agent
relayed from task t-555  deny: token bound to a different task
refund, no approval      hold: needs human approval
refund, approved         allow
refund after revocation  deny: user lacks this right now

The second case is a stolen or shared token. The third is the task binding that stops a confused-deputy relay: a request from another task arrives with valid credentials and is still refused. The last is the time-of-use check: the refund was approved, but the user lost the right before it ran. In production the token is a signed JWT or mTLS identity issued by your IAM, and this logic lives in a policy engine outside the agent, never in its prompt.

What are the security risks of MCP for agents?

MCP connects agents to tools, so its risks are agent risks. The MCP security guidance published with spec version 2026-07-28 describes several attacks; three matter most for agent design:

  • Confused deputy at a proxy server. An MCP server that fronts a third-party API as a single OAuth client can be abused to obtain authorization codes without proper user consent. The spec deprecates Dynamic Client Registration as of 2026-07-28, but the attack still applies to proxy servers that support it.
  • Over-broad scopes. A token granted files:*, db:* or admin:* up front turns one leak into lateral access. The fix is a minimal starting scope and step-up requests when a privileged tool is first used.
  • Local server compromise. A local server is a program running with the client's privileges. A malicious startup command in a client config can exfiltrate SSH keys. Clients that offer one-click local server setup must show the exact command and get explicit consent first, and should run servers in a sandbox with minimal default privileges.

For how MCP servers work and the token rules for remote servers, see our MCP server entry.

How is AI agent security different from AI guardrails?

AI guardrailsAI agent security
ScopeChecks on inputs, outputs and tool calls at runtimeThe whole system the agent runs in
Main questionIs this request or answer allowed?What happens if the agent is compromised anyway?
Typical controlsFilters, validators, tool policies, approvalsIdentity and IAM, sandboxing, supply chain, logging, incident response, red teaming
OwnerThe application teamApplication, platform and security teams together

Guardrails are one layer of agent security, and an important one. The AI guardrails entry covers where they run and shows a tool-call gate. Agent security assumes some guardrail will eventually be bypassed and limits the damage when it is.

What should an AI agent security review check?

  1. Every agent has its own identity, listed with its owner, its tools and the systems it can reach. No shared admin keys.
  2. Credentials are short-lived and scoped to the task, and every privileged action re-checks the user's current rights.
  3. Every input channel is marked untrusted, including tool results, retrieved documents, memory and messages from other agents.
  4. Code runs in a sandboxed container with strict limits, including on network access, and never as root.
  5. Tools and MCP servers are pinned and reviewed before an agent can load them.
  6. Memory is separated per user and session, and writes to it are scanned.
  7. Every tool call, approval and inter-agent message is logged in a tamper-evident store, and a kill switch can revoke an agent's credentials at once.
  8. Attack cases are part of the test suite, so a prompt or model change that reopens a hole fails before release.

SDCLabs designs tools and permissions for each agent it builds, with limited rights and human approval for actions that are costly, sensitive or cannot be undone. Our responsible AI service red-teams for prompt injection, jailbreaks and data leakage, and runs repeatable security tests before each release. For the build side, read how to build AI agents that still work after the demo.

Sources

  1. OWASP Top 10 for Agentic Applications for 2026, OWASP Gen AI Security Project, 2025-12-09
  2. Securing Agentic Applications V2, OWASP Gen AI Security Project, 2026-11-10
  3. Security best practices, Model Context Protocol, 2026-07-28
  4. Accelerating the Adoption of Software and Artificial Intelligence Agent Identity and Authorization (concept paper), NIST National Cybersecurity Center of Excellence, 2026-02-05

Frequently asked questions

Why does AI agent security matter?

An agent reads and changes data with real credentials, so one injected instruction can become a data leak or a wrong payment. OWASP notes that agent permissions, tool integrations and multi-agent setups can amplify the impact well beyond what a chat model alone could disclose.

How can companies reduce AI agent security risks?

Remove autonomy you do not need first, since every tool an agent does not have is a risk it cannot create. Then give each remaining agent its own identity with narrow, short-lived credentials, and put human approval in front of actions that cannot be undone.

What should be in an AI agent security policy?

An inventory of agents with owners, the tools and data each may use, which actions need human approval, how long credentials live, what gets logged and for how long, and who can revoke an agent's access during an incident.

How do you respond to an AI agent security incident?

Revoke the agent's credentials first, then quarantine it in a sandbox for forensic review, as OWASP recommends for rogue agents. Reconstruct what happened from the tool call logs, fix the control that failed, and add the attack to your test suite.

Sergey AlmyashevSergey AlmyashevChief Operating Officer14+ years in QA, automated, exploratory and performance testing, and continuous integration and delivery within Scrum, helping teams in product and outsourcing companies organize teams, processes and tools.LinkedIn

Building with AI agents? Talk to an engineer.