T01 · Skill Instruction Hijacking
Warning
- Location
- hooks/openclaw/handler.js:52
- Finding
- Agent Bootstrap Context Instruction Injection<![CDATA[ ## Vulnerability Details **File Location**: `hooks/openclaw/handler.js:52-58` **Additional Location**: `hooks/openclaw/handler.ts:52-58` **Vulnerability Type**: T01: Skill Instruction Hijacking **Risk Level**: Medium ### Complete Code Snippet ```javascript // Inject the reminder as a virtual bootstrap file // Check that bootstrapFiles is an array before pushing if (Array.isArray(event.context.bootstrapFiles)) { event.context.bootstrapFiles.push({ path: 'AI_SELF_EVOLUTION_REMINDER.md', content: REMINDER_CONTENT, virtual: true, }); } ``` The TypeScript implementation contains equivalent logic: ```typescript // Inject the reminder as a virtual bootstrap file // Check that bootstrapFiles is an array before pushing if (Array.isArray(event.context.bootstrapFiles)) { event.context.bootstrapFiles.push({ path: 'AI_SELF_EVOLUTION_REMINDER.md', content: REMINDER_CONTENT, virtual: true, }); } ``` ### Technical Analysis The OpenClaw hook runs during the `agent:bootstrap` lifecycle event and appends a virtual file containing Skill-authored behavioral instructions to `event.context.bootstrapFiles`. This places the instructions into privileged bootstrap context before normal workspace files are injected. The injected content directs the agent to record conversation-derived information and promote selected patterns into persistent agent-control files. Although the hook must be installed and enabled explicitly, the instructions are subsequently injected into every qualifying main-agent bootstrap without per-session approval. The handler excludes session keys containing `:subagent:`, but it does not: - Request consent for each injection. - authenticate or integrity-check the reminder content. - constrain the reminder to non-directive status information. - provide a policy boundary preventing injected text from changing agent behavior. - show users a diff of the instructions entering bootstrap context. ### Attack Path 1. A us ...[truncated 1288 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace bootstrap instruction injection with a user-visible notification outside the privileged agent context. 2. Require explicit per-session consent before adding any virtual bootstrap file. 3. Treat reminder content as untrusted data rather than executable agent instructions. 4. Restrict hook output to factual status information, such as the number of pending entries. 5. Display the exact content and source of every bootstrap addition to the user. 6. Pin and verify the integrity of enabled hook versions. 7. Add a configuration option that disables bootstrap injection by default. 8. If injection remains necessary, enforce a fixed schema and reject imperative instructions, tool requests, or file-modification directives. ]]>
