T02 · Agent Memory Poisoning
- Location
SKILL.md:263- Finding
Untrusted Lessons Can Be Promoted into Persistent Agent Instructions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:263-288,SKILL.md:329-360,hooks/openclaw/handler.js:18-23,hooks/openclaw/handler.ts:19-24
Vulnerability Type: Persistent agent-context poisoning
Risk Level: MediumVulnerable Code
markdown ## Promoting to Project Memory When a learning is broadly applicable (not a one-off fix), promote it to permanent project memory. ### When to Promote - Learning applies across multiple files/features - Knowledge any contributor (human or AI) should know - Prevents recurring mistakes - Documents project-specific conventions ### Promotion Targets | Target | What Belongs There | |--------|-------------------| | `CLAUDE.md` | Project facts, conventions, gotchas for all Claude interactions | | `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`The recurring-pattern workflow additionally directs the agent to promote entries into prompt-bearing files:
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 ...[truncated 2310 chars]- Remediation
View remediation
Remediation Suggestions
- Require explicit, informed user approval before writing any lesson into an automatically loaded instruction or memory file.
- Treat conversation text, command output, task summaries, and existing learning entries as untrusted data.
- Permit automatic promotion only for structured factual fields; prohibit automatic promotion of commands, behavioral mandates, permission changes, external communication instructions, or safety-policy modifications.
- Record provenance for every lesson, including source session, author, timestamp, related task, and review status.
- Add a review state such as
pending_security_reviewand require approval by a trusted maintainer. - Store generated lessons in a non-injected data file by default. Copy them into prompt-bearing files only through a separate reviewed process.
- Detect and reject instruction-hijacking language, encoded payloads, external retrieval directives, credential requests, and attempts to override higher-priority instructions.
- Make cross-session propagation opt-in and show the exact proposed diff before promotion.
