Building Secure AI Agents | 3 Breach Conditions

GenAI Security
Blog

Key Takeaways

An AI agent becomes dangerous when three conditions combine: access to private data, exposure to untrusted input, and the ability to act or send externally.
Prompt injection is only a delivery mechanism. The incident happens when an injected instruction meets permissions broad enough to satisfy it, which makes scoping the control that matters.
Rules written into an agent's system prompt are guidance the model usually follows, not an enforced boundary. Opsin Labs found agents with read-only instructions sitting on top of tool connections that carried full server-operation access.
Credentials never belong in an agent's instructions or tool descriptions, where they sit in the model's context on every run and can be pulled back out by an injection.
Draft by default. Reading and summarizing are low risk, while sending externally, changing records, running code, and calling outside URLs need a human to commit the action.
Ownership and drift are the two filters that catch what a point-in-time review misses. Opsin Labs found 35% of enterprise agents orphaned, still running with full access and nobody accountable for them.

Across enterprise environments Opsin Labs studied for the 2026 State of Agentic Adoption report, 67% of agents were built by employees with no engineering background and 60% run with allow-all access. The reflex when those numbers reach a security team is to write a policy and schedule a training. Someone in finance attaching a tool to an agent on a Tuesday afternoon will not rank ten security principles against a workflow they need working by Friday. They need one decision they can make in thirty seconds.

Building secure AI agents comes down to controlling three conditions that are only dangerous in combination:

  • access to private data
  • exposure to untrusted input
  • the ability to act or send outside the organization.

An agent holding all three can be steered by the text it reads into taking an action it was already permitted to take, which is what turns a prompt injection into a data leak. Break any one of the three and the same injection has nowhere to go. A large language model does not reliably distinguish instructions from the content it was asked to process, because everything arrives as tokens in the same context window. Agents must not be allowed to hold all three at once.

What actually makes an AI agent dangerous?

An AI agent is a system that can plan a sequence of steps and call tools to carry them out without a human approving each one. That autonomy is the value, and it is what changes the risk calculus: a human with excessive access has to choose to misuse it, while an agent with excessive access will exercise it the moment the right text lands in its context. Prompt injection is the delivery mechanism, meaning instructions hidden inside content the agent treats as data, whether an inbound email, a shared document, a web page, or an uploaded file. An injection only becomes an incident when it meets permissions broad enough to satisfy it.

Consider a research agent that reads arbitrary web pages, holds customer PII in its context, and can send external email. Each capability is defensible in isolation, added one at a time for good reasons, and no individual permission grant looks wrong in a review. Together they mean a single poisoned page can exfiltrate customer data. The same applies when an agent hands work to another agent, since delegation multiplies reach, so the trifecta has to be evaluated across the chain rather than agent by agent.

How do you build secure AI agents that break the trifecta?

Start with purpose, because every scoping decision downstream depends on it. Write one or two sentences in the agent's description that accurately capture what it does, and treat a description that sprawls as a signal the agent is trying to do too much. "Helps our IT support team look up and summarize open incident tickets and draft response notes for review. It does not close or delete tickets." That gives you the audience, the topic, the actions, and the limit in one line, plus something to measure later behavior against.

Then scope the data to the topic. Connect the agent to the smallest set of documents its purpose requires, and prefer a curated source over a broad connector. Broad connectors inherit whatever is over-shared or mislabeled in the underlying files, so an agent can surface a sensitive document nobody realized was reachable. A sales-enablement agent pointed at a shared drive that also holds medical records and executive pay files has a data problem no amount of careful prompting will fix.

Then match actions to risk. Reading and summarizing are low risk, drafting and scheduling are medium, and sending externally, changing or deleting records, running code, and calling outside URLs are high. Draft by default, with a human committing anything that leaves the company, changes an official record, or cannot be undone. A meeting assistant that drafts a follow-up for the user to send is a different security object than one that can silently create forwarding rules and send externally. Watch code execution and outbound network calls in particular, since those two convert an injection into an incident more reliably than anything else.

Why don't written guardrails count as a control?

Because instructions are guidance the model usually follows, not a wall it cannot cross. Rules in an agent's system prompt are worth writing so they can be tested ("never email anyone outside @ourcompany.com" beats "be careful with sensitive data"), but a determined injection can cause an agent to bypass its own rules. The right assumption is the one security teams already make about breach: the agent will be fooled at some point, so design for the moment it is.

