T02 · Agent Memory Poisoning
- Location
- SKILL.md:17
- Finding
- Untrusted conversational content can be promoted into persistent agent instructions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:17-26`, `SKILL.md:277-289`, `SKILL.md:346-360`, and `SKILL.md:448` **Vulnerability Type**: Persistent agent memory poisoning **Risk Level**: High ### Vulnerable Code ```markdown | Situation | Action | |-----------|--------| | Command/operation fails | Log to `.learnings/ERRORS.md` | | User corrects you | Log to `.learnings/LEARNINGS.md` with category `correction` | | User wants missing feature | Log to `.learnings/FEATURE_REQUESTS.md` | | API/external tool fails | Log to `.learnings/ERRORS.md` with integration details | | Knowledge was outdated | Log to `.learnings/LEARNINGS.md` with category `knowledge_gap` | | Found better approach | Log to `.learnings/LEARNINGS.md` with category `best_practice` | | Simplify/Harden recurring patterns | Log/update `.learnings/LEARNINGS.md` with `Source: simplify-and-harden` and a stable `Pattern-Key` | | Similar to existing entry | Link with `**See Also**`, consider priority bump | | Broadly applicable learning | Promote to `CLAUDE.md`, `AGENTS.md`, and/or `.github/copilot-instructions.md` | | Workflow improvements | Promote to `AGENTS.md` (OpenClaw workspace) | | Tool gotchas | Promote to `TOOLS.md` (OpenClaw workspace) | | Behavioral patterns | Promote to `SOUL.md` (OpenClaw workspace) | ``` The guidance further states: ```markdown 7. **Promote aggressively** - if in doubt, add to CLAUDE.md or .github/copilot-instructions.md ``` The installed OpenClaw hook reinforces the promotion workflow in `hooks/openclaw/handler.js:13-25`: ```javascript **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. ...[truncated 2305 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit human approval before modifying any persistent agent instruction file. 2. Treat all conversational and learning-log content as untrusted data, not executable agent guidance. 3. Remove the “promote aggressively” recommendation and replace it with a deny-by-default review process. 4. Add provenance metadata recording the originating user, session, timestamp, and exact source text. 5. Reject promotion candidates containing imperative instructions, safety-policy changes, secret-handling directives, external URLs, shell commands, or requests to bypass review. 6. Keep learning records in a data-only store that is not automatically loaded as trusted prompt context. 7. Generate a proposed diff for promotion rather than editing instruction files directly. 8. Require at least one trusted maintainer to approve the proposed diff. 9. Add integrity monitoring for `SOUL.md`, `AGENTS.md`, `TOOLS.md`, `CLAUDE.md`, and Copilot instruction files. ]]>
