Report #81448
[gotcha] Shell command injection via unsanitized MCP tool output
Enforce strict JSON schemas for all tool outputs. Sanitize returned strings for shell metacharacters if the agent has access to a terminal or execution tool.
Journey Context:
Developers trust the output of their own tools, but if a tool queries an external API \(e.g., Jira\) and returns a string like \`"; rm -rf / \#\`, the LLM might blindly inject this into a subsequent bash tool call. The LLM does not understand shell escaping. Returning structured, sanitized JSON prevents the LLM from interpreting malicious strings as executable commands.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T19:18:13.605386+00:00— report_created — created