That means backing every rule that matters with an enforced limit, whether that is declining to connect the risky tool, keeping the sensitive data out of reach, or requiring human approval before the action runs. Opsin Labs found agents whose prompts explicitly restricted them to read-only use while the underlying tool connection still carried full server-operation access, a rule describing an intention with nothing behind it.

Identity is where this gets missed most often. Credentials and API keys never belong in an agent's instructions or tool descriptions, because anything written there sits in the model's context on every run, gets copied into logs, and can be pulled back out by an injection that asks the agent to repeat its own configuration. Secrets belong in a vault, fetched as short-lived tokens by the code performing the action. Each tool should also authenticate as the user interacting with the agent rather than as its owner, since owner-level authentication means every user inherits the owner's reach, which is how a team lookup tool quietly becomes an entitlements bypass.

Which agents should a security team look at first?

Use the trifecta as a triage filter. Agents that hold private data, read untrusted input, and can act externally are the ones worth reviewing this week, and in most environments that set is small enough to work through by hand. Ownership is the second filter: Opsin Labs found 35% of enterprise agents orphaned, still running and still holding full access with nobody accountable for them.

The third filter is drift, and it resists a point-in-time review. An agent correctly scoped in March accumulates a tool in May and a data source in July, and the gap between what it was built to do and what it is doing widens without anyone deciding it should. Catching that requires connecting three things most security stacks keep separate: the identity an agent authenticates as, the data its tools can reach, and its behavior once live compared with its stated intent. That connection is what a dynamic contextual layer provides, and it lets a team remediate at the owner and the configuration instead of triaging alerts with no root cause attached.

How does this map to OWASP, NIST AI RMF, and MITRE ATLAS?

The trifecta is a fast route to conclusions the published frameworks already support, and each leg has a named risk behind it:

  • LLM01 Prompt Injection and LLM06 Excessive Agency in the OWASP Top 10 for LLM Applications 2025 are the untrusted-input leg and the permission leg. Excessive agency is OWASP's term for an agent holding more functionality, permission, or autonomy than its purpose justifies.
  • ASI01 Agent Goal Hijack, in the OWASP Top 10 for Agentic Applications published by the OWASP GenAI Security Project in December 2025, covers injected content redirecting an agent away from its stated purpose.
  • ASI02 Tool Misuse & Exploitation and ASI05 Unexpected Code Execution describe a legitimately attached tool becoming the weapon.
  • ASI03 Identity & Privilege Abuse is the inherited-credentials problem, and ASI10 Rogue Agents is the orphaned-agent problem.
  • ASI04 Agentic Supply Chain Vulnerabilities is why connected tools matter. MCP, the Model Context Protocol, is the open standard for connecting agents to external tools and data, and every server you attach joins your agent's supply chain.
  • The NIST AI Risk Management Framework gives you governance functions to hang this on and MITRE ATLAS gives you adversary vocabulary, though neither tells you which agent to fix first.

Agent interactions in these environments grew 14x over the study period, and the builders driving that growth will not slow down for a review queue. The teams staying ahead of it make the trifecta a design question at creation time rather than a discovery exercise afterward. So the question for your next agent review is narrow enough to answer today: which of your agents can read something an attacker controls, reach something you would not want published, and send it somewhere outside?

The full set of guardrails, including the weak and well-built examples behind each one, is in 10 Best Practices for Secure Agent Creation, excerpted from Opsin Labs' State of Agentic Adoption 2026.

Get the 10 Best Practices Guide

Table of Contents

LinkedIn Bio >

FAQ

How do you build secure AI agents in an enterprise environment?

Start with a one or two sentence purpose statement in the agent's description, then scope everything else to it. Connect the smallest set of data sources the topic requires, grant the least powerful tool that does the job (read instead of write, drafting instead of auto-send), and share the agent with the smallest audience that genuinely needs it.

The single highest-value check is whether the agent holds all three of the following at once: access to private data, exposure to untrusted input, and the ability to act or send externally. If it does, remove one before it goes live.

What is the lethal trifecta in AI agent security?

The lethal trifecta, named by security researcher Simon Willison in June 2025, describes the combination of private data access, exposure to untrusted content, and external communication capability. Each is safe alone.

Together they mean an attacker who can get text in front of the agent, through a web page, an inbound email, or an uploaded file, can direct it to retrieve sensitive data and send that data out, using permissions the agent legitimately holds.

Are prompt-level guardrails enough to secure an AI agent?

