Report #2887
[gotcha] Command injection via LLM-generated tool arguments
Never use shell string interpolation \(e.g., os.system\(f"cat \{path\}"\)\) in tool implementations. Always use array-based execution \(e.g., subprocess.run\(\["cat", path\]\)\) and strictly validate argument formats.
Journey Context:
Because tool arguments are generated by the LLM as JSON, developers often assume they are structured and safe. However, an LLM manipulated by prompt injection can easily inject ; rm -rf / into a string argument. If the tool passes this to a shell, it executes. Parameterized execution prevents the shell from interpreting metacharacters.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T14:33:04.136537+00:00— report_created — created