Key takeaways
An AI assistant must distinguish information it reads from instructions it is authorised to follow.
Prompt injection can enter through user messages, documents, emails, websites and connected services.
Better prompts and detection tools are useful, but they cannot guarantee immunity.
Keep access control, sensitive-data disclosure and business-action authorisation outside the language model.
Evaluate whether an attack causes an actual policy violation, not just whether the model produces a suspicious response.
Increase AI autonomy only when the safeguards are appropriate for the consequences of failure.
What if the document your AI reads tells it what to do?
Imagine a procurement team introducing an AI assistant to review supplier proposals. Employees ask it to summarise commercial terms, identify contractual risks and compare competing offers. Everything works well during the pilot. Then a proposal arrives containing text intended to influence the assistant's assessment. Instead of evaluating the supplier against the organisation's criteria, the AI begins favouring that supplier.
The employee has not asked the AI to change its assessment criteria. The instruction came from the document itself. If the assistant is also connected to procurement systems, the consequences could extend beyond a misleading recommendation to an attempted change in a business record.
This is the central problem of prompt injection. Businesses want AI to read information from many sources, but they do not want those sources to acquire authority over the application.
Prompt injection defence for LLMs is therefore more than a chatbot security feature. It is an architectural and governance challenge that determines how safely an organisation can connect generative AI to its information and processes.
The difference between reading information and following it
A large language model (LLM) generates responses from the context provided to it. That context may include application instructions, a user's question, retrieved documents and information returned by external tools. Prompt injection occurs when untrusted input influences the model to behave contrary to the intended instructions or application policy. NIST identifies the combination of untrusted input with higher-trust prompts as central to the problem.[1]
Direct prompt injection originates in the user's input. For example, someone interacting with a customer-service assistant may attempt to persuade it to disclose information outside the permitted scope.
Indirect prompt injection originates in material the AI processes on the user's behalf. An uploaded supplier proposal, a support ticket or a public web page can contain instructions that are unrelated to the legitimate task. The person using the AI may be unaware of them.
Unlike ordinary misinformation, prompt injection attempts to influence the behaviour of the system itself. An incorrect price in a document is a data-quality problem; document content attempting to control how the assistant evaluates that price presents an additional security concern.
Jailbreaking is related but generally focuses on defeating model behaviour restrictions. Enterprise prompt injection also concerns application-specific authority, such as access to confidential records or permission to initiate transactions.
Why a stronger system prompt is not enough
An effective system prompt should define the assistant's role, expected behaviour and treatment of external content. This improves consistency, but it should not be mistaken for a technical access-control mechanism.
The UK's National Cyber Security Centre explains why prompt injection differs from conventional SQL injection: current LLMs do not provide a dependable internal security separation between instructions and data. Its guidance emphasises reducing consequences through system design rather than assuming malicious instructions can always be recognised.[2]
Consider an employee who asks a knowledge assistant to summarise a document. The model needs to interpret the document's language to complete the task. Simply asking it to ignore every imperative sentence would damage useful functionality, particularly when reading procedures, contracts and technical manuals.
Filters and specialised classifiers can help identify suspicious content. However, legitimate material can trigger alerts, and harmful content can be missed. Treat these controls as useful risk signals, not as proof that a request is safe.
The important design assumption is that the model may occasionally be misled. What matters next is whether the surrounding application permits that mistake to become a business incident.
Four controls that change the consequences of an attack
First, establish clear trust boundaries. Keep application policy in controlled configuration and identify user requests, retrieved documents and tool responses according to their origin. Preserve these distinctions throughout the workflow, even when information is summarised or passed between components. Trust labels guide the model; they are not a substitute for independently enforced permissions.
Second, restrict what the AI can access. Apply the authenticated user's record-level permissions before retrieving information and give connected services narrowly scoped credentials. An assistant that summarises invoices should not automatically gain access to payroll, payment execution or the wider finance database.
Third, separate recommendations from execution. A model can propose an operation in a structured format, but the application must decide whether it is authorised. Check the user's identity, action type, affected record, destination and applicable business rules using ordinary application code. Validate both the structure and meaning of the request.
Fourth, control what leaves the system. Check responses for inappropriate disclosure and ensure external destinations are permitted. Avoid automatically executing model-generated content or fetching external resources from generated output. Require independent approval for consequential operations, such as sending confidential documents or modifying payment information.
OWASP's prompt injection guidance recommends multiple complementary mitigations, including limited privileges, validation and human oversight.[3] The practical objective is to reduce the likelihood of manipulation while independently limiting the harm that a manipulated model can cause.
RAG can improve answers without making them secure
Retrieval-augmented generation (RAG) allows an AI assistant to search business information before answering a question. It is useful when employees need current company policies, product documentation or internal procedures. But the additional information also creates another route through which untrusted content can reach the model.
A document being stored in a corporate knowledge base does not automatically make every sentence in it authoritative. Internal repositories may contain customer correspondence, draft policies, supplier attachments and documents written by people with different permissions.
At ingestion, record document provenance, classification, ownership and approval status. At retrieval, enforce user-specific access restrictions and select sources appropriate to the task. A semantic search result indicates relevance, not authority.
For policy questions, distinguish approved policies from drafts, comments and externally supplied documents. If the retrieved sources conflict, the assistant should explain the uncertainty or refer the question to an appropriate owner rather than silently accepting a document's instruction.
Grounding and citations improve traceability, but a citation can point to a misleading source. Test whether the cited material actually supports the claim and whether it is authoritative for that decision. OWASP notes that RAG and fine-tuning do not fully address prompt injection vulnerabilities.[3]
When AI can act, the permissions matter more than the prompt
An AI assistant that only summarises information has a different risk profile from an AI agent that can send messages, create tickets or modify business records. Read-only access limits some consequences, but it does not eliminate confidentiality or misleading-output risks.
Suppose a finance department uses AI to extract invoice information. The model can produce a proposed record containing supplier name, invoice number and amount. A separate service reconciles those fields with purchase orders and approved supplier records. Any payment instruction remains subject to the existing payment authorisation process.
The same principle applies to an AI assistant handling customer refunds. The model may identify the applicable refund policy, but an independent service checks the actual order, customer permissions, refund limits and transaction state. A model response asserting that a refund is approved does not create approval.
For operations requiring human consent, show the reviewer the real proposed action, affected records and destination using trusted application data. Bind the approval to those specific parameters so a materially changed request requires a new decision.
Research by Debenedetti and colleagues proposes CaMeL, an approach that constrains the influence of untrusted information on execution and governs permitted data flows.[4] This illustrates the importance of architectural separation. The research does not establish that every deployment or workflow is immune to manipulation.
How to test whether the controls actually work
An AI security assessment should examine the whole application, including retrieval, integrations, permission checks, output handling and approval processes. Testing the language model alone cannot establish whether an unauthorised action would succeed.
Start with the legitimate task and define what must never happen: disclosure of another customer's information, unauthorised record changes or communication to an unapproved destination. Use synthetic records and isolated test integrations to examine these boundaries without exposing real customers or live business operations.
Include direct and indirect manipulation scenarios, multiple supported languages, long conversations and externally supplied documents. Test ordinary legitimate requests as well. An assistant that blocks every difficult question may appear secure in a narrow test but offer little operational value.
Measure the rate of policy violations across defined adversarial test cases. Distinguish model-level manipulation from end-to-end violations: a model may propose a prohibited action that the execution service correctly rejects. Record both, rather than reporting a single security score.
Track legitimate-task completion, incorrectly blocked requests, review volume, additional latency and the cost of operating security controls. Define the denominators and acceptance criteria before testing. Report results by workload and risk tier, since a good average can conceal a serious failure in a sensitive process.
Repeat the assessment after changes to models, prompts, retrieval sources, permissions and connected tools. An absence of observed violations on a test set is useful evidence, but it is not a guarantee against future attacks.
A practical rollout for organisations already using generative AI
Begin with an inventory of AI applications and their connections. Identify what information enters each system, which identities can use it, what records it can access and what external effects it can produce. Pay particular attention to service accounts with access broader than the authenticated user's permissions.
Prioritise assistants that combine sensitive information with external content or the ability to execute transactions. Restrict high-impact tools until permission enforcement, approval processes and security testing have been demonstrated.
Assign clear ownership. The product owner defines the legitimate business task and unacceptable outcomes. Engineering implements the boundaries. Security evaluates their robustness, and relevant risk teams provide independent challenge according to the organisation's governance model.
Create an incident process that can suspend an affected integration, restrict credentials, isolate suspicious content and investigate potentially unauthorised actions. Record sufficient evidence, such as request identifiers, policy decisions, source identifiers and action outcomes, without unnecessarily storing sensitive prompts or documents. OWASP's implementation-oriented prevention guidance provides further detail on integrating security checks around LLM applications.[5]
For a small business that only needs employees to search an approved knowledge base, a restricted read-only assistant or conventional search system may be more appropriate than a fully autonomous agent. As requirements grow, introduce additional capabilities incrementally instead of granting broad permissions at the outset.
The question leaders should ask before expanding AI autonomy
Can the organisation explain what happens when its AI assistant encounters information designed to influence it? More importantly, can it establish that important business restrictions still hold if the model behaves incorrectly?
The answer determines whether the organisation needs a better prompt, a redesigned integration, stronger access controls or a more limited AI use case. Investing in a security product without understanding those boundaries may leave the most important exposure unchanged.
If your organisation is introducing enterprise assistants, RAG or tool-enabled AI, a focused review of information flows, permissions and action boundaries can help identify where investment in security will be most useful.
In my view, the goal is not to build an AI system that must always make the right judgement to remain safe. It is to build an application whose most important security decisions remain dependable even when the AI makes a mistake.
References and further reading
[1] National Institute of Standards and Technology (NIST). Prompt injection — CSRC Glossary, drawing on NIST AI 100-2e2025, Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations. Source: https://csrc.nist.gov/glossary/term/prompt_injection
[2] UK National Cyber Security Centre. Prompt injection is not SQL injection (it may be worse). Source: https://www.ncsc.gov.uk/blog-post/prompt-injection-is-not-sql-injection
[3] OWASP Gen AI Security Project. LLM01:2025 Prompt Injection. Source: https://genai.owasp.org/llmrisk/llm01-prompt-injection/
[4] Debenedetti, E., et al. (2025). Defeating Prompt Injections by Design. Research preprint. Source: https://arxiv.org/abs/2503.18813
[5] OWASP Cheat Sheet Series. LLM Prompt Injection Prevention. Source: https://cheatsheetseries.owasp.org/cheatsheets/LLM_Prompt_Injection_Prevention_Cheat_Sheet.html
Apply the approach
Consider a hypothetical insurance claims assistant that reads customer-submitted documents, summarises claims and proposes next steps. A submission contains content intended to influence the assessment or trigger an unauthorised action. The following controls show how different parts of the system can reduce the resulting exposure. These are proposed design safeguards, not measured results from an actual deployment.
Identify customer-submitted documents as evidence, not instructions. Retrieve only information permitted for the authenticated user and retain source provenance.
Compare the proposed assessment with approved policy and claim records. Refer ambiguous or inconsistent recommendations to a qualified reviewer.
Keep the execution service separate from the LLM and enforce role-based permissions, transaction validation and any required approval before changing records or initiating payment.
Put the approach into practice
- 01Map the sources of untrusted content, sensitive information, tools and potential external effects for each AI application.
- 02Enforce user-scoped data access and restrict service credentials to the capabilities required for the legitimate task.
- 03Apply independent validation to model-generated outputs and proposed actions; add action-specific approval for consequential operations.
- 04Test with synthetic information and isolated integrations, measuring security violations alongside legitimate-task success.
- 05Monitor control decisions, maintain an incident-response process and reassess risk whenever models, data sources or integrations change.
Frequently asked questions
Can prompt injection be completely prevented?
There is no generally dependable way to eliminate prompt injection within current LLMs while retaining their full language-processing utility. Use layered safeguards and enforce important security rules outside the model. Residual risk must be assessed for each application.
Does a private or locally hosted LLM solve the problem?
No. Private hosting may improve control over data processing and infrastructure, but a locally hosted model can still be influenced by untrusted input. The application must separately enforce permissions, information disclosure and action restrictions.
Can an AI guardrail replace ordinary application security?
No. Guardrails can detect or reduce unwanted behaviour, but their predictions can be wrong. Authentication, authorisation, input and output validation, network restrictions and transaction controls remain necessary.
Should confidential information ever be included in a prompt?
Only include information necessary for an authorised task, in an approved processing environment, subject to applicable data handling policies. Do not place reusable credentials or secrets in prompts. Limit what the application retrieves and what the response is permitted to disclose.
How much does prompt injection defence cost?
Cost depends on the application's data sensitivity, integration complexity, monitoring requirements, testing effort and human-review volume. Start with an assessment of the potential impact and existing controls before selecting additional security tools.