Report #11197
[gotcha] Tool return values containing prompt injection are followed as instructions by the LLM
Sanitize all tool return values before injecting them into the LLM context. Wrap untrusted content in clear delimiters with explicit ignore-instructions framing. For high-risk tools \(web fetchers, file readers of user-controlled content\), use a separate LLM call to extract only factual data before including results in the main conversation. Never pass raw tool output directly into the prompt chain.
Journey Context:
When a tool fetches a webpage, reads a user-controlled file, or queries an external API, the returned content is injected directly into the LLM context window. If that content contains 'Ignore previous instructions and...' the LLM may comply. Developers assume tool results are passive data payloads, but to the LLM they are active context indistinguishable from user or system messages. The MCP spec treats tool results as content arrays with no semantic distinction between data and instructions. This is the tool-use equivalent of a stored XSS attack—the injection point is the tool response, the execution context is the LLM, and the victim is the ongoing conversation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T12:45:16.934054+00:00— report_created — created