T02 · Agent Memory Poisoning
- Location
SKILL.md:23- Finding
Untrusted Learnings Can Be Promoted into Persistent Agent Instructions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:23-26,SKILL.md:278-289,SKILL.md:344-359,hooks/openclaw/handler.js:11-24,hooks/openclaw/handler.ts:12-25
Vulnerability Type: Persistent agent memory poisoning
Risk Level: HighVulnerable Code
SKILL.md:23-26:markdown | 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) |SKILL.md:278-289:markdown | `AGENTS.md` | Agent-specific workflows, tool usage patterns, automation rules | | `.github/copilot-instructions.md` | Project context and conventions for GitHub Copilot | | `SOUL.md` | Behavioral guidelines, communication style, principles (OpenClaw workspace) | | `TOOLS.md` | Tool capabilities, usage patterns, integration gotchas (OpenClaw workspace) | ### How to Promote 1. **Distill** the learning into a concise rule or fact 2. **Add** to appropriate section in target file (create file if needed) 3. **Update** original entry: - Change `**Status**: pending` → `**Status**: promoted` - Add `**Promoted**: CLAUDE.md`, `AGENTS.md`, or `.github/copilot-instructions.md`hooks/openclaw/handler.js:11-24:javascript After completing tasks, evaluate if any learnings should be captured: **Log when:** - User corrects you → \`.learnings/LEARNINGS.md\` - Command/operation fails → \`.learnings/ERRORS.md\` - User wants missing capability → \`.learnings/FEATURE_REQUESTS.md\` - You discover your knowledge was wrong → \`.learnings/LEARNINGS.md\` - You find a better approach → \`.learnings/LEARNINGS.md\` **Promote when pattern is proven:** - Behavioral patterns → \`SOUL.md\` - Workflow improvements → \`AGENTS.md\` - Tool gotchas → \`TOOLS.md\` ...[truncated 2439 chars]- Remediation
View remediation
Remediation Suggestions
- Require explicit human approval before any learning is copied into an agent instruction or memory file.
- Treat user corrections, command output, external content, and session transcripts as untrusted evidence rather than executable guidance.
- Store provenance with every learning, including the originating session, author, source type, and supporting project evidence.
- Reject promotions that attempt to alter safety constraints, instruction priority, roles, permissions, authentication behavior, external destinations, or tool-execution policy.
- Use an allowlisted schema for promoted rules rather than copying free-form conversational text.
- Require corroboration from trusted repository documentation or reviewed code before promoting project facts.
- Show a reviewable diff and affected target file before promotion, and require confirmation for the exact proposed text.
- Maintain an append-only promotion history with rollback support.
- Mark generated learning files as untrusted data in agent instructions so that their contents cannot override higher-priority rules.
- Add adversarial tests covering malicious corrections, repeated prompt injection, encoded instructions, and attempts to weaken tool safeguards.
