T02 · Agent Memory Poisoning
- Location
- SKILL.md:339
- Finding
- Persistent Agent-State Poisoning Through Unvalidated Learning Promotion<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:339-360` **Additional Locations**: `SKILL.md:23-26`, `SKILL.md:440-447` **Vulnerability Type**: Persistent agent memory and instruction poisoning **Risk Level**: High ### Vulnerable Code ```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. ``` Related promotion guidance includes: ```markdown | Behavioral patterns | Promote to `SOUL.md` | | Workflow improvements | Promote to `AGENTS.md` | | Tool gotchas | Promote to `TOOLS.md` | ``` ```markdown 7. **Promote aggressively** - if in doubt, add to CLAUDE.md or .github/copilot-instructions.md ``` ### Technical Analysis The skill encourages observations derived from conversations, user corrections, errors, and task outcomes to be promoted into files that are loaded as persistent agent context. These targets include `CLAUDE.md`, `AGENTS.md`, `SOUL.md`, `TOOLS.md`, and `.github/copilot-instructions.md`. The recurrence threshold only measures repetition and timing. It does not establish that the source is trusted or that the promoted rule is safe. There is no mandatory human approval, provenance verification, security review, or restriction against promoting rules that alter tool usage, network behavior, authentication practices, permissions, or safety controls. Consequently, attacker-controlled conversational content can be transformed from transient input into durable instructions that affect future sessions. The instruction to “promote aggressively” further weakens the threshold for modifyi ...[truncated 1439 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit, informed user approval before writing to any persistent agent-context file. 2. Treat conversation-derived corrections and recommendations as untrusted input, regardless of recurrence count. 3. Add a mandatory review stage that displays the exact proposed rule, source entries, destination file, and security implications. 4. Prohibit automatic promotion of rules involving: - Credentials or authentication - Network access - Command execution - File permissions - Safety-control changes - External downloads - System or agent configuration 5. Store general learnings in a dedicated non-executable knowledge file rather than files interpreted as agent instructions. 6. Preserve immutable provenance, including the originating session, user, task, and learning identifiers. 7. Remove the “promote aggressively” recommendation and replace it with a least-persistence policy. 8. Support rollback and audit logging for every change to persistent context files. 9. Apply allowlisted schemas to promoted content instead of accepting unrestricted natural-language instructions. ]]>
