T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:23
- Finding
- Untrusted Learnings Can Poison Persistent Agent Instructions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:23-26`, `SKILL.md:269-289`, `SKILL.md:338-360`, and `SKILL.md:442-448` **Vulnerability Type**: Persistent agent memory poisoning through promotion of conversation-derived content **Risk Level**: High ### Vulnerable Code and Instructions From `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) | ``` From `SKILL.md:269-289`: ```markdown - 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` ``` From `SKILL.md:442-448`: ```markdown 1. **Log immediately** - context is freshest right after the issue 2. **Be specific** - future agents need to understand quickly 3. **Include reproduction steps** - especially for errors 4. **Link related files** - makes fixes eas ...[truncated 2940 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Disable automatic or agent-initiated promotion by default and require explicit human approval for every persistent instruction change. 2. Treat all conversation-, tool-, and error-derived content as untrusted data. 3. Add mandatory provenance fields, including the originating session, author, evidence, validation status, reviewer, and review timestamp. 4. Prohibit direct copying of learning text into persistent instruction files. Require a separately reviewed, narrowly scoped rule. 5. Reject promotion candidates containing: - Requests to ignore or override existing instructions. - Commands that access credentials or sensitive files. - External data-transmission instructions. - Encoded or obfuscated content. - Instructions that disable security checks or approval gates. 6. Use allowlisted sections and structured schemas for persistent files instead of unrestricted Markdown insertion. 7. Replace “Promote aggressively” with a conservative rule such as: “Do not promote unless independently verified and explicitly approved.” 8. Keep project facts separate from behavioral or safety instructions, and prevent ordinary learnings from modifying safety-relevant sections. 9. Require code review for changes to `AGENTS.md`, `SOUL.md`, `TOOLS.md`, `CLAUDE.md`, and `.github/copilot-instructions.md`. 10. Record and review diffs before loading newly modified persistent context in subsequent sessions. ]]>
