Security in AI apps: prompt injection and data leaks
When an application gives a language model access to data or tools, a risk appears that traditional software did not have: the model can receive instructions hidden in the text it reads. It is called prompt injection, and it tops the OWASP GenAI project’s list of risks for LLM applications (LLM01:2025).
Two forms of the problem
OWASP distinguishes two variants:
- Direct: the user themselves types something that changes the model’s behavior in an unintended way.
- Indirect: the instructions arrive in external content, such as a web page, an email or a document the model processes. The legitimate user never notices.
If the system has access to sensitive information or can take actions, a malicious instruction can end in a data leak or an unauthorized action.
Why there is no definitive fix
SQL injection was largely solved with parameterized queries, which separate code from data. The UK’s National Cyber Security Centre (NCSC) warned in December 2025 that current models have no such boundary: inside a prompt, instructions and data blend together. Its conclusion is that it probably won’t be fully mitigated, and that the focus should shift from “stopping it” to reducing its impact. It also advises being wary of vendors who claim to stop it entirely. OWASP likewise says it is unclear whether foolproof prevention methods exist.
What to do when designing the application
- Least privilege. If the assistant only needs to read, don’t let it write or delete. If it only needs one customer’s data, don’t let it see everyone’s.
- Authorization outside the model. Rules about who can see what must be enforced in your system, not left to whatever the model “decides”.
- A human on important actions. Payments, sending email, changing data: have a person confirm.
- Treat output as untrusted. Validate what the model produces before using it elsewhere in the system.
- Mark and isolate external content, and log what happens so odd behavior can be detected.
- Test with real attacks before launch, and repeat when you change the model or the documents.
In short
The goal is not to ask the model to “behave”, but to build the system assuming that at some point it will be wrong or tricked, and to keep the possible damage small. If you are building or evaluating an AI application and want a second opinion on its design, write to us.