Prompt injection and how to limit it

Prompt injection happens when text the model reads, typed by a user or hidden in a web page, email or document, changes what the model does. OWASP ranks it first in its 2025 Top 10 for LLM applications and says it is unclear whether fool-proof prevention exists. The practical answer is to limit damage: narrow tools, least privilege, checks in code and human approval for risky actions.

Prompt injection and how to limit it

Topic

AI

Published

30 November 2026

Updated

30 November 2026

What is prompt injection?

OWASP defines a prompt injection vulnerability as one that occurs “when user prompts alter the LLM’s behavior or output in unintended ways”. The input does not have to be visible to a person; it only has to be parsed by the model.

There are two forms:

  • Direct injection. The user’s own message changes the model’s behaviour, on purpose or by accident. “Ignore your previous instructions” is the familiar example. Jailbreaking, which aims to switch off safety rules entirely, is a type of direct injection.
  • Indirect injection. The model reads outside content, such as a web page, an uploaded file, an email or a document in a RAG index, and that content contains instructions. The user may be entirely innocent.

Indirect injection is the form most companies underestimate. Any assistant that reads what other people wrote is exposed: a support bot that reads ticket attachments, an AI agent that triages a shared inbox, a sales assistant that browses prospects’ websites.

Why does OWASP rank it first?

The OWASP Gen AI Security Project publishes a Top 10 for LLM applications. In the 2025 edition, prompt injection is LLM01, followed by sensitive information disclosure, supply chain, data and model poisoning, improper output handling and excessive agency, among others.

The OWASP page lists scenarios worth reading with your own systems in mind:

  • A chatbot tricked into ignoring its guidelines, reading private data and sending emails.
  • Hidden instructions in a web page the model summarises, making it insert a link that leaks the conversation.
  • A poisoned document in a RAG repository steering answers.
  • Instructions hidden in an image next to harmless text, aimed at multimodal models.
  • Instructions split across a document, or written in other languages or encodings, to get past filters.

The page is also candid about the limits: “it is unclear if there are fool-proof methods of prevention for prompt injection”. That sentence should shape your design. You cannot rely on the model to spot every attack, so you limit what a successful attack can do.

Why do agents raise the stakes?

A chatbot that only produces text can embarrass you or leak what it can see. An agent that calls tools can act. OWASP’s LLM06, Excessive Agency, describes the vulnerability that “enables damaging actions to be performed” in response to unexpected, ambiguous or manipulated output, and names three root causes:

Root cause What it looks like Typical fix
Excessive functionality The agent can reach tools it does not need Remove tools; split broad tools into narrow ones
Excessive permissions A tool’s credentials allow more than the task needs Read-only access, scoped tokens, user-level permissions
Excessive autonomy High-impact actions run without a check Human approval before the action

Put the two together and the risk is clear. If an agent with mailbox access and a payment tool reads an email containing instructions, the question is not whether the model will be fooled one day; it is what the tools let it do when that happens. Protocols such as MCP make connecting tools easier, which makes this review more important, not less.

Which controls actually limit the damage?

OWASP’s mitigations for the two risks overlap. Grouped by where they sit:

In the model layer

  • Give the model a clear role and limits in the system prompt, and tell it to ignore attempts to change its core instructions.
  • Separate and clearly mark untrusted content, such as retrieved documents or emails, so it is treated as data.

In your application code

  • Define the expected output format and validate it with deterministic code before anything is executed.
  • Filter inputs and outputs for sensitive content and known attack patterns.
  • Keep API tokens and privileged functions in code, not in the prompt.

In the systems the agent touches

  • Apply least privilege: read-only database access where reading is enough, scoped OAuth permissions, the user’s own rights rather than a shared admin account.
  • Enforce authorisation in the downstream system. OWASP’s wording is direct: implement it there “rather than relying on an LLM to decide if an action is allowed or not”.
  • Prefer narrow tools (“create a draft reply”) over open-ended ones (shell access, “send any email”).

In the process

  • Require a person to approve high-impact actions such as payments, deletions, external emails or contract changes.
  • Log tool calls and rate-limit risky actions so that misuse is visible and bounded.
  • Test regularly with attack simulations, treating the model as an untrusted user.

