autonomous-agent-patterns
Warn
Audited by Gen Agent Trust Hub on Oct 31, 2026
Risk Level: MEDIUMDYNAMIC_EXECUTIONCOMMAND_EXECUTIONINDIRECT_PROMPT_INJECTIONDATA_EXFILTRATION
Full Analysis
- [DYNAMIC_EXECUTION]: The
MCPAgentclass features acreate_toolmethod that generates Python code via an LLM based on user descriptions, writes the output to a local file (server.py), and then dynamically connects to it as a new service. This pattern of generating and executing code at runtime is a high-risk behavior that can lead to arbitrary code execution if the LLM output is not strictly validated or sandboxed. - [COMMAND_EXECUTION]: The
SandboxedExecutionimplementation usessubprocess.runwithshell=Trueto execute shell commands. While it attempts to implement an allowlist and basic path validation, the use ofshell=Trueis a security risk that can facilitate command injection and bypasses of intended restrictions. - [INDIRECT_PROMPT_INJECTION]: The
ContextManagerclass includes anadd_urlmethod that fetches content from external URLs and injects it directly into the agent's prompt context. - Ingestion points:
ContextManager.add_urlinSKILL.mdfetches content from arbitrary remote URLs. - Boundary markers: The
format_for_promptmethod lacks robust delimiters or instructions to ignore embedded commands within the fetched content. - Capability inventory: The skill includes tools for file writing (
EditFileTool), command execution (SandboxedExecution), and dynamic tool creation (MCPAgent). - Sanitization: No security-focused sanitization is performed on the fetched content; only basic markdown conversion is applied.
- [DATA_EXPOSURE]: The
ReadFileToolandContextManagerclasses allow the agent to read file contents from the local filesystem. The implementation ofReadFileToollacks path validation (such as ensuring paths remain within a workspace directory), which could allow an agent to read sensitive files via path traversal attacks.
Audit Metadata