How to Secure Employee-Built AI Agents From Prompt Injection
Learn how to secure shadow AI agents built by employees: inventory them, limit access, add human checkpoints, and defend against prompt injection and EchoLeak-style attacks.

How do you secure employee-built AI agents from prompt injection?
You secure employee AI agents by treating them as governed non-human identities: inventory every agent, scope its tools and data access to the minimum needed, require a human checkpoint on any high-stakes action, and monitor what it does in production rather than trusting what it was designed to do.
That's the short answer. The long answer is that almost no company is doing all four, because this risk came in through the side door. Nobody filed a purchase order for the agent an ops manager built in Copilot Studio to triage the support inbox. Nobody reviewed the Zapier flow a sales rep wired into the CRM. These aren't rogue SaaS subscriptions. They're autonomous software with real permissions, and right now they're the biggest hole in most enterprise security postures.
TL;DR
- More than 80 percent of employees report using AI tools that were never approved by IT, so shadow AI agents are already running against company data.
- Agents become exploitable when they combine private data access, untrusted content, and external communication, the "lethal trifecta".
- EchoLeak showed the risk in practice: a zero-click vulnerability in Microsoft 365 Copilot let a single crafted email exfiltrate sensitive data.
- Organizations with high levels of shadow AI paid an average of $670,000 more per data breach than those with low or no exposure.
- Machine identities already outnumber human identities by roughly 82 to 1 in enterprise networks, and most identity programs still treat agents like static service accounts.
- The practical fix is to inventory every agent, apply least privilege, and require human checkpoints on high-stakes actions, because a ban simply gets ignored.
What is a shadow AI agent?
Shadow IT used to mean an employee expensing a project management tool without a ticket, a policy problem: an unapproved subscription sitting on a company card. Shadow AI agents are an exposure problem instead: software that ingests sensitive data, retains it, and acts on it autonomously, often with no one reviewing what it was told to do or what it did next.
An employee-built agent is any AI system, assembled with a no-code builder, a custom GPT, or a computer-using tool like Claude or Copilot Studio, that reads data and takes actions without a human approving each step. It might triage an inbox, pull customer records, draft and send replies, or update a spreadsheet. The point of building it is autonomy. That's also the point of failure.
How widespread is the shadow AI agent problem right now?
This isn't an edge case. Seventy-eight percent of AI users at work bring their own AI tools without formal IT approval, a practice Microsoft and LinkedIn call BYOAI, and it's even more common at small and midsize companies, where the figure hits 80 percent. More than 80 percent of employees report using AI tools that were never approved by IT.
These aren't chatbots answering questions in a browser tab. They're agents with standing access to inboxes, shared drives, and internal systems, built by people who never cleared a security review because there was nothing to review. If your organization has an approved-vendor list, it almost certainly undercounts the number of agents actually running against your data, and by a wide margin. We've covered how that sprawl happens tool by tool in our breakdown of the shadow AI tech stack.
Why does prompt injection make agents a new attack surface?
Here's the mechanism that turns adoption numbers into a breach headline. Large language models cannot reliably tell the difference between an instruction from their developer and an instruction buried in the content they're processing. That failure is architectural, not a bug that gets patched away. It's why prompt injection is ranked the number one risk in the OWASP Top 10 for LLM Applications, and why the injected content doesn't even need to be visible to a human, only parsable by the model.
Security researcher Simon Willison names the exact combination that makes an agent exploitable the "lethal trifecta": access to private data, exposure to untrusted content, and the ability to communicate externally. Give an agent all three and an attacker doesn't need to breach anything. They just need to get content in front of the agent, an email, a shared document, a support ticket, and the agent will do the exfiltration itself.
Meta's internal design guidance, the "Agents Rule of Two," operationalizes this: an agent should satisfy no more than two of processing untrusted input, accessing sensitive data, and changing state or communicating externally in a single session, unless a human is in the loop. That's not a compliance checkbox. It's the actual shape of the vulnerability.
What happens when an agent has the trifecta, as in EchoLeak?
This stopped being theoretical in June 2025. Security researchers at Aim Security disclosed EchoLeak, a zero-click vulnerability in Microsoft 365 Copilot, tracked as CVE-2025-32711 with a CVSS severity score of 9.3. An attacker could exfiltrate sensitive Copilot data with a single crafted email. No link click. No attachment opened. No user interaction at all.
EchoLeak had all three trifecta ingredients: Copilot could read private organizational data, it processed untrusted content (the email), and it could communicate the result externally. That's the pattern to look for in every employee-built agent you have, not just the flagship vendor products.
What does shadow AI actually cost when it goes wrong?
If the technical case doesn't move budget, the financial one should. IBM's 2025 Cost of a Data Breach Report found shadow AI was a factor in 20 percent of breaches, and organizations with high levels of shadow AI paid an average of $670,000 more per breach than those with low or no shadow AI exposure. Ninety-seven percent of organizations that suffered an AI-related security incident admitted they lacked proper AI access controls.
That 97 percent number is the real story. This isn't a sophisticated-attacker problem. It's an access-control problem, and it's fixable with governance most companies simply haven't built yet.
Why is identity a blind spot when agents outnumber employees and nobody owns them?
Even where IAM programs exist, they weren't built for this. CyberArk's 2025 Identity Security Landscape survey found machine identities already outnumber human ones inside the enterprise by roughly 82 to 1, and AI agents are a newer, harder-to-govern subset stacked on top of that ratio. Most identity programs still treat agents like static service accounts, when an agent's tool access and behavior can change session to session.
OWASP's Top 10 for Agentic Applications formalizes what falls through that gap: ASI01, agent goal hijack via injected instructions, and ASI03, identity and privilege abuse, sit at the top of a risk list built specifically because agentic systems introduce failure modes standard prompt-injection guidance doesn't cover. Our piece on securing database access for internal AI agents goes deeper on what privilege abuse looks like once an agent has a live connection string.
What is a practical framework for securing employee-built AI agents?
Banning agents doesn't remove the risk, it just removes your visibility into it. The alternative is treating every agent as a governed identity with its own access boundary. Combining NIST's AI Risk Management Framework (Govern, Map, Measure, Manage), the Frontier Model Forum's layered defense model, and OWASP's mitigations, the working checklist looks like this:
- Inventory every agent. You cannot govern what you cannot see. Build a registry of every agent running against company data, who built it, what tools it can call, and what data it can reach.
- Apply least privilege to tools and data, not just users. Scope each agent's data access and tool permissions to the narrowest set it needs for its actual job. A support-triage agent does not need write access to the billing database.
- Enforce the Rule of Two. If an agent processes untrusted input, touches sensitive data, and can act externally, all three at once, add a mandatory human approval step before it acts.
- Require human checkpoints on high-stakes actions. Sending external communications, changing financial records, or deleting data should never be a fully autonomous step, regardless of how well the agent has performed in testing.
- Layer defenses across the stack. No single control, model-level, system guardrail, harness, or tool permission, stops prompt injection on its own. Defense-in-depth across all four layers is the realistic bar.
- Sandbox execution and rotate credentials. Treat agent credentials like any other machine identity: scoped, short-lived, and rotated, not a standing API key pasted into a no-code builder.
- Monitor behavior, not just access logs. Watch what an agent actually does in production, not just what permissions it was granted. Anomalous action patterns are often the first sign of a hijacked agent.
Our guide on managing AI agents in the enterprise walks through building that registry in practice. The instruction files an agent loads at runtime carry the same privileges as the agent itself, so audit those too, not just the agent's headline permissions.
Why does governance beat prohibition?
The instinct to lock this down entirely is understandable and wrong. With 78 percent of employees already bringing their own AI tools to work, a ban is a policy that gets ignored, not a control that gets enforced. Employees who need an agent to do their job will build one whether or not IT approved it. The only real lever is making the sanctioned path faster and safer than the shadow one, so people build agents that show up in a registry instead of a browser extension nobody logged.
The goal isn't fewer agents. It's agents your security team actually knows about.
Klarna's experience with its AI customer service agent is worth remembering here too. It handled 2.3 million conversations in its first month, two-thirds of all customer service chats, doing the equivalent work of 700 full-time agents. It was also, later, a lesson in the limits of unmonitored autonomy: the company had to rehire human agents after resolution quality and customer satisfaction suffered. Autonomy without a checkpoint is a business risk even when nothing gets hacked.
Why won't agent sprawl slow down?
Gartner predicts more than 40 percent of agentic AI projects will be canceled by the end of 2027, not because the technology fails, but because of escalating costs, unclear business value, and inadequate risk controls. That's a governance failure showing up as a cancellation statistic. The agents employees are building right now aren't going away. The only real choice is whether your organization can name them, scope them, and watch them before the next EchoLeak shows up in your own inbox. Our piece on the "walk away" problem covers what happens when agents run unsupervised for days at a time, which is where most of this sprawl is headed next.
Frequently Asked Questions
What makes an employee-built AI agent different from an unapproved SaaS app?
An unapproved SaaS subscription is a policy violation. An employee-built agent can read sensitive data, retain it, and act on it autonomously, so a policy violation can become an irreversible data exposure event if the agent is exploited or misconfigured.
What is the "lethal trifecta" in AI agent security?
It's Simon Willison's term for the combination that makes an agent exploitable: access to private data, exposure to untrusted content, and the ability to communicate externally. An agent with all three can be tricked by injected instructions into exfiltrating data to an attacker.
Is prompt injection actually fixable?
Not with a single patch. It stems from an architectural limit: LLMs can't reliably separate trusted instructions from untrusted content they process. The practical answer is defense-in-depth across model, system, harness, and tool layers, plus human checkpoints on risky actions, rather than expecting one fix to close the gap.
Should companies just ban shadow AI agents?
Bans tend to fail in practice. With 78% of employees already bringing their own AI tools to work without IT approval, prohibition mostly pushes agent building further out of sight. Governance, inventorying agents, scoping their access, and requiring human checkpoints, works better than trying to ban the behavior outright.
How does IBM's breach data connect to shadow AI agents specifically?
IBM's 2025 Cost of a Data Breach Report found shadow AI was a factor in 20% of breaches and added an average of $670,000 to breach costs, with 97% of affected organizations admitting they lacked proper AI access controls, the same access-control gap that lets employee-built agents run unmonitored.
How we source, write, and correct our articles. Editorial standards



