Report #74358
[gotcha] Constructing shell commands by concatenating LLM-generated tool arguments
Use parameterized execution \(e.g., subprocess.run\(\["git", "commit", "-m", arg\]\)\) instead of string interpolation \(os.system\(f"git commit -m \{arg\}"\)\).
Journey Context:
The LLM generates arguments for a tool. If the tool implementation naively interpolates these into a shell command, a malicious prompt injection can cause the LLM to generate an argument like '"; rm -rf / \#', leading to classic OS command injection. The LLM is an untrusted input source.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:24:38.478759+00:00— report_created — created