T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:363
- Finding
- Persistent Poisoning of Agent Instruction and Memory Files<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:363-377`; `hooks/openclaw/handler.ts:18-24`; `hooks/openclaw/handler.js:17-23` **Vulnerability Type**: Persistent agent memory poisoning through promotion of user-influenced learnings **Risk Level**: High ### Vulnerable Code `SKILL.md:363-377`: ```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. ``` `hooks/openclaw/handler.ts:18-24`: ```typescript **Promote when pattern is proven:** - Behavioral patterns → \`SOUL.md\` - Workflow improvements → \`AGENTS.md\` - Tool gotchas → \`TOOLS.md\` Keep entries simple: date, title, what happened, what to do differently.`; ``` The JavaScript runtime implementation contains the equivalent instructions at `hooks/openclaw/handler.js:17-23`. ### Technical Analysis The skill captures corrections, discoveries, and other information originating in conversations, then recommends promoting recurring entries into files such as `SOUL.md`, `AGENTS.md`, `TOOLS.md`, `CLAUDE.md`, and `.github/copilot-instructions.md`. These files are persistent agent-context or instruction files that can be loaded into future sessions. The promotion criteria measure recurrence and timing, but do not validate whether the source is trusted or whether the promoted rule changes safety constraints, permissions, tool behavior, or instruction precedence. Consequently, repetition can be mistaken for trustworthiness. The general guidance in `SKILL.md:467` to “Promote aggressively” further increases the likelihood that insufficiently rev ...[truncated 1580 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit human approval before writing any learning into an agent instruction, memory, or skill file. 2. Preserve provenance for every promoted rule, including the originating user, session, task, timestamp, and exact source text. 3. Treat recurrence only as a prioritization signal, never as evidence that content is trustworthy. 4. Reject promotion of rules that modify: - Safety or authorization boundaries - Instruction precedence - Secret-handling requirements - Tool permissions or confirmation requirements - Network, filesystem, or command-execution policy 5. Restrict automated promotion to verifiable project facts and non-behavioral documentation. 6. Present proposed changes as a diff and require approval from an authorized maintainer. 7. Add integrity monitoring for `AGENTS.md`, `SOUL.md`, `TOOLS.md`, `CLAUDE.md`, and related instruction files. 8. Separate untrusted observations from trusted instructions so learning logs are never automatically interpreted as executable policy. 9. Add tests proving that repeated user requests cannot automatically produce persistent behavioral instructions. ]]>
