T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:262
- Finding
- Untrusted Learning Content Can Be Promoted into Persistent Agent Instructions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:262-289`, `SKILL.md:333-360`, and `SKILL.md:440-448` **Vulnerability Type**: Persistent agent memory poisoning through unsanitized promotion **Risk Level**: High ### Vulnerable Code Snippets From `SKILL.md:262-289`: ```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` ``` From `SKILL.md:333-360`: ```markdown 1. Read `simplify_and_harden.learning_loop.candidates` from the task summary. 2. For each candidate, use `pattern_key` as the stable dedupe key. 3. Search `.learnings/LEARNINGS.md` for an existing entry with that key: - `grep -n "Pattern-Key: <pattern_key>" .learnings/LEARNINGS.md` 4. If found: - Increment `Recurrence-Count` - Update `Last-Seen` - Add `See Also` links to related entries/tasks 5. If not found: - Create a new `LRN-...` entry - Set `Source: s ...[truncated 3931 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit human approval before every write to `CLAUDE.md`, `AGENTS.md`, `.github/copilot-instructions.md`, `SOUL.md`, or `TOOLS.md`. 2. Treat user messages, tool output, task summaries, external documentation, and learning files as untrusted data rather than executable agent instructions. 3. Add a promotion review stage that verifies each proposed rule against authoritative project files or documentation. 4. Reject proposed rules containing: - Role or identity changes. - Requests to ignore previous instructions. - Safety-policy overrides. - Automatic command-execution requirements. - Credential or secret-handling directives. - Unreviewed external URLs or installation commands. 5. Store provenance with every learning, including source task, author, timestamp, supporting evidence, and reviewer identity. 6. Replace “Promote aggressively” with a conservative rule requiring verified evidence, clear project relevance, and human authorization. 7. Generate a proposed patch for review instead of directly modifying persistent instruction files. 8. Constrain promoted content to an allowlisted schema of factual project settings and prohibit arbitrary free-form behavioral instructions. 9. Keep untrusted observations in `.learnings/` and clearly mark them as unverified until review is complete. ]]>
