T02 · Agent Memory Poisoning
- Location
- hooks/openclaw/handler.js:10
- Finding
- Persistent agent instruction poisoning through learning promotion<![CDATA[ ## Vulnerability Details **File Location**: `hooks/openclaw/handler.js:10-25` **Additional Locations**: `SKILL.md:38-47`, `SKILL.md:132-147`, `SKILL.md:157-159`, `references/openclaw-integration.md:128-143` **Vulnerability Type**: Persistent agent memory and instruction poisoning **Risk Level**: High ### Vulnerable Code ```javascript 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. `.trim(); ``` The corresponding promotion workflow is documented as: ```text Is the learning project-specific? ├── Yes → Keep in .learnings/ └── No → Is it behavioral/style-related? ├── Yes → Promote to SOUL.md └── No → Is it tool-related? ├── Yes → Promote to TOOLS.md └── No → Promote to AGENTS.md (workflow) ``` ### Technical Analysis The Skill treats user corrections, operation failures, and session discoveries as sources of learning. It then directs the agent to promote selected observations into `SOUL.md`, `AGENTS.md`, and `TOOLS.md`. These files are persistent instruction-bearing workspace files: - `SOUL.md` controls behavioral expectations and communication style. - `AGENTS.md` controls workflows and agent coordination. - `TOOLS.md` controls how tools are interpreted and used. The promotion process has no mandatory human approval, provenance verification, trust classification, sanitization, conflict detection, restricted sections, or s ...[truncated 1612 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Prohibit automatic promotion into `SOUL.md`, `AGENTS.md`, and `TOOLS.md`. 2. Require explicit, informed human approval for every proposed persistent rule. 3. Store proposals in a non-executable review queue rather than an automatically injected instruction file. 4. Attach provenance to every proposal, including the originating session, user, timestamp, and supporting evidence. 5. Treat user messages, command output, web content, repository content, and other agent messages as untrusted sources. 6. Reject or escalate proposals that affect security controls, permissions, tool authorization, data disclosure, or instruction priority. 7. Allow writes only to a dedicated, delimited section and prevent modification of higher-priority policy content. 8. Add conflict detection, expiration dates, version history, and one-step rollback. 9. Require multiple independent verified observations before proposing a recurring pattern. 10. Clearly distinguish factual notes from instructions that direct future behavior. ]]>
