Prompt injection is the number one security risk for large language model applications. It manipulates a model into unintended behaviour through crafted input, and it comes in direct and indirect forms. It is hard to fully prevent because models cannot reliably separate trusted instructions from untrusted data in the same context. There is no complete fix, only layered mitigations that reduce the risk.
For anyone building on a large language model, prompt injection is the risk to understand first. It is ranked number one in the OWASP LLM Top 10 for good reason: it is common, it is powerful, and it cannot be fully solved.
What is prompt injection?
Prompt injection is an attack in which crafted input manipulates a large language model into behaviour its developers did not intend, such as ignoring its instructions, revealing information it should keep hidden, or taking an action it should not. It is ranked as the number one risk in the OWASP Top 10 for LLM Applications, and it has held that position across editions.
The reason it exists is fundamental to how language models work. An LLM receives its developer’s instructions, the system prompt, and the user’s or external content in the same context, and it processes all of it as language. It has no reliable way to know that the developer’s instructions are trusted and the rest is not. So an attacker who can get text in front of the model can attempt to override or subvert the intended behaviour simply by writing instructions that the model treats as authoritative. This is different from a traditional application flaw, and it is why prompt injection is treated as the defining security problem of LLM applications rather than a peripheral one.
What is the difference between direct and indirect prompt injection?
OWASP distinguishes two forms, and the difference matters for how a system is defended. In direct prompt injection, a user enters input that directly alters the model’s behaviour, for example a crafted message that tells the model to ignore its previous instructions and do something else. The malicious input comes straight from the person interacting with the model.
In indirect prompt injection, the malicious instructions come from an external source that the model ingests, a web page it browses, a document it summarises, an email it reads, or a file retrieved from a knowledge base. The instructions are hidden in that content, and the model acts on them when it processes the content. Indirect injection is the more dangerous form for modern applications, because retrieval augmented generation and AI agents are built to read external content, which means every document or web page they consume is a potential injection vector. An attacker does not need to interact with the application at all, they just need to plant instructions in content the application will later read.
Is jailbreaking the same as prompt injection?
Jailbreaking is a form of prompt injection, though it is often discussed separately. It targets the model’s safety alignment specifically, using crafted prompts to bypass the content restrictions and guardrails the model was trained with, for example to make it produce content it is designed to refuse.
OWASP treats jailbreaking as a subset of prompt injection, because it exploits the same underlying weakness, the model acting on instructions it should not. Practitioners often distinguish the two because the defences differ in emphasis: jailbreaking is primarily about the model’s safety layer, while prompt injection more broadly includes subverting an application’s intended behaviour and reaching connected tools and data. For most organisations building on LLMs, the practical point is that both are the same class of problem, and the same layered defences apply. Treating jailbreaking as entirely separate can lead teams to defend the safety layer while leaving the broader application logic exposed.
Why is prompt injection so hard to prevent?
Prompt injection is hard to fully prevent because of the architecture of current language models, not because of a bug that can be patched. The model processes trusted instructions and untrusted data in the same context window and cannot reliably separate them, because it interprets everything as language rather than as typed, bounded data.
Compare it with SQL injection, a traditional flaw that is well understood. SQL injection has a clean fix: separate code from data using parameterised queries, so user input can never be executed as a command. Prompt injection has no equivalent clean boundary, because there is no way to mark part of the model’s input as data that must never be treated as an instruction, the model does not enforce that distinction. Research continues on stronger separation, but as things stand OWASP is clear that there is no complete fix, only risk reduction. This is why prompt injection stands at the top of the LLM risk list and why it should drive the design of any LLM application: the model cannot be assumed to resist a determined injection attempt, so the design must limit what a successful injection can achieve.
How do we mitigate prompt injection?
Because prompt injection cannot be fully prevented, the goal is to reduce its likelihood and limit its impact, through layered measures OWASP recommends. Constrain the model’s behaviour with clear system instructions about what it should and should not do. Validate and filter input where possible. Segregate and clearly label external or retrieved content so the model is less likely to treat it as authoritative instructions.
The most important measures limit the blast radius of a successful injection. Apply least privilege to what the model and its connected tools can do, so that even if the model is subverted, it cannot reach sensitive data or take high impact actions. Require human approval for consequential actions, so an injected instruction to, say, send money or delete data is not executed automatically. Filter and validate the model’s output before it is used or passed to another system. And test adversarially, red teaming the AI application to find injection paths before attackers do. None of these is sufficient alone, and together they do not make injection impossible, but they make a successful injection far less damaging. The design principle is to assume injection can happen and ensure it cannot cause serious harm. For an organisation securing an AI application, Cybernion helps through ISO 42001 and broader advisory.
Frequently asked questions
What is prompt injection?
Prompt injection is an attack in which crafted input manipulates a large language model into unintended behaviour, such as ignoring its instructions, revealing hidden information or taking an action it should not. It is ranked as the number one risk in the OWASP Top 10 for LLM Applications. It works because current LLMs cannot reliably tell the difference between trusted instructions from the developer and untrusted data in the same context.
What is the difference between direct and indirect prompt injection?
In direct prompt injection, a user enters input that directly alters the model’s behaviour, for example a crafted message that overrides the system instructions. In indirect prompt injection, the model ingests content from an external source such as a web page, document or email that contains hidden instructions, and those instructions alter its behaviour. Indirect injection is the dominant risk for retrieval augmented generation and AI agents that read external content.
Is jailbreaking the same as prompt injection?
Jailbreaking is a form of prompt injection. It targets the model’s safety alignment specifically, using crafted prompts to bypass the content restrictions and guardrails the model was trained with. Practitioners often distinguish jailbreaking from other prompt injection because the defences differ, but OWASP treats it as a subset of prompt injection. Both exploit the same underlying weakness in how models process instructions and data together.
Why is prompt injection so hard to prevent?
Prompt injection is hard to fully prevent because current large language models process trusted instructions and untrusted data in the same context window and cannot reliably separate the two. Unlike a traditional injection flaw such as SQL injection, there is no clean boundary to enforce, because the model interprets everything as language. As a result there is no complete fix, only measures that reduce the risk, which is why it remains the top LLM risk.
How do we mitigate prompt injection?
Mitigations recommended by OWASP include constraining model behaviour through clear system instructions, validating and filtering input, segregating and clearly labelling external content so the model does not treat it as instructions, applying least privilege to what the model and its tools can do, filtering model output, requiring human approval for high impact actions, and adversarial testing. No single measure is sufficient, so these are layered together.
Written by Gaurav Vikash, an ASD endorsed IRAP assessor and senior cyber security leader with 18 years of experience across Australia, the UK and Asia, including CISO and senior security leadership roles. He holds CISSP, CISA, CISM and CRISC and is an ISO 27001 Lead Auditor and ISO 42001 Lead Implementer, and speaks regularly at industry conferences.
Sources:
- LLM01:2025 Prompt Injection, OWASP Gen AI Security Project, 2025
- OWASP Top 10 for LLM Applications 2025, OWASP Gen AI Security Project, 2025
- Guidelines for secure AI system development, National Cyber Security Centre, 2023
- Engaging with Artificial Intelligence, Australian Signals Directorate, 2024
Last updated: 30 August, 2026
