10 min read, Readers will understand what prompt injection is, how attacks can enter GenAI applications, why RAG and AI agents increase the potential impact, and which security controls organizations should implement to reduce risk.
From the journal

Generative AI has moved from experimental chatbots into production applications that can search internal knowledge bases, analyze documents, interact with APIs, access business systems, and perform actions on behalf of users. This expansion creates a new security problem: the same language-based interface that makes AI useful can also be manipulated by carefully crafted instructions. OWASP currently ranks Prompt Injection as LLM01:2025 in its Top 10 for Large Language Model Applications.
Prompt injection occurs when an attacker supplies instructions that cause an AI model or AI-powered application to behave in a way that was not intended by its developers. Unlike traditional injection attacks that rely on special characters or programming syntax, prompt injection can use ordinary natural language, encoded content, instructions hidden inside documents, or other content that the model interprets as instructions. OWASP notes that prompt injections do not necessarily need to be visible or readable to a human as long as the model can process them.
A simple example is a customer-support chatbot designed to answer questions using company documentation. A legitimate user may ask about a product return policy, while an attacker attempts to influence the model with an instruction that tells it to ignore its normal rules and reveal information that should remain private. The application may still be functioning normally at the software level, but the model has been manipulated into following an unintended instruction.
Direct prompt injection happens when the attacker places the malicious instruction directly into the prompt. This can include attempts to override system instructions, change the intended task, manipulate the model into revealing restricted information, or cause it to produce an unsafe response. Direct injection is often associated with jailbreak-style behavior, but prompt injection is broader because it includes attacks that manipulate the application’s intended workflow rather than simply bypassing a safety policy.
Indirect prompt injection can be even more concerning for enterprise AI applications. Instead of placing the malicious instruction directly in the user's message, an attacker places it inside content the AI is expected to process, such as a web page, PDF, email, support ticket, uploaded document, knowledge-base article, or other retrieved data. When the AI reads that content, it may interpret the embedded instructions as commands rather than untrusted data. OWASP explicitly identifies indirect prompt injection as a form of prompt injection and notes that it can be intentional or unintentional.
This becomes especially important for Retrieval-Augmented Generation (RAG) systems. A RAG application retrieves documents or other knowledge sources and places relevant content into the model's context. If an attacker can influence one of those sources, the retrieved content may contain instructions designed to alter the model's behavior. RAG improves relevance and access to enterprise knowledge, but it does not by itself eliminate prompt injection risk. OWASP also identifies vector and embedding weaknesses as a separate security category because weaknesses in retrieval systems can contribute to unauthorized access, manipulation, and data leakage.
The risk increases further when an AI application is connected to tools. Modern AI agents may be able to search databases, send messages, create records, execute workflows, access files, call APIs, or interact with cloud services. A successful prompt injection is therefore not limited to generating a strange response: it can potentially influence what the AI does in connected systems.
This is closely related to excessive agency, which OWASP identifies as LLM06:2025. Excessive agency occurs when an AI application has more functionality, permissions, or autonomy than it actually needs. A manipulated model with read-only access may cause limited damage, while a manipulated agent with permission to modify records, send external communications, or access sensitive systems can create substantially greater impact.
Potential consequences of prompt injection include sensitive information disclosure, leakage of system instructions or internal context, manipulation of model output, unauthorized use of connected functions, execution of unintended actions, and interference with important business decisions. OWASP emphasizes that the severity depends heavily on the business context and how much authority the AI application has.
Organizations should also consider multimodal prompt injection. AI systems increasingly process text together with images, documents, audio, and other data types. Malicious instructions may be embedded in content that appears harmless to a human but is interpreted by the model as meaningful instructions. OWASP specifically highlights the additional risks introduced by multimodal AI systems.
One important misconception is that prompt injection can be completely solved by writing a better system prompt. Strong system instructions are useful, but they should not be treated as a security boundary. The model is still interpreting natural-language content, and application security controls must exist outside the model itself. Organizations should assume that user input and retrieved content can be adversarial.
A stronger defense begins with least privilege. AI agents should receive only the tools and permissions required for the task. A document-search assistant does not need permission to delete documents. A support chatbot does not need unrestricted database access. An AI workflow that can read customer information may not need permission to modify customer accounts. Reducing functionality, permissions, and autonomy limits the impact of a successful manipulation. OWASP specifically recommends addressing excessive functionality, excessive permissions, and excessive autonomy.
Organizations should also separate trusted instructions from untrusted content as much as possible. User prompts, retrieved documents, web content, emails, and external API responses should be treated as data rather than automatically trusted instructions. Access controls should be enforced by the application and downstream services rather than relying on the model to decide whether a user is authorized.
Tool access should use allowlists, narrowly scoped functions, explicit schemas, strong server-side authorization, and validation of arguments before an action is executed. High-impact actions should require additional approval or confirmation rather than allowing the model to perform them autonomously.
For RAG systems, security teams should review the entire retrieval pipeline, not just the language model. This includes document ingestion, permissions, indexing, embeddings, vector stores, metadata filtering, tenant isolation, retrieval logic, and the final context passed to the model. A user should never be able to retrieve information merely because the model happened to select it.
Output handling is equally important. AI-generated output should not automatically be treated as trusted input for downstream systems. Applications should validate generated parameters, enforce authorization independently, use safe parsers, and reject unexpected values before passing AI output to databases, APIs, operating-system commands, or business workflows.
Monitoring should focus on behavior rather than only traditional error messages. Organizations can look for unusual tool calls, unexpected access patterns, abnormal prompt lengths, repeated attempts to override instructions, unusual retrieval behavior, sensitive-data requests, and changes in AI behavior. Security logging should preserve enough context to investigate an incident without unnecessarily storing sensitive user data.
AI security testing should therefore go beyond asking whether a chatbot can be "jailbroken." A professional assessment should evaluate direct and indirect prompt injection, instruction conflicts, data leakage, RAG poisoning scenarios, system-prompt exposure, tool misuse, authorization boundaries, excessive permissions, unsafe output handling, and high-impact actions. OWASP's 2025 guidance provides a broader risk model that includes prompt injection, sensitive information disclosure, supply-chain risk, data and model poisoning, improper output handling, excessive agency, system prompt leakage, vector and embedding weaknesses, misinformation, and unbounded consumption.
The security landscape is evolving quickly because AI applications are becoming more autonomous. OWASP released guidance for Agentic Applications in late 2025, emphasizing risks such as tool misuse, identity and privilege abuse, and other problems associated with systems that can take actions rather than simply generate text. This makes traditional application-security controls—authentication, authorization, least privilege, validation, logging, and segmentation—just as important in AI systems as they are in conventional applications.
Final Takeaway
Prompt injection is not simply a problem of users asking a chatbot the wrong question. It is an application-security problem created by the interaction between untrusted content, probabilistic model behavior, application instructions, external data, and connected tools. As organizations move from simple chat interfaces toward RAG systems and autonomous AI agents, the potential impact of a successful manipulation increases.
The safest approach is to assume that AI instructions can be manipulated and build security controls around the model rather than trusting the model to protect itself. Strong authorization, least-privilege access, isolated retrieval, validated tool calls, human approval for sensitive actions, secure output handling, monitoring, and continuous adversarial testing can significantly reduce the impact of prompt injection.
Have a related challenge in mind?
Start a conversation