T02 · Agent Memory Poisoning
- Location
- SKILL.md:348
- Finding
- Untrusted Learnings Can Be Promoted into Persistent Agent Instructions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:16-26`, `SKILL.md:348-362`, `SKILL.md:443-448` **Vulnerability Type**: Persistent agent-memory poisoning **Risk Level**: Medium ### Vulnerable Code Snippet ```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` | ... | Behavioral patterns | Promote to `SOUL.md` (OpenClaw workspace) | ``` ```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. ``` ```markdown 7. **Promote aggressively** - if in doubt, add to CLAUDE.md or .github/copilot-instructions.md ``` ### Technical Analysis The Skill treats user corrections and conversation-derived observations as candidates for storage in `.learnings/`. It subsequently permits those records to be promoted into files such as `CLAUDE.md`, `AGENTS.md`, `SOUL.md`, `TOOLS.md`, and `.github/copilot-instructions.md`. These destination files are persistent agent-context or instruction files. Their contents can influence behavior in future sessions, potentially with greater authority than the original user message. The promotion criteria consider recurrence and general applicability, but they do not require: - Explicit human approval - Trusted provenance - Security review - Removal of embedded instructions - Rejection of attempts to alter safety controls - Verification that repeated observations originated from independent trusted sources The recommendatio ...[truncated 1976 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit human approval before writing any learning into persistent agent instruction files. 2. Treat conversation, tool output, external documentation, and existing learning records as untrusted input. 3. Add a mandatory promotion review that verifies: - The source and provenance of the learning - Independent evidence supporting the rule - Whether the content contains commands or instruction-like language - Whether it changes permissions, safety controls, authentication, or data-handling behavior 4. Prohibit promotion of rules that: - Override higher-priority instructions - Disable validation or security checks - Request secrets or private session data - Automatically execute commands - Grant trust based only on repetition 5. Replace “promote aggressively” with a conservative, approval-based policy. 6. Store provenance, approver identity, promotion date, and source learning IDs beside each promoted rule. 7. Provide a diff preview and rollback mechanism before modifying persistent context files. 8. Keep raw user statements separate from distilled, verified project facts. ]]>
