T09 · Insecure Skill Coding Practices
- Location
runner/run_task.sh:232- Finding
Unrestricted Remote Shell Command Execution Through the Exec Task
- Content
View full analysis
str: """Run a task on the worker Mac with exclusivity locking.""" with self.lock: cmd = [f"{self.runner_path}/run_task.sh", *shlex.split(task_command)] stdout, stderr, code = self._ssh(cmd) ``` ### Technical Analysis The `exec` task intentionally accepts an arbitrary command string and evaluates it with Bash `eval`. The implementation has no command allowlist, authorization check, confirmation requirement, working-directory restriction, sandbox, or project-level confinement. Although remote command execution is documented as an available feature, it exceeds the privileges required for the Skill's primary queue-management, code-generation, controlled file-writing, and test-running functions. Any caller that can cause the Skill to process an `ollama run exec` request effectively obtains a shell under the SSH worker account. Using `eval` also causes shell syntax in the supplied value to be interpreted, including command substitutions, redirections, pipelines, variable expansion, and command separators. Quoting performed by the Python SSH layer does not make this safe because the runner deliberately re-evaluates the reconstructed string. ### Attack Path 1. An attacker supplies or induces an Agent to pro ...[truncated 1047 chars]- Remediation
View remediation
