Tool results as an injection path: OWASP and Microsoft guidance on marking and testing
OWASP's LLM01 entry describes indirect prompt injection as an LLM accepting input from external sources, such as websites or files. Microsoft's guidance on testing agents applies that to tool use: it states that, for an agent, every tool result is content from an external source. Any tool an agent calls is therefore a possible path for indirect injection, not only tools that fetch web pages or files. [1] [2]
Neither source offers a complete fix. OWASP states that, given the stochastic way models work, it is unclear whether fool-proof methods of prevention exist. Its listed mitigation is to separate and clearly denote untrusted content to limit its influence. Microsoft's version is more concrete: mark tool results as untrusted in what is sent to the model, and state in the system prompt that they are to be treated as data, not instructions. Given OWASP's caveat, that labelling limits the influence of injected text rather than removing it. [3] [4] [5]
For testing, Microsoft recommends planting a harmless instruction in a tool response and observing what the agent does. It notes that model output can vary between runs, so each case should run more than once. A single run in which the agent does not act on the planted text is not evidence that it never will. [6] [7]
Taken together, the two pages give a build-and-test routine. At build time, every tool result enters the prompt marked as untrusted, and the system prompt says such content is data. At test time, the eval suite includes tool responses carrying a harmless planted instruction, repeats each case several times, and counts any run where the agent acts on that instruction as a failure. Since OWASP gives no guarantee of prevention, the repeated test is the check on whether the labelling holds. [3] [4] [5] [6] [7]
Sources
- genai.owasp.org/llmrisk/llm01-prompt-injectionIndirect prompt injections occur when an LLM accepts input from external sources, such as websites or files.
- learn.microsoft.com/en-us/microsoft-cloud/dev/dev-proxy/concepts/test-ai-agent-prompt-injection-tool-responsesFor an agent, every tool result is content from an external source.
- genai.owasp.org/llmrisk/llm01-prompt-injectionGiven the stochastic influence at the heart of the way models work, it is unclear if there are fool-proof methods of prevention for prompt injection.
- genai.owasp.org/llmrisk/llm01-prompt-injectionSeparate and clearly denote untrusted content to limit its influence on user prompts.
- learn.microsoft.com/en-us/microsoft-cloud/dev/dev-proxy/concepts/test-ai-agent-prompt-injection-tool-responsesMark tool results as untrusted in what you send to the model, and tell the model in your system prompt to treat them as data, not instructions.
- learn.microsoft.com/en-us/microsoft-cloud/dev/dev-proxy/concepts/test-ai-agent-prompt-injection-tool-responsesPlant a harmless instruction in a tool response and watch what your agent does.
- learn.microsoft.com/en-us/microsoft-cloud/dev/dev-proxy/concepts/test-ai-agent-prompt-injection-tool-responsesModel output can vary between runs, so run each case more than once.