T02 · Agent Memory Poisoning
- Location
SKILL.md:366- Finding
Unreviewed Promotion of Conversation-Derived Rules into Persistent Agent Memory
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:40-43,SKILL.md:366-380,hooks/openclaw/handler.ts:29-34,hooks/openclaw/handler.ts:86-106,hooks/openclaw/handler.js:30-35, andhooks/openclaw/handler.js:87-107
Vulnerability Type: T02: Agent Memory Poisoning
Risk Level: MediumVulnerable Code
The skill directs agents to promote learned rules into persistent, prompt-bearing workspace files:
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) |The recurring-pattern workflow identifies these files as promotion targets:
markdown 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.The OpenClaw bootstrap hook reinforces this workflow in agent context:
ts **Promote when pattern is proven:** - Behavioral patterns → \`SOUL.md\` - Workflow improvements → \`AGENTS.md\` - Tool gotchas → \`TOOLS.md\`The reminder is then installed as a virtual bootstrap file:
ts const reminderFile = { name: REMINDER_NAME, path: REMINDER_PATH, content: REMINDER_CONTENT, missing: false, virtual: true, }; const existingIndex = cleanedBootstrapFiles.findIndex((file) => isInjectedReminderFile(file)); if (existingIndex === -1) { cleanedBootstrapFiles.push(reminderFile); } else { cleanedBootstrapFiles[existingIndex] = reminderFile; } event.context.bootstrapFiles = cleanedBootstrapFiles;Technical Analysis
Files such as
SOUL.md, `AGENTS. ...[truncated 2756 chars]- Remediation
View remediation
Remediation Suggestions
- Require explicit user confirmation before every modification to
SOUL.md,AGENTS.md,TOOLS.md,CLAUDE.md,.github/copilot-instructions.md, or equivalent prompt-bearing files. - Present the destination, source learning, and complete proposed diff before requesting approval.
- Keep automatic capture restricted to
.learnings/; implement promotion as a separate, manually invoked operation. - Treat all conversation-derived content as untrusted data. Distill factual observations instead of copying imperative instructions verbatim.
- Record provenance metadata for every promoted rule, including its source task, author, original learning ID, approval identity, approval time, and destination.
- Prohibit promotion of rules that change safety constraints, instruction precedence, permission boundaries, secret handling, external communication, authentication, or executable tool behavior.
- Validate that a promoted rule is supported by trusted project documentation or independently verified behavior rather than recurrence alone.
- Maintain a manifest of rules installed by the skill and provide a rollback mechanism that removes or reverts each promoted entry.
- Apply least-privilege controls so the hook and routine learning workflow cannot modify persistent instruction files unless promotion mode has been explicitly authorized.
- Update the bootstrap reminder to state that persistent promotion requires review and must never occur automatically.
- Require explicit user confirmation before every modification to