How do you test an assistant for prompt injection?

Start with a short, written test set and run it before each release:

  1. Direct attempts. Messages that ask the assistant to reveal its instructions, change role or skip rules, in Turkish, English and mixed languages.
  2. Indirect attempts. Documents, web pages and emails with hidden instructions placed where the assistant will read them.
  3. Tool abuse. Requests designed to make the agent call a tool it should not, or with parameters outside its task.
  4. Data reach. Questions that try to pull another customer’s or employee’s data.

Record what happened, fix the control rather than only the prompt, and keep the cases for regression testing. This fits naturally into the evaluation routine described in our RAG evaluation guide.

What about assistants that answer from documents?

Assistants built on retrieval, where the model answers from your own documents, deserve a separate look. OWASP’s list includes a scenario in which a poisoned document in a RAG repository steers the model’s answers, and the 2025 Top 10 has its own entry for vector and embedding weaknesses (LLM08).

Three controls follow from OWASP’s mitigations. First, decide who may add content to the index, and treat documents from outside the company, such as supplier PDFs or customer uploads, as untrusted and clearly marked. Second, apply access control at retrieval time, so the assistant only retrieves what the asking user is allowed to see. Third, check outputs against the expected format and sources before they are shown or acted on.

Where to start

  1. List every assistant and agent you run, with the tools and data each can reach. Our AI agent inventory post describes the fields.
  2. For each, mark which content comes from outside the company and is therefore untrusted.
  3. Remove tools and permissions that are not needed for the task.
  4. Add human approval to every action that moves money, deletes data or contacts someone outside the company.
  5. Write a ten-case injection test set and run it before each change.

Corrplus designs and builds AI agents and chatbots with narrow tools, scoped permissions and approval steps from the start, and reviews existing setups as part of AI governance work. If you want a second look at an assistant that is already live, the AI discovery sprint is a structured way to start.

Want help with this?

Book a call to apply what “Prompt injection and how to limit it” describes to your company. We will listen and agree the first step together.

Frequently asked questions

Can a better system prompt stop prompt injection?

It helps, but it is not enough. OWASP lists constraining model behaviour in the system prompt as one mitigation, alongside output validation, filtering, least privilege, human approval and adversarial testing. It also says it is unclear whether fool-proof prevention exists, so design as if the model can be manipulated.

What is indirect prompt injection?

It is when the model reads external content, such as a web page, an email, a file or a document in a RAG index, that contains instructions. The user may never see them. An assistant that summarises supplier emails or browses the web is exposed to this even if every user is trusted.

Is a chatbot that only answers questions at risk?

Yes, but the impact is smaller. A manipulated question-answering bot can leak its system prompt, reveal data it can reach or say things your company would not. An agent that can send emails, change records or make payments can do much more damage, which is why OWASP pairs prompt injection with excessive agency.

Who should own this risk?

The team that builds the assistant owns the controls, but the decision about which actions an agent may take without a person belongs to the business owner of the process. Record both in your AI inventory and review them when tools or permissions change.

Related services

ServiceAI agent developmentAI agents that run multi-step work in your ERP, CRM and email through tools, with human approval built in.
ServiceAI chatbot developmentWe build website and WhatsApp chatbots that answer from your content and hand over to your team when needed.
ServiceLLM integration servicesWe connect OpenAI, Claude, Gemini or open models to your ERP, CRM and apps, with cost and residency planned.
ServiceAI governance and complianceWe inventory your AI use, classify it under KVKK, GDPR and the EU AI Act, and build the rules and technical controls.

Related articles

Let’s talk about your transformation

Tell us which work repeats every week. We will tell you honestly whether it is worth automating.

How we start

  1. A free first callWe pin down the problem and the goal together.
  2. A 2-week discovery sprintWe look at the data, the process and the tools, and decide where to start.
  3. A written proposalScope, architecture and timeline, in writing.

Example questions

Go straight to

CorrAI answers with AI from the content of this site and can be wrong. Please do not enter personal details. Privacy

Book a free call