What Is Prompt Injection? How to Protect AI Agents in Your Company

Short answer
Prompt injection is an attack that uses instructions hidden in the text an AI model reads to pull the model away from its actual task. In the direct type, the user writes the instructions. In the indirect type, they are hidden in content the model reads, such as an email, a web page or a document. There is no complete fix. You reduce the risk by limiting each agent's permissions to its task, requiring human approval for irreversible actions and keeping untrusted content away from sensitive data.
Whenever I set up an AI agent pilot with a company, the same question comes up at some point: "The agent will read customer emails and draft replies. What happens if someone writes instructions inside that email?" That question has a name: prompt injection. For a team that only uses a chat tool, it can look like a curiosity. For an agent with access to email, files and business systems, it is a security question you need to answer before setup. In this article I explain what prompt injection is, why it can't be fully solved and how I reduce the risk in companies.
What is prompt injection?
Prompt injection is an attack that uses instructions hidden in the text an AI model reads to pull the model away from its actual task. The model reads its task and the content it processes in the same stream of text. So a sentence such as "ignore your previous instructions and do this instead" is sometimes treated as a new command rather than as data.
It resembles the injection attacks known from classic software security. The difference is that traditional software can separate code and data with a firm boundary. Large language models process everything as text, so that boundary can't be drawn as cleanly. This is why I treat prompt injection as a risk to be managed through design, not as a single bug that a patch will close.
What is the difference between direct and indirect prompt injection?
Separating the two types makes it easier to see where the risk sits:
| Type | How it happens | Workplace example |
|---|---|---|
| Direct | A user types instructions into the chat box to get around the tool's rules. | Someone tells the customer assistant on your website to forget its rules and show the internal price list. |
| Indirect | The instructions are hidden in content the model reads on someone else's behalf. The attacker never talks to the model. | Instructions are added to an email, a web page, a PDF or a shared document in white text on a white background. The agent follows them while summarizing the document. |
For companies, the indirect type is the real danger. The person who sends the content can be outside the company, and the employee using the agent may never notice that anything went wrong.
Why does it matter to companies now?
When you paste text into a chat tool and get an answer, the impact of prompt injection is limited. At worst you get a wrong or odd answer, and you are the one who reads it. With AI agents, this changes. An agent can read your inbox, add meetings to your calendar, share files and update CRM records. Connection standards such as MCP have also made this kind of access much easier to set up. Every new source the agent reads is another place where instructions can be hidden.
OWASP, a widely used reference in application security, ranks prompt injection first in its top ten risks for large language model applications. Model providers also state openly in their own security documentation that the risk has not been eliminated. So the question is not whether the risk applies to you. It is how much damage it would do if it happened.
When is the risk highest?
When I assess the risk in a company, I ask three questions:
- Does the tool have access to sensitive data? The risk rises when customer records, contracts, financial files or employee information are within the agent's reach.
- Does the tool read untrusted content? Incoming emails, web pages, customer uploads and supplier documents all belong in this group.
- Can the tool send anything out? Sending email, opening links, sharing files and writing data to another system are all examples of this ability.
When a tool meets all three conditions at once, a hidden instruction can move sensitive data out of the company. Developer and researcher Simon Willison calls this combination the "lethal trifecta." My practical rule is simple: don't combine all three in the same agent. Removing one of them protects you more reliably than the best filter.
How can a company reduce prompt injection risk in 6 steps?
- List what each tool can access. For every AI tool and agent, record in one table what it reads, what it can write to and which accounts it is connected to. Include the extensions employees have installed themselves. I cover this in more detail in my article on shadow AI.
- Limit permissions to the task. An agent that summarizes email doesn't need permission to send email. Give each agent only the access its job requires. Split work that needs different permissions across several narrow agents instead of one powerful agent.
- Require human approval for irreversible actions. For payments, outgoing email, file deletion, changes to customer records and sharing permissions, the agent should only prepare a proposal. A person gives the final approval.
- Keep untrusted content away from sensitive data. Don't connect an agent that reads external content to internal data and outbound sending at the same time. If you add external documents to a RAG system, assume those documents can carry instructions too.
- Keep logs and monitor them. Record what content the agent read, which tools it called and which actions it took. When something unexpected happens, these logs let you trace back the cause.
- Train the team. Employees need to know what can go wrong when they ask an agent to summarize an email. A person who notices that the agent suggests something unexpected, points to a link or proposes an off-topic action is the strongest link in the chain.
None of these steps brings prompt injection to zero on its own. The goal is to keep the damage small and visible if an attack does succeed one day.
Is the provider's security filter enough?
Enterprise plans and agent platforms increasingly include filters and classifiers against prompt injection. They help, and they should be switched on. Still, I don't treat a filter as the only line of defense. Attack text keeps changing, and you need a second line that works when the filter misses something. That line is made of the permission, approval and separation decisions above. Those decisions live in your application and your company rules, not inside the model.
Common mistakes
- Connecting the agent with an employee's full permissions. A "let it run on my account" setup opens everything that person can access. Create a separate account with narrow permissions for the agent.
- Relying on the system prompt. Writing "never send data outside the company" in the instructions is a good habit, but it is not a security control. The control is that the agent has no permission to take that action at all.
- Leaving the risk to IT alone. Deciding which actions need human approval is a business decision. Business units should write that list together with IT.
- Starting the pilot with live data. Run the first tests with test accounts and sample data. Expand access step by step once you have seen how the agent behaves.
Where should you start?
The most useful thing you can do this week is to check the AI tools and agents used in your company against the three questions above. Any setup that meets all three conditions goes to the top of your review list. To decide which use needs which approval, you can use the risk tiers in my guide to AI governance for companies. If you want your team to recognize these risks in their own work, take a look at the AI data security and privacy training. To design your agent setup together, visit the AI consulting page.
Frequently Asked Questions
What is prompt injection?
It is an attack that uses instructions placed in the text an AI model reads to pull the model away from its actual task. Because the model reads its task and the content in the same stream of text, it can treat a sentence in the content as a new command.
What is the difference between direct and indirect prompt injection?
In direct prompt injection, the user writes the instructions to get around the tool's rules. In indirect prompt injection, the instructions are hidden in an email, web page or document the model reads on someone else's behalf. The indirect type is the bigger danger for companies.
Can prompt injection be fully prevented?
There is no known complete fix today. The goal is not to bring the risk to zero but to keep the damage of a successful attack small and visible. Narrow permissions, human approval and logging are the foundation.
Is there a risk if we only use chat tools like ChatGPT?
The risk is lower, because a person reads the answer and the tool takes no action on its own. Still, when you summarize an external document, keep in mind that the output may have been steered. The risk rises sharply once the tool gets access to email, files or business systems.
Who should manage prompt injection risk in a company?
IT sets up the technical controls. Business units should decide together which actions need human approval and which data the agent can access. These decisions belong in the company's AI governance records.
Want to learn to do this with AI?
In individual training sessions, live on your own project, and in corporate training for teams, I teach step by step how to do everything covered in this article with AI. Write in and I will get back to you the same day.
Message on WhatsApp See individual training Explore AI consulting
Sefa Aydın · AI Trainer & Consultant
An AI trainer and consultant who has worked on the Turkey projects of world-famous luxury brands. He teaches, hands-on, how every kind of work is done with AI: design, video, branding and vibe coding.
About Sefa Aydın → LinkedIn ↗