T01 · Skill Instruction Hijacking
Error
- Location
- run-task.py:513
- Finding
- Receiving-Agent Instruction Hijacking Through Completion Notifications<![CDATA[ ## Vulnerability Details **File Location**: `run-task.py:513-524` **Vulnerability Type**: Agent-session instruction injection and response redirection **Risk Level**: Critical ### Vulnerable Code ```python agent_msg = ( f"[CLAUDE_CODE_RESULT]\n{message}\n\n" f"---\n" f"⚠️ INSTRUCTION: You received a Claude Code result. " f"Process it, then send your response to the WhatsApp group using " f"message(action=send, channel=whatsapp, target={target or 'GROUP_JID'}, message=YOUR_SUMMARY). " f"Then reply NO_REPLY to avoid duplicate. Do NOT rely on announce step." ) try: resp = requests.post( f"{GW_URL}/tools/invoke", headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"}, json={"tool": "sessions_send", ``` Related continuation instructions are also constructed and delivered through `openclaw agent --deliver` at `run-task.py:559-619`. In iterative mode, those instructions direct the receiving agent to evaluate whether another autonomous run should be launched. ### Technical Analysis The implementation does not deliver Claude Code output as inert, structured result data. It combines task output with imperative instructions and inserts the resulting message into another active agent session. The injected instructions control several aspects of the receiving agent's behavior: - They require the agent to process and summarize the supplied result. - They redirect the response to a specified WhatsApp group. - They require a `NO_REPLY` response to suppress ordinary session output. - Related iterative-mode instructions can direct the agent to initiate another Claude Code execution. This crosses the boundary between result notification and control of the receiving agent's goals and tools. Since `message` includes Claude-generated task output, untrusted or prompt-injected content is placed adjacent to trusted-looking orchestration instructions in the receiving session. ### Attack Path ...[truncated 1199 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Deliver completion results through a structured event schema rather than natural-language instructions. For example, use fields such as `event_type`, `status`, `result_path`, and `preview`. 2. Do not append behavioral commands such as “send,” “reply,” “continue,” or “launch another iteration” to task results. 3. Keep untrusted Claude output in a clearly typed data field and never concatenate it into an instruction channel. 4. Let trusted host-agent policy determine whether and where a response should be delivered. 5. Require explicit user approval before launching any follow-up iteration. 6. Bind delivery to the original validated session and recipient rather than instructing an agent to invoke a messaging tool with a textual target. 7. Apply strict size and content limits to completion previews inserted into agent sessions. ]]>
