SECURITY · LLMs · RAG · AGENTS · ~15 MIN
When AI becomes an attack surface
Lia deployed an AI agent to support an online store. The agent read tickets, searched manuals, and helped customers with their orders. It worked beautifully — until hidden text inside a support request tried to take control.
We will follow that incident from beginning to end. No alphabet soup up front: first the story, then the technical names.
CUSTOMERMy order has not arrived yet.
NORAI will check the order and its shipment.
NORAIt arrives tomorrow. Anything else?
SCENE 01 · BEFORE THE INCIDENT
An agent that became too useful
Nora started as a chatbot. Then Lia connected the agent to company manuals, customer history, and the order system. Finally, she added tools for sending email and granting refunds.
Every integration removed manual work. It also increased what a mistaken interpretation could cause. Nora no longer produced words alone: her words could select actions.
More context + more tools = a larger attack surface
SCENE 02 · THE INPUT
The ticket that was more than a ticket
An attacker opened an ordinary-looking request. At the end of its attachment was an instruction written for the AI, not the support team. It attempted to change the task, retrieve private information, and use a tool.
Lia did not write that order. Neither did the legitimate user. Yet the model received all of it as text. This confusion between content to be read and instructions to be followed is the core of prompt injection.
SCENE 03 · THE CONTEXT
RAG does not know whom to trust
The attachment was indexed with every other document. When Nora searched for passages related to the order, the system retrieved the contaminated text and placed it next to the legitimate instructions.
RAG means retrieving information before answering. Vector search, however, measures similarity — not truth, intent, or permission. If hostile text looks relevant, it can be retrieved as well.
SCENE 04 · THE ACTION
When a sentence gains permission
If Nora only wrote a reply, the incident might have ended with incorrect text. But she had tools. The contaminated instruction influenced the plan, and the agent attempted to retrieve data beyond that support case.
This is where prompt injection meets excessive agency: the model has more functions, privileges, or autonomy than the task requires.
The fix is not to ask the same model if its action looks safe. It is to place a deterministic barrier between decision and execution.
SCENE 05 · THE CHAIN
An incident does not happen all at once
MITRE ATLAS helps us see attacks against AI as a sequence. The adversary studies the application, prepares an input, influences execution, attempts to collect data, and seeks to create impact.
Prompt injection is one technique inside that story — not the whole story. Mapping the chain reveals where to detect, block, and investigate, even after an earlier control has failed.
- 01OBSERVElearn the agent
- 02ENTERplant content
- 03INFLUENCEchange the plan
- 04COLLECTreach data
- 05IMPACTuse or extract data
SCENE 06 · REBUILDING
The fix does not fit inside a prompt
Lia could add a line saying “do not follow instructions from documents.” It would help, but still depend on model interpretation. So she rebuilt the entire path.
Documents gained provenance and permission metadata. Retrieval filtered by user before assembling context. Tools became smaller and used constrained credentials. Sensitive actions required approval. Logs recorded which source influenced each action.
The model could still make a mistake. The difference was that the mistake would now meet locked doors.
- IDENTITYwho is asking?
- DATAwhat may enter context?
- MODELwhat task was defined?
- POLICYis this action allowed?
- EXECUTIONwhat is the least privilege?
- OPERATIONShow do we detect and stop it?
SCENE 07 · NOW, THE TECHNICAL NAMES
Ten risks, one chain
After the story, the OWASP Top 10 becomes easier to read: each name points to a part of the path we just followed.
SCENE 08 · BEFORE GOING BACK ONLINE
Lia's checklist
Nora returned to production after the team could answer “yes” to the questions below. They do not make a model impossible to deceive; they reduce the chance that deception receives enough power to become an incident.
- Do we know every input: conversation, file, webpage, memory, and tool result?
- Does authorization happen outside the model and before retrieval?
- Does each RAG chunk preserve provenance, tenant, version, and permission?
- Do tools expose only small and specific operations?
- Do sensitive actions require human approval or deterministic policy?
- Is every output validated before becoming HTML, a command, URL, or API call?
- Are steps, tokens, cost, runtime, and network access bounded?
- Can we trace source, decision, tool, result, and accountable identity?
- Can we revoke credentials and disable a tool immediately?
- Have we tested indirect injection, poisoning, tool abuse, and tenant isolation?
SOURCES AND RESEARCH MATERIAL
OWASP · Top 10 for LLM and generative AI applications ↗MITRE · ATLAS tactics and techniques against AI systems ↗NIST · AI Risk Management Framework ↗IBM Technology · AI Attacks ↗IBM Technology · OWASP Top 10 for LLMs ↗IBM Technology · Prompt Injection ↗IBM Technology · MITRE ATLAS ↗THE END · THE INCIDENT WAS CONTAINED
AI may propose. Architecture must constrain.
The more an application can read, remember, and do, the more important it becomes to separate language from authority.