T01 · Skill Instruction Hijacking
- Location
hooks/bootstrap.js:11- Finding
Persistent Bootstrap Hook Injects Skill Instructions into Every Agent Session
- Content
View full analysis
{ if (!event || typeof event !== 'object') return; if (event.type !== 'agent' || event.action !== 'bootstrap') return; if (!event.context || typeof event.context !== 'object') return; let skillContent = ''; try { skillContent = fs.readFileSync(SKILL_PATH, 'utf-8'); } catch (e) { return; } if (Array.isArray(event.context.bootstrapFiles)) { event.context.bootstrapFiles.push({ path: 'SELF_EVOLUTION_SKILL.md', content: skillContent, virtual: true, }); } }; ``` The documented installation procedure makes the hook persistent: ```bash mkdir -p ~/.openclaw/hooks/self-evolution cp ~/.openclaw/workspace/self-evolution/hooks/bootstrap.js ~/.openclaw/hooks/self-evolution/handler.js cat > ~/.openclaw/hooks/self-evolution/HOOK.md << 'EOF' --- name: self-evolution description: "Injects self-evolution skill during agent bootstrap" metadata: {"openclaw":{"emoji":"🧬","events":["agent:bootstrap"]}} --- # Self-Evolution Bootstrap Hook Injects SKILL.md on every agent bootstrap for continuous self-improvement. EOF openclaw hooks enable self-evolution ``` ### Technical Analysis The installation procedure copies the JavaScript handler into OpenClaw's global hook directory and enables it for the `agent:bootstrap` event. Once enabled, the handler reads `SKILL.md` from the user's workspace and appends its contents to `event.context.bootstrapFiles` as a virtual bootstrap file. This mechanism causes the Skill's instructions to be inserted into every subsequent agent session, including sessions unrelated to th ...[truncated 1740 chars]- Remediation
View remediation
