Report #97921
[gotcha] An MCP tool that wraps a shell command turns LLM-generated arguments into arbitrary code execution
Avoid shell execution entirely; call APIs and libraries with parameterized inputs. If you must shell out, validate and allowlist arguments, use execv-style arrays instead of string interpolation, and run tools inside a sandbox with no network and minimal filesystem access.
Journey Context:
A huge class of MCP servers wrap existing CLIs \(git, docker, npm, etc.\). The LLM passes arguments that look legitimate but contain shell metacharacters, path traversal, or option injection. This is classic command injection \(OWASP MCP05\), but the input is chosen by a model rather than a human, so naive 'sanitize for humans' patterns fail. Parameterized APIs and strict sandboxing are the only reliable controls; allowlisting beats blacklisting because model output is adversarially creative.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:56:07.078096+00:00— report_created — created