T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:262
- Finding
- Untrusted conversational content can be promoted into persistent agent instruction files<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:23-26`, `SKILL.md:262-289`, `SKILL.md:348-360`; `hooks/openclaw/handler.js:9-25`; `hooks/openclaw/handler.ts:10-26` **Vulnerability Type**: Persistent agent memory poisoning **Risk Level**: High ### Vulnerable Code `SKILL.md:23-26`: ```markdown | 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) | ``` `SKILL.md:262-289`: ```markdown ## Promoting to Project Memory When a learning is broadly applicable (not a one-off fix), promote it to permanent project memory. ### When to Promote - Learning applies across multiple files/features - Knowledge any contributor (human or AI) should know - Prevents recurring mistakes - Documents project-specific conventions ### Promotion Targets | Target | What Belongs There | |--------|-------------------| | `CLAUDE.md` | Project facts, conventions, gotchas for all Claude interactions | | `AGENTS.md` | Agent-specific workflows, tool usage patterns, automation rules | | `.github/copilot-instructions.md` | Project context and conventions for GitHub Copilot | | `SOUL.md` | Behavioral guidelines, communication style, principles (OpenClaw workspace) | | `TOOLS.md` | Tool capabilities, usage patterns, integration gotchas (OpenClaw workspace) | ### How to Promote 1. **Distill** the learning into a concise rule or fact 2. **Add** to appropriate section in target file (create file if needed) 3. **Update** original entry: - Change `**Status**: pending` → `**Status**: promoted` - Add `**Promoted**: CLAUDE.md`, `AGENTS.md`, or `.github/copilot-instructions.md` ``` `hooks/openclaw/handler.js:9-25`: ```javascript const REMINDER_CONTENT = ` ## Self-Improvement Reminder After completing tasks, evaluate if any ...[truncated 3101 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit human approval before promoting any generated learning into an auto-loaded agent instruction file. 2. Keep unreviewed learnings in a separate data store that is never interpreted as agent instructions. 3. Record provenance for every entry, including the originating user, session, timestamp, and supporting evidence. 4. Permit promotion only through a structured schema with narrowly defined factual fields. 5. Reject content containing role directives, tool-execution instructions, credential requests, safety overrides, or instructions to ignore higher-priority policy. 6. Render quoted user content as inert data and never copy it verbatim into prompt-bearing files. 7. Add a review diff showing the exact proposed change, destination file, and source learning. 8. Require multiple independently verified occurrences rather than allowing repetition within one attacker-controlled conversation to satisfy recurrence criteria. 9. Restrict write permissions so routine sessions cannot directly modify global `SOUL.md`, `TOOLS.md`, `AGENTS.md`, or equivalent files. 10. Add rollback support and an audit log for every promotion. ]]>