No. Instructions in a system prompt are guidance the model usually follows, and a determined prompt injection can cause an agent to bypass its own rules. Written rules are a useful first layer, particularly when written so they can be tested, but every rule that matters needs an enforced limit behind it: do not connect the risky tool, keep the sensitive data out of reach, or require a human to approve the action.

Where should credentials live in an AI agent architecture?

In a secrets vault, fetched as short-lived tokens by the code that performs the action, never in the agent's instructions, system prompt, or tool descriptions. Anything written into those fields sits in the model's context on every run, tends to be copied into logs and traces, and can be disclosed by a prompt injection that asks the agent to repeat its own configuration. Each connected tool should also authenticate as the user interacting with the agent rather than as the agent's owner, otherwise every user of that agent inherits owner-level reach.

How does the lethal trifecta map to the OWASP frameworks?

The untrusted-input leg is LLM01 Prompt Injection and the permission leg is LLM06 Excessive Agency in the OWASP Top 10 for LLM Applications 2025. In the OWASP Top 10 for Agentic Applications, published by the OWASP GenAI Security Project in December 2025, injected content redirecting an agent maps to ASI01 Agent Goal Hijack, a connected tool turned into a weapon maps to ASI02 Tool Misuse & Exploitation and ASI05 Unexpected Code Execution, inherited credentials map to ASI03 Identity & Privilege Abuse, and orphaned agents map to ASI10 Rogue Agents.

About the Author
Gilron Tsabkevich
Gilron Tsabkevich is a Founding Engineer at Opsin, bringing experience in developing secure, scalable systems at Microsoft, where he specialized in cybersecurity, threat detection, and SIEM. His expertise spans backend development with a focus on enterprise security and AI infrastructure. He holds a BSE in Computer Science from Princeton University.
LinkedIn Bio >

Building Secure AI Agents | 3 Breach Conditions

Across enterprise environments Opsin Labs studied for the 2026 State of Agentic Adoption report, 67% of agents were built by employees with no engineering background and 60% run with allow-all access. The reflex when those numbers reach a security team is to write a policy and schedule a training. Someone in finance attaching a tool to an agent on a Tuesday afternoon will not rank ten security principles against a workflow they need working by Friday. They need one decision they can make in thirty seconds.

Building secure AI agents comes down to controlling three conditions that are only dangerous in combination:

  • access to private data
  • exposure to untrusted input
  • the ability to act or send outside the organization.

An agent holding all three can be steered by the text it reads into taking an action it was already permitted to take, which is what turns a prompt injection into a data leak. Break any one of the three and the same injection has nowhere to go. A large language model does not reliably distinguish instructions from the content it was asked to process, because everything arrives as tokens in the same context window. Agents must not be allowed to hold all three at once.

What actually makes an AI agent dangerous?

An AI agent is a system that can plan a sequence of steps and call tools to carry them out without a human approving each one. That autonomy is the value, and it is what changes the risk calculus: a human with excessive access has to choose to misuse it, while an agent with excessive access will exercise it the moment the right text lands in its context. Prompt injection is the delivery mechanism, meaning instructions hidden inside content the agent treats as data, whether an inbound email, a shared document, a web page, or an uploaded file. An injection only becomes an incident when it meets permissions broad enough to satisfy it.

Consider a research agent that reads arbitrary web pages, holds customer PII in its context, and can send external email. Each capability is defensible in isolation, added one at a time for good reasons, and no individual permission grant looks wrong in a review. Together they mean a single poisoned page can exfiltrate customer data. The same applies when an agent hands work to another agent, since delegation multiplies reach, so the trifecta has to be evaluated across the chain rather than agent by agent.

How do you build secure AI agents that break the trifecta?

Start with purpose, because every scoping decision downstream depends on it. Write one or two sentences in the agent's description that accurately capture what it does, and treat a description that sprawls as a signal the agent is trying to do too much. "Helps our IT support team look up and summarize open incident tickets and draft response notes for review. It does not close or delete tickets." That gives you the audience, the topic, the actions, and the limit in one line, plus something to measure later behavior against.

Then scope the data to the topic. Connect the agent to the smallest set of documents its purpose requires, and prefer a curated source over a broad connector. Broad connectors inherit whatever is over-shared or mislabeled in the underlying files, so an agent can surface a sensitive document nobody realized was reachable. A sales-enablement agent pointed at a shared drive that also holds medical records and executive pay files has a data problem no amount of careful prompting will fix.

