T02 · Agent Memory Poisoning
Warning
- Location
- SKILL.md:346
- Finding
- Conversation-Derived Content Can Be Promoted into Persistent Agent Instructions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:23-26`, `SKILL.md:346-365`, and `SKILL.md:443-444` **Vulnerability Type**: Persistent agent memory poisoning **Risk Level**: Medium ### Vulnerable Code Snippet ```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) | ``` ```markdown 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 Write promoted rules as short prevention rules (what to do before/while coding), not long incident write-ups. ``` ```markdown 7. **Promote aggressively** - if in doubt, add to CLAUDE.md or .github/copilot-instructions.md ``` ### Technical Analysis The Skill instructs the agent to capture corrections, user feedback, errors, and conversation-derived knowledge in local learning files. It subsequently recommends promoting selected entries into files such as `CLAUDE.md`, `AGENTS.md`, `SOUL.md`, and `.github/copilot-instructions.md`. These destination files may be loaded as persistent instructions in future sessions. The stated promotion conditions measure recurrence and breadth, but do not establish that the source is trusted or verify that the promoted content is free from embedded agent directives. Repetition is not a trust signal: an attacker can deliberately repeat the same false correction or behavioral instruction until it meets the recurrence threshold. The instruction to “promote aggressively” further weakens the review boundary by encouraging promotion ...[truncated 1677 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit approval from a trusted human before writing anything to persistent instruction files. 2. Treat conversation text and learning entries as untrusted data, even when repeated. 3. Never copy raw learning text directly into `CLAUDE.md`, `AGENTS.md`, `SOUL.md`, `TOOLS.md`, or Copilot instruction files. 4. Validate promotions against a strict schema containing only factual, narrowly scoped fields. 5. Reject content containing meta-instructions, role changes, safety overrides, secret-access requests, tool-use directives unrelated to the project, or instructions to suppress reporting. 6. Preserve provenance for every promoted rule, including source session, author, approval identity, and review date. 7. Replace “promote aggressively” with a conservative rule requiring clear evidence, necessity, and trusted review. 8. Implement expiration and rollback mechanisms for promoted rules. 9. Separate factual project memory from executable agent instructions so recorded observations do not automatically become behavioral directives. ]]>
