T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:346
- Finding
- Conversation-Derived Content Can Poison Persistent Agent Context<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:346-360` **Additional Locations**: `SKILL.md:15-26`, `SKILL.md:262-289`, `SKILL.md:448`; `references/openclaw-integration.md:128-142` **Vulnerability Type**: Persistent agent memory poisoning **Risk Level**: High ### Vulnerable Code or Instructions ```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 Write promoted rules as short prevention rules (what to do before/while coding), not long incident write-ups. ``` The broader workflow explicitly captures user-supplied corrections and promotes them into persistent context: ```markdown | User corrects you | Log to `.learnings/LEARNINGS.md` with category `correction` | | 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) | ``` ### Technical Analysis The Skill instructs agents to derive persistent knowledge from conversations, errors, and user corrections. It then directs agents to promote recurring entries into files such as `CLAUDE.md`, `AGENTS.md`, `SOUL.md`, and `TOOLS.md`. OpenClaw automatically injects these files into later sessions. The recurrence checks establish frequency but not trustworthiness. There is no required human approval, provenance validation, separation between descriptive knowledge and imperative instructions, or screening for security-sensitive content. Consequently, repeated attacker-controlled statements can be convert ...[truncated 1593 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit human approval before modifying any automatically loaded context file. 2. Keep conversation-derived observations in a non-executable knowledge store rather than directly promoting them into instruction files. 3. Preserve provenance for every entry, including session, author, source type, timestamp, and supporting evidence. 4. Treat user corrections and external content as untrusted, regardless of recurrence count. 5. Reject or quarantine entries containing imperative commands, requests to weaken safeguards, credential-handling rules, external URLs, or instructions to transmit data. 6. Use a structured schema that separates verified facts from behavioral instructions. 7. Restrict write permissions on `AGENTS.md`, `SOUL.md`, `TOOLS.md`, `CLAUDE.md`, and Copilot instruction files. 8. Add review, rollback, and audit-log mechanisms for all promotions. 9. Replace “promote aggressively” with a conservative policy requiring independent verification and a documented security review. ]]>
