Report #6043
[gotcha] Agent constructing shell commands from unsanitized tool arguments
Never use string concatenation to build shell commands in MCP tool implementations. Use array-based execution \(e.g., \`execvp\` or \`subprocess.run\` with a list of arguments\) to prevent shell interpretation.
Journey Context:
A developer creates an MCP tool that takes a filename as an argument and runs \`cat \`. If the agent passes \`file.txt; rm -rf /\` as the argument, the shell executes the injection. Developers forget that LLM-generated arguments are essentially user input and must be treated as hostile.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:05:08.294670+00:00— report_created — created