Report #91380
[gotcha] LLM constructs shell commands from unvalidated tool arguments leading to command injection
Never use string concatenation to build shell commands in MCP tool implementations. Use array-based argument passing \(e.g., execvp style\) or strict input validation schemas.
Journey Context:
A tool might be defined to execute a script like git clone . The LLM fills in based on user input. If the user says clone repo https://evil.com; rm -rf /, the LLM passes the whole string. Developers often trust the LLM to sanitize input or rely on JSON schema validation, but schemas only validate types, not semantic safety. Using array-based execution bypasses shell interpretation entirely, which is the only robust defense.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T11:58:30.856218+00:00— report_created — created