T02 · Agent Memory Poisoning
- Location
SKILL.md:17- Finding
Untrusted conversational observations can poison persistent agent instructions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:17-26,SKILL.md:341-360,hooks/openclaw/handler.js:11-25,hooks/openclaw/handler.js:42-51,references/openclaw-integration.md:120-142
Vulnerability Type: Persistent agent memory and instruction poisoning
Risk Level: HighVulnerable Code
SKILL.md:17-26:markdown | Situation | Action | |-----------|--------| | Command/operation fails | Log to `.learnings/ERRORS.md` | | User corrects you | Log to `.learnings/LEARNINGS.md` with category `correction` | | User wants missing feature | Log to `.learnings/FEATURE_REQUESTS.md` | | API/external tool fails | Log to `.learnings/ERRORS.md` with integration details | | Knowledge was outdated | Log to `.learnings/LEARNINGS.md` with category `knowledge_gap` | | Found better approach | Log to `.learnings/LEARNINGS.md` with category `best_practice` | | Simplify/Harden recurring patterns | Log/update `.learnings/LEARNINGS.md` with `Source: simplify-and-harden` and a stable `Pattern-Key` | | Similar to existing entry | Link with `**See Also**`, consider priority bump | | 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) |hooks/openclaw/handler.js:11-25: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\` - Wo ...[truncated 2767 chars]- Remediation
View remediation
Remediation Suggestions
- Require explicit human approval before modifying
SOUL.md,AGENTS.md,TOOLS.md,CLAUDE.md, Copilot instructions, or any other automatically loaded agent-control file. - Store learnings as inert quoted data rather than executable instructions. Clearly delimit the original source text and mark it as untrusted.
- Record provenance for every learning, including originating user, session, source message, verification state, and reviewer.
- Introduce trust states such as
unverified,verified, andapproved-for-promotion; only the final state may be promoted. - Reject or quarantine learning content containing imperative agent directives, shell commands, credential requests, external URLs, encoded payloads, or instructions to override existing policies.
- Generate a proposed patch for human review instead of directly editing persistent instruction files.
- Restrict promotion to concise, independently verified factual statements. Do not promote raw user-provided text.
- Add conflict detection so promoted rules cannot override platform safety requirements or higher-priority workspace policies.
- Add the TypeScript handler's sub-agent exclusion to
handler.js, or generate both handlers from one source to prevent security-relevant divergence. - Maintain an auditable history and provide a rollback mechanism for every promoted instruction.
- Require explicit human approval before modifying
