Report #59030
[gotcha] MCP tool arguments executing arbitrary shell commands
Never pass raw LLM-generated arguments directly to shell exec or eval. Use parameterized commands, strict allowlists, or structured inputs mapped to function arguments instead of string concatenation.
Journey Context:
A common pattern is an LLM agent generating a string argument for a tool that runs a bash command. If the tool naively concatenates this string \(e.g., os.system\('ls ' \+ path\)\), a malicious user prompt or RAG context can inject shell commands \(e.g., '; rm -rf /'\). Developers trust the LLM to format arguments correctly, but LLMs are easily manipulated via indirect prompt injection to output malicious payloads.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T05:34:13.408138+00:00— report_created — created