T02 · Agent Memory Poisoning
Warning
- Location
- SKILL.md:366
- Finding
- Conversation-Derived Learnings Can Be Promoted into Persistent Agent Instructions Without Trust Validation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:366-381` **Additional Locations**: `SKILL.md:40-43`, `SKILL.md:282-309`, `SKILL.md:463-468`, `hooks/openclaw/handler.js:30-33`, `hooks/openclaw/handler.ts:31-34` **Vulnerability Type**: Persistent agent-memory poisoning **Risk Level**: Medium ### Vulnerable Code and Instructions `SKILL.md:366-381`: ```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. ``` `SKILL.md:463-468`: ```markdown 1. **Log immediately** - context is freshest right after the issue 2. **Be specific** - future agents need to understand quickly 3. **Include reproduction steps** - especially for errors 4. **Link related files** - makes fixes easier 5. **Suggest concrete fixes** - not just "investigate" 6. **Use consistent categories** - enables filtering 7. **Promote aggressively** - if in doubt, add to CLAUDE.md or .github/copilot-instructions.md ``` `hooks/openclaw/handler.js:30-33`: ```javascript **Promote when pattern is proven:** - Behavioral patterns → \`SOUL.md\` - Workflow improvements → \`AGENTS.md\` - Tool gotchas → \`TOOLS.md\` ``` The TypeScript source contains the equivalent instructions at `hooks/openclaw/handler.ts:31-34`. ### Technical Analysis The Skill accepts conversation-derived information—including user corrections, claimed knowledge gaps, errors, and suggested workflow improvements—as learning input. It then instructs the agent to promote selected learning content into files such as `CLAUDE.md`, `AGENTS.md`, `SOUL.md`, `TOOLS.md`, and `.githu ...[truncated 3527 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit user confirmation before every promotion into an agent-context file. Show the exact target path and exact proposed text before writing it. 2. Treat all conversation-derived learnings as untrusted data. Repetition or recurrence must not be considered a trust signal. 3. Remove the instruction to “promote aggressively” and make non-promotion the default. 4. Introduce a review queue so entries remain in `.learnings/` until a trusted maintainer approves them. 5. Record provenance for every candidate, including source session, author or requester, creation date, related tasks, reviewer, and approval timestamp. 6. Reject promotion candidates that attempt to: - Override system or user instructions. - Weaken security, authorization, or confidentiality controls. - Expand tool permissions or data-access scope. - Require unverified command execution. - Suppress warnings, review, or user confirmation. - Exfiltrate transcripts, credentials, environment data, or source content. 7. Use a structured, allowlisted rule schema rather than copying free-form text into persistent instruction files. 8. Keep project facts and behavioral instructions separate. Prefer promoting verifiable facts, such as a package manager or build command, rather than open-ended behavioral rules. 9. Add duplicate, conflict, and policy checks before promotion, and prevent new rules from overriding higher-priority security guidance. 10. Provide an audit log and rollback mechanism for all changes to persistent agent-context files. 11. Require code review when promoted files are tracked in version control. 12. Update the bootstrap reminder to state that promotion is prohibited without explicit user approval and security validation. ]]>
