Prompt injection in LLM apps: when text becomes an exploit
Prompt injection is the defining vulnerability class of LLM applications. An LLM cannot reliably tell instructions apart from data: if attacker-controlled text lands in the context window, it can override the system prompt and steer the model’s behaviour.
Why it matters: tools turn text into actions
On its own, a hijacked answer is low impact. The danger appears when the model is wired to tools — database queries, HTTP requests, file access, code execution, email. Now injected text can make the app act: exfiltrate data, call internal endpoints (SSRF), or trigger destructive operations. The model is confused-deputy; your tools are the weapon.
Where untrusted content gets in
- RAG ingestion — a poisoned document, web page or PDF pulled into context.
- User input — chat messages, form fields, uploaded files.
- Tool output — a third-party API or scraped page whose response re-enters the prompt.
- Multi-tenant memory — one user’s stored content surfacing in another’s session.
Patterns that actually help
There is no regex that “filters” prompt injection. Defense is architectural:
- Least privilege on tools. Scope every tool to the current user; never let the model pick a tenant id or raw URL.
- Human-in-the-loop for irreversible or sensitive actions.
- Treat tool output as untrusted and keep it out of the instruction channel where possible.
- Egress controls so a hijacked agent can’t reach internal hosts or the metadata service (SSRF).
- Output allow-lists for anything that flows into a dangerous sink.
Auditing an AI/LLM app means tracing the untrusted-content path all the way to its tools and sinks — which is where we focus. See our sample reports or request an AI/LLM audit.