Prompt injection is an attack on LLM-based applications: manipulated inputs or prepared content make the model ignore its actual instructions and execute the attacker’s instead — divulging data, bypassing guardrails or abusing connected tools. OWASP lists it as the top risk for LLM applications.
The root of the problem: LLMs process instructions and data in the same channel — what looks like content can act as a command. That makes prompt injection a structural weakness that cannot simply be patched away but demands architecture work.
Direct and indirect injection
Direct injection comes from the user themselves: cleverly worded inputs that override system instructions (ignore all previous rules …) — known as jailbreaking. Annoying with chatbots, dangerous as soon as the system knows internal data or can execute actions.
Indirect injection is the more dangerous variant: the instruction sits in content the system processes — a web page the AI browser reads, an email the assistant summarises, a document in the RAG index, invisible as white text or in metadata. The user sees nothing; the model executes foreign commands. Combined with tool access (send mail, read files, call APIs) this yields real agency for attackers.
Defence in layers
- Least privilege for AI systems: minimal tools, minimal data access, no standing admin rights.
- Human in the critical path: irreversible actions (send, delete, pay) only with confirmation.
- Input and output filters or AI gateways: detect known injection patterns, check outputs for data exfiltration.
- Mark trust boundaries: treat external content as data, separate from instructions — and ingest as little unvetted material as possible.