Prompt Injection and AI Security: The New Risks of Putting AI in Front of Customers
What prompt injection is, why it is the top security risk for AI chatbots and agents, and the layered defences businesses need before AI touches customers or data.
// quick answer
Prompt injection is an attack where someone hides instructions in text an AI system reads — a chat message, document, email or web page — to make it ignore its rules, reveal data or take unintended actions. It is listed as the top risk in the OWASP Top 10 for large language model applications. There is no single fix; businesses need layered defences: limited permissions, input and output controls, human approval for sensitive actions, monitoring and security testing.
// key points
- Any text an AI reads can carry hidden instructions, not just user messages.
- The risk grows when AI can access data or take actions in your systems.
- No filter blocks every attack, so design for limited damage.
- Least-privilege access and human approval are the strongest safeguards.
- Test AI features like any other attack surface, before and after launch.
// in this article
Businesses are putting AI in front of customers fast: website chatbots, support agents, AI assistants connected to inboxes and internal systems. Each of these creates a new kind of security risk that traditional web security was not designed for. The most important one is prompt injection.
What is prompt injection?
Large language models follow instructions written in plain language. Prompt injection exploits that: an attacker writes instructions that the AI mistakes for legitimate ones, causing it to ignore its rules, leak information or take actions it should not. The OWASP Top 10 for Large Language Model Applications lists prompt injection as the number one risk.
How does prompt injection work?
- Direct injection: a user types instructions into a chatbot, such as asking it to ignore its rules and reveal its hidden instructions or data.
- Indirect injection: instructions are hidden in content the AI reads later — a web page, an uploaded document, an email or a product review — and activate when the AI processes it.
Indirect injection is especially dangerous for AI agents that browse, read email or process documents, because the attacker never needs to talk to the AI directly.
What can go wrong
- Leaking confidential data, system prompts or other customers’ information.
- Giving customers false information, offers or commitments in your name.
- Taking unauthorised actions, such as sending emails, changing records or issuing refunds.
- Bypassing content rules and producing harmful or embarrassing output.
How to prevent prompt injection attacks
No single control is enough. Effective protection is layered:
- Least privilege: give the AI access only to the data and actions it truly needs.
- Separate trusted and untrusted content: treat anything from users, documents and the web as data, not instructions.
- Human approval for sensitive actions such as payments, refunds, data exports and external messages.
- Input and output controls: detect suspicious instructions and block sensitive data from leaving.
- Logging and monitoring: record prompts, tool calls and outputs so attacks can be spotted and investigated.
- Security testing: red-team AI features with injection attempts before launch and after every major change.
AI security is now part of application security
Prompt injection is one of several AI-specific risks, alongside data leakage, insecure plugins and tools, and over-reliance on AI output. Businesses that treat AI features as part of their attack surface — with threat modelling, penetration testing and clear governance — can adopt AI with confidence instead of waiting for an incident to force the issue.
Frequently asked questions
What is prompt injection?
Prompt injection is an attack where hidden or malicious instructions in text make an AI system ignore its rules, reveal data or take unintended actions.
How does prompt injection work in generative AI?
AI models follow natural-language instructions. Attackers place instructions in user messages or in content the AI reads, such as documents or web pages, so the model treats them as legitimate.
How do you prevent prompt injection?
Use layered defences: least-privilege access, separation of trusted and untrusted content, human approval for sensitive actions, input and output controls, monitoring and regular security testing.
Is prompt injection a risk for small businesses?
Yes, especially if a chatbot or AI assistant can access customer data or take actions in business systems.