T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:366
- Finding
- Untrusted Learnings Can Be Promoted into Persistent Agent Instructions## Vulnerability Details **File Location**: `SKILL.md:40-43`, `SKILL.md:366-380` **Vulnerability Type**: Persistent agent-memory poisoning **Risk Level**: High ### Vulnerable Code Snippets ```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) | ``` ```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. ``` ### Technical Analysis The Skill records information derived from conversations, user corrections, command errors, and tool behavior. It then directs the agent to promote recurring or broadly applicable entries into files such as `AGENTS.md`, `SOUL.md`, `TOOLS.md`, `CLAUDE.md`, and Copilot instructions. These files may be loaded automatically as agent context in later sessions. The promotion process therefore crosses a trust boundary: potentially attacker-influenced conversational content is transformed into persistent instructions. The documented recurrence threshold establishes frequency but does not establish trustworthiness. An attacker can repeat the same crafted correction across tasks or induce similar entries until it qualifies for promotion. The workflow does not require explicit approval from a trusted user, provenance validation, content allowlisting, or a security revi ...[truncated 1408 chars]
- Remediation
- ## Remediation Suggestions 1. Require explicit, informed user approval before every modification to persistent agent-context files. 2. Never promote instructions supplied directly by untrusted users, external content, command output, or cross-session messages without independent verification. 3. Preserve provenance for each learning, including its originating session, source type, author, and supporting evidence. 4. Restrict automatic promotion to factual, project-scoped observations. Prohibit automatic promotion of behavioral directives, tool-execution rules, security-policy changes, or instructions that weaken safeguards. 5. Present the exact proposed diff to the user before writing to `AGENTS.md`, `SOUL.md`, `TOOLS.md`, `CLAUDE.md`, or Copilot instructions. 6. Treat recurrence only as a prioritization signal, not as proof that content is trustworthy. 7. Validate proposed instructions against a denylist covering credential access, external transmission, disabling security controls, destructive operations, and automatic execution. 8. Prefer a separate review queue for promotion candidates instead of allowing the agent to write directly into automatically loaded context files.
