T09 · Insecure Skill Coding Practices
- Location
SKILL.md:114- Finding
Candidate Python Code Is Executed Without Required Isolation
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 114–127
Vulnerability Type: Unrestricted execution of candidate code
Risk Level: Highbash python evaluator.py <path_to_init.py>The surrounding instructions require the evaluator to execute
init.pyand repeat execution after modifications until validation succeeds. However, they do not require sandboxing, network isolation, privilege reduction, filesystem restrictions, or resource controls.Technical Analysis
The Skill directs the agent to generate or accept a candidate Python script and execute it through
evaluator.py. The evaluator interface accepts a candidate path, and the documented system constraints only address the subprocess working directory. They do not establish a security boundary for candidate execution.Python code executed this way inherits the evaluator process's operating-system identity, environment variables, accessible filesystem resources, and network access. A malicious candidate can therefore perform actions unrelated to the intended optimization task, including reading sensitive files, modifying project content, launching additional processes, or communicating with external systems.
A timeout parameter alone does not mitigate these risks. It may limit execution duration, but it does not prevent data access, network communication, process creation, or destructive filesystem operations before the timeout expires.
Attack Path
- An attacker supplies task requirements, existing project content, or a candidate path that influences the generated or selected
init.py. - The resulting candidate contains malicious Python code disguised as a valid task solution.
- The agent follows the validation instructions and invokes
evaluator.pywith the candidate path. - The evaluator launches the candidate without a required sandbox or reduced privileges.
- The candidate inherits the evaluator's ambient permissions and accesses available files, cr ...[truncated 1004 chars]
- An attacker supplies task requirements, existing project content, or a candidate path that influences the generated or selected
- Remediation
View remediation
Remediation Suggestions
- Execute every candidate in a disposable sandbox or container rather than directly on the host.
- Run the sandbox under a dedicated unprivileged user with no access to host credentials or unrelated files.
- Disable network access by default. Permit only explicitly documented destinations when network access is essential.
- Mount the candidate and required input data as read-only. Provide a separate size-limited output directory.
- Pass a minimal, allowlisted environment and remove tokens, proxy credentials, cloud metadata access, and other secrets.
- Apply strict CPU, memory, storage, execution-time, open-file, and process-count limits.
- Prevent access to host sockets, device files, container runtimes, SSH agents, and privileged APIs.
- Resolve and validate the candidate path before execution, rejecting paths outside the approved workspace and disallowing symlink escapes.
- Require explicit human review before executing externally supplied or substantially modified candidates.
- Treat evaluator output as untrusted and limit output size to prevent terminal injection and resource exhaustion.
- Document sandbox failure as a validation failure; the evaluator must not fall back to unsandboxed execution.
