T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:262
- Finding
- Untrusted Learnings Can Be Promoted into Persistent Agent Instructions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 262-289 **Vulnerability Type**: Persistent agent memory poisoning **Risk Level**: High ### Vulnerable Code ```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` ``` The recurring-pattern workflow also explicitly instructs the agent to promote content into agent context: ```markdown ### Promotion Rule (System Prompt Feedback) Promote recurring patterns into agent context/system prompt files when all are true: - `Recurrence-Count >= 3` - Seen across at least 2 distinct tasks - Occurred within a 30-day window Promotion targets: - `CLAUDE.md` - `AGENTS.md` - `.github/copilot-instructions.md` - `SOUL.md` / `TOOLS.md` for OpenClaw workspace-level guidance when applicable ``` ### Technical Analysis The skill captures information originating from conversations, user correcti ...[truncated 2506 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit approval from a trusted workspace owner before writing any learning into persistent instruction files. 2. Treat conversation-derived learnings as untrusted data, regardless of recurrence count. 3. Keep raw learnings in a data-only store that is not automatically injected as agent instructions. 4. Apply a strict promotion schema that permits concise factual statements but rejects: - Instructions to ignore or weaken security controls - Tool-execution mandates - Credential or secret material - External URLs unless separately approved - Shell commands or executable code - Instructions that change authority, trust, or approval boundaries 5. Record immutable provenance for each promoted rule, including source session, author, reviewer, approval time, and original learning ID. 6. Present a diff of the target instruction file and require confirmation immediately before writing it. 7. Add rollback and review mechanisms for all promoted entries. 8. Replace recurrence-based automatic promotion with recurrence-based nomination; promotion should remain a reviewed manual action. ]]>
