Home / Insights / AI Risk and Governance
Prompt Injection: The Security Problem of AI Applications
Text from outside can hijack a language model's behaviour. Defence depends on system design.
Conventional software keeps code and data apart. A language model receives both as text in one stream, and may follow instructions wherever they appear.
Direct and indirect
Direct injection is a user typing something like "ignore your previous instructions". Indirect injection is more serious: an instruction hidden in a web page, email or document that the system later processes. Greshake and colleagues demonstrated that such content could steer applications built on language models, including causing data to be leaked.
The user may see nothing unusual. The attacker never touches your system directly.
Diagram by O&O Consulting.
Why filtering is not enough
Detectors and warnings in the system prompt reduce success rates, but attacks can be rephrased endlessly, translated or encoded. No current filter provides a guarantee. The OWASP list of risks for language model applications places prompt injection first.
Design principles
- Treat all model output as untrusted input to the next system.
- Grant tools the narrowest permissions possible.
- Do not combine, without checks, access to private data, exposure to untrusted content and the ability to communicate externally.
- Require confirmation, showing exactly what will happen, before consequential actions.
- Block automatic loading of links or images that could carry data out.
- Enforce access control in ordinary code.
Test and monitor
Include hostile documents in your test set. Log tool calls and review anomalies. Decide in advance how to disable a feature quickly.
Limitations and open questions
Research is exploring architectures that separate a trusted planner from a component that reads untrusted data, and training that gives system instructions priority. These help, and none yet makes it safe to give an unsupervised model broad authority over sensitive resources.
References
- Greshake, K. et al. (2023). "Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection." arxiv.org/abs/2302.12173
- OWASP Foundation. "Top 10 for Large Language Model Applications." owasp.org/www-project-top-10-for-large-language-model-applications/
- Wallace, E. et al. (2024). "The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions." arxiv.org/abs/2404.13208
This article is general information, not financial, legal or investment advice. AI research and rules change quickly; check the cited sources for the current position.