T02 · Agent Memory Poisoning
- Location
- SKILL.md:462
- Finding
- Untrusted Conversation-Derived Content Can Poison Persistent Agent Instructions## Vulnerability Details **File Location**: `SKILL.md:462-469`; related promotion workflows at `SKILL.md:40-43`, `SKILL.md:282-309`, and `references/openclaw-integration.md:87-103` **Vulnerability Type**: Persistent agent memory and instruction poisoning **Risk Level**: Medium ### Vulnerable Code and Instructions `SKILL.md:462-469`: ```markdown 1. **Log immediately** - context is freshest right after the issue 2. **Be specific** - future agents need to understand quickly 3. **Include reproduction steps** - especially for errors 4. **Link related files** - makes fixes easier 5. **Suggest concrete fixes** - not just "investigate" 6. **Use consistent categories** - enables filtering 7. **Promote aggressively** - if in doubt, add to CLAUDE.md or .github/copilot-instructions.md 8. **Review regularly** - stale learnings lose value ``` `SKILL.md:40-43`: ```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) | ``` `references/openclaw-integration.md:87-103`: ```markdown ## Learning Workflow ### Capturing Learnings 1. **In-session**: Log to `.learnings/` as usual 2. **Cross-session**: Promote to workspace files ### Promotion Decision Tree ``` Is the learning project-specific? ├── Yes → Keep in .learnings/ └── No → Is it behavioral/style-related? ├── Yes → Promote to SOUL.md └── No → Is it tool-related? ├── Yes → Promote to TOOLS.md └── No → Promote to AGENTS.md (workflow) ``` ``` ### Technical Analysis The Skill treats user corrections, conversational observations, errors, and inferred best practices as sources for learning entries. It subsequently directs the agent to promote selected entr ...[truncated 3361 chars]
- Remediation
- ## Remediation Suggestions 1. Replace “promote aggressively” with a default-deny promotion policy. Content should remain in `.learnings/` unless it passes explicit review. 2. Require affirmative user or administrator confirmation before modifying `SOUL.md`, `AGENTS.md`, `TOOLS.md`, `CLAUDE.md`, or other automatically loaded instruction files. 3. Generate a proposed patch or staged promotion document instead of directly modifying persistent context. Display the source, destination, and exact proposed rule for review. 4. Record provenance for every promoted entry, including the originating session, source type, author or user, supporting evidence, reviewer, approval timestamp, and destination. 5. Treat conversation-derived text as untrusted data. Summarize it without preserving imperative instructions until its accuracy and safety have been verified independently. 6. Enforce mandatory promotion gates, such as recurrence across multiple distinct tasks, reproducible evidence, successful validation, and human review. 7. Reject or quarantine proposed rules involving credential access, secret collection, external data transmission, safety-control bypasses, privilege changes, destructive commands, or unrelated tool execution. 8. Restrict promotion targets through an allowlist and use filesystem permissions to prevent ordinary learning workflows from silently changing high-trust agent instructions. 9. Add rollback metadata and retain reviewed diffs so poisoned rules can be traced and removed. 10. Clearly distinguish passive historical memory from authoritative instructions; `.learnings/` entries should not automatically acquire instruction priority merely because they recur.
