T01 · Skill Instruction Hijacking
Error
- Location
- references/orchestrator-cron.md:66
- Finding
- Autonomous worker command and instruction injection through untrusted project task content<![CDATA[ ## Vulnerability Details **File Location**: `references/orchestrator-cron.md:66-83`; related worker template at `references/worker-prompt-template.md:7-10` **Vulnerability Type**: Command injection and agent instruction hijacking **Risk Level**: High ### Vulnerable Code ```text Step 4 — Find next task: Read [PROJECT_PATH]/TODO.md Find the first line matching "- [ ]" that does NOT contain "BLOCKED:". If no unchecked non-blocked tasks remain: report "all tasks complete — consider disabling this cron", exit. Step 5 — Spawn worker: Run: cd [PROJECT_PATH] && nohup [AGENT_COMMAND] '[TASK_PROMPT]' > /tmp/lrt-[PROJECT_SLUG]-worker.log 2>&1 & echo $! > $PID_FILE sleep 2 && kill -0 $(cat $PID_FILE) 2>/dev/null && echo "worker verified" || echo "WARNING: worker failed to start" The task prompt must include: - "Read [CONTEXT_FILE] and TODO.md for project context." - The specific task description copied from TODO.md. - "Run tests before committing. Fix failures before proceeding." - "Check off the completed item in TODO.md." - "Commit and push using the project's commit convention." - "Run: openclaw system event --text 'Done: [BRIEF_SUMMARY]' --mode now" ``` Related template: ```text You are working on [PROJECT_NAME]. Read [CONTEXT_FILE] and TODO.md for full context. YOUR TASK: [Paste the specific task description from TODO.md] ``` ### Technical Analysis The orchestrator reads task content from repository-controlled `TODO.md` and copies it into `[TASK_PROMPT]`. That prompt is then interpolated into a shell command inside single quotes: ```sh nohup [AGENT_COMMAND] '[TASK_PROMPT]' ``` No escaping, argument-array construction, content validation, or trust-boundary enforcement is specified. If task or context content contains a single quote followed by shell syntax, it can terminate the quoted argument and inject additional shell commands. The injected commands execute with the operating-system permissions and credentials of ...[truncated 2499 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. **Do not interpolate prompts into shell source.** - Invoke the agent through an API that accepts an argument array without shell parsing. - Alternatively, store the prompt in a securely created file and pass it through standard input. - Avoid `sh -c`, `eval`, and string-built commands. 2. **Treat project files as untrusted data.** - Clearly delimit copied task content from trusted worker policy. - State that instructions found inside repository files cannot override the fixed orchestration policy. - Reject tasks containing control characters or content outside an explicitly supported format. 3. **Parse structured task data.** - Use a machine-readable task format with separate title, description, allowed paths, and acceptance criteria. - Enforce maximum lengths and strict schemas rather than copying arbitrary Markdown into a prompt. 4. **Constrain worker capabilities.** - Run workers in a filesystem and network sandbox. - Limit writable paths to the intended repository. - Use narrowly scoped deployment credentials. - Prevent access to personal tokens, SSH agents, home-directory secrets, and unrelated repositories. 5. **Require review before publication.** - Disable automatic `git push` by default. - Require human approval or a trusted validation stage before pushing autonomous changes. - Protect sensitive branches with mandatory review and CI checks. 6. **Add provenance controls.** - Only process task files from trusted branches and verified commits. - Do not run autonomous tasks from unreviewed pull requests or attacker-controlled working trees. ]]>
