T09 · Insecure Skill Coding Practices
- Location
SKILL.md:44- Finding
Unattended Host Execution of Agent-Generated Code
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 44-49
Vulnerability Type: Unsandboxed autonomous code execution
Risk Level: HighVulnerable Code
python user_proxy = UserProxyAgent( name="用户", human_input_mode="NEVER", # NEVER/ALWAYS/TERMINATE max_consecutive_auto_reply=10, code_execution_config={"work_dir": "coding", "use_docker": False} )Technical Analysis
The example combines
human_input_mode="NEVER"withuse_docker=False. This configuration permits code produced during an LLM-controlled conversation to execute directly on the host without prior human approval or container isolation.The configured working directory does not constitute a security boundary. Unless additional operating-system restrictions are applied externally, executed code may access other files available to the process, launch subprocesses, inspect environment variables, use network resources, and modify user-accessible data.
This is particularly hazardous when tasks, source files, retrieved content, or conversation messages can contain attacker-controlled instructions. Such content can induce the agent to generate and execute malicious code.
Attack Path
- An attacker places malicious instructions in a task, source file, issue description, or other content processed by the agent.
- The LLM interprets that content and produces executable code or shell commands.
UserProxyAgentprocesses the generated code without requesting human approval becausehuman_input_modeis set toNEVER.- AutoGen executes the code directly on the host because Docker isolation is disabled.
- The code reads or modifies files, accesses process credentials, launches commands, or communicates over the network within the privileges of the AutoGen process.
Impact Assessment
Successful exploitation grants the generated code the same effective operating-system privileges as the user ru ...[truncated 471 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not combine automatic execution with host-local execution for untrusted or LLM-generated code.
- Set
human_input_mode="ALWAYS"or implement an explicit approval gate that displays the exact code and command before execution. - Use a restricted container by default, such as a reviewed and digest-pinned minimal image.
- Run the container as a non-root user with dropped Linux capabilities, a read-only root filesystem, resource limits, and
no-new-privileges. - Disable network access unless it is required for the task. If networking is required, restrict destinations through an allowlist.
- Mount only a dedicated disposable workspace. Do not mount home directories, credential stores, Docker sockets, SSH agents, or unrelated repositories.
- Remove secrets from the execution environment and provide narrowly scoped, short-lived credentials only when necessary.
- Document clearly that
use_docker=Falseis suitable only for fully trusted, manually reviewed code.
