T01 · Skill Instruction Hijacking
Error
- Location
- hooks/openclaw/handler.ts:10
- Finding
- Persistent Bootstrap and Prompt-Submission Instruction Injection<![CDATA[ ## Vulnerability Details **File Location**: `hooks/openclaw/handler.ts:10-25, 28-59`; `hooks/openclaw/handler.js:9-53`; `scripts/activator.sh:9-19`; `SKILL.md:467-513` **Vulnerability Type**: T01: Skill Instruction Hijacking **Risk Level**: High ### Vulnerable Code ```typescript const REMINDER_CONTENT = `## Self-Improvement Reminder After completing tasks, evaluate if any learnings should be captured: **Log when:** - User corrects you → \`.learnings/LEARNINGS.md\` - Command/operation fails → \`.learnings/ERRORS.md\` - User wants missing capability → \`.learnings/FEATURE_REQUESTS.md\` - You discover your knowledge was wrong → \`.learnings/LEARNINGS.md\` - You find a better approach → \`.learnings/LEARNINGS.md\` **Promote when pattern is proven:** - Behavioral patterns → \`SOUL.md\` - Workflow improvements → \`AGENTS.md\` - Tool gotchas → \`TOOLS.md\` Keep entries simple: date, title, what happened, what to do differently.`; const handler: HookHandler = async (event) => { if (!event || typeof event !== 'object') { return; } if (event.type !== 'agent' || event.action !== 'bootstrap') { return; } if (!event.context || typeof event.context !== 'object') { return; } const sessionKey = event.sessionKey || ''; if (sessionKey.includes(':subagent:')) { return; } if (Array.isArray(event.context.bootstrapFiles)) { event.context.bootstrapFiles.push({ path: 'SELF_IMPROVEMENT_REMINDER.md', content: REMINDER_CONTENT, virtual: true, }); } }; ``` The prompt-submission hook additionally emits: ```bash cat << 'EOF' <self-improvement-reminder> After completing this task, evaluate if extractable knowledge emerged: - Non-obvious solution discovered through investigation? - Workaround for unexpected behavior? - Project-specific pattern learned? - Error required debugging to resolve? If yes: Log to .learnings/ using the self-improvement skill format. If high-value (recurring, broadly applicable): Con ...[truncated 1741 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Replace bootstrap/system-context injection with a user-invoked command or a clearly separated, user-visible notification. - Require explicit confirmation before every write to `.learnings/` or any Agent instruction file. - Scope reminders to tasks where the user explicitly requests learning capture. - Do not frame optional reminders as bootstrap files or system-like context. - Add configuration controls for event scope, target directories, and whether any filesystem modification is permitted. - Ensure hooks default to disabled and clearly display their exact injected content before activation. ]]>