Then match actions to risk. Reading and summarizing are low risk, drafting and scheduling are medium, and sending externally, changing or deleting records, running code, and calling outside URLs are high. Draft by default, with a human committing anything that leaves the company, changes an official record, or cannot be undone. A meeting assistant that drafts a follow-up for the user to send is a different security object than one that can silently create forwarding rules and send externally. Watch code execution and outbound network calls in particular, since those two convert an injection into an incident more reliably than anything else.

Why don't written guardrails count as a control?

Because instructions are guidance the model usually follows, not a wall it cannot cross. Rules in an agent's system prompt are worth writing so they can be tested ("never email anyone outside @ourcompany.com" beats "be careful with sensitive data"), but a determined injection can cause an agent to bypass its own rules. The right assumption is the one security teams already make about breach: the agent will be fooled at some point, so design for the moment it is.

That means backing every rule that matters with an enforced limit, whether that is declining to connect the risky tool, keeping the sensitive data out of reach, or requiring human approval before the action runs. Opsin Labs found agents whose prompts explicitly restricted them to read-only use while the underlying tool connection still carried full server-operation access, a rule describing an intention with nothing behind it.

Identity is where this gets missed most often. Credentials and API keys never belong in an agent's instructions or tool descriptions, because anything written there sits in the model's context on every run, gets copied into logs, and can be pulled back out by an injection that asks the agent to repeat its own configuration. Secrets belong in a vault, fetched as short-lived tokens by the code performing the action. Each tool should also authenticate as the user interacting with the agent rather than as its owner, since owner-level authentication means every user inherits the owner's reach, which is how a team lookup tool quietly becomes an entitlements bypass.

Which agents should a security team look at first?

Use the trifecta as a triage filter. Agents that hold private data, read untrusted input, and can act externally are the ones worth reviewing this week, and in most environments that set is small enough to work through by hand. Ownership is the second filter: Opsin Labs found 35% of enterprise agents orphaned, still running and still holding full access with nobody accountable for them.

The third filter is drift, and it resists a point-in-time review. An agent correctly scoped in March accumulates a tool in May and a data source in July, and the gap between what it was built to do and what it is doing widens without anyone deciding it should. Catching that requires connecting three things most security stacks keep separate: the identity an agent authenticates as, the data its tools can reach, and its behavior once live compared with its stated intent. That connection is what a dynamic contextual layer provides, and it lets a team remediate at the owner and the configuration instead of triaging alerts with no root cause attached.

How does this map to OWASP, NIST AI RMF, and MITRE ATLAS?

The trifecta is a fast route to conclusions the published frameworks already support, and each leg has a named risk behind it:

  • LLM01 Prompt Injection and LLM06 Excessive Agency in the OWASP Top 10 for LLM Applications 2025 are the untrusted-input leg and the permission leg. Excessive agency is OWASP's term for an agent holding more functionality, permission, or autonomy than its purpose justifies.
  • ASI01 Agent Goal Hijack, in the OWASP Top 10 for Agentic Applications published by the OWASP GenAI Security Project in December 2025, covers injected content redirecting an agent away from its stated purpose.
  • ASI02 Tool Misuse & Exploitation and ASI05 Unexpected Code Execution describe a legitimately attached tool becoming the weapon.
  • ASI03 Identity & Privilege Abuse is the inherited-credentials problem, and ASI10 Rogue Agents is the orphaned-agent problem.
  • ASI04 Agentic Supply Chain Vulnerabilities is why connected tools matter. MCP, the Model Context Protocol, is the open standard for connecting agents to external tools and data, and every server you attach joins your agent's supply chain.
  • The NIST AI Risk Management Framework gives you governance functions to hang this on and MITRE ATLAS gives you adversary vocabulary, though neither tells you which agent to fix first.

Agent interactions in these environments grew 14x over the study period, and the builders driving that growth will not slow down for a review queue. The teams staying ahead of it make the trifecta a design question at creation time rather than a discovery exercise afterward. So the question for your next agent review is narrow enough to answer today: which of your agents can read something an attacker controls, reach something you would not want published, and send it somewhere outside?

The full set of guardrails, including the weak and well-built examples behind each one, is in 10 Best Practices for Secure Agent Creation, excerpted from Opsin Labs' State of Agentic Adoption 2026.

Get the 10 Best Practices Guide

Your Name*
Job Title*
Business Email*
Your copy
is ready!
Please check for errors and try again.

Turn workforce AI sprawl into risk clarity

See every agent, what it can reach, and what to fix.
Get a demo →