T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:53
- Finding
- Unvalidated User Instructions Can Poison Persistent Agent Memory<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:53-77`, `SKILL.md:167-178`, `setup.md:79-86`, `setup.md:153-160` **Vulnerability Type**: Persistent storage of user-controlled behavioral instructions **Risk Level**: High ### Vulnerable Code From `SKILL.md:53-77`: ```markdown ## Learning Signals Log automatically when you notice these patterns: **Corrections** → add to `corrections.md`, evaluate for `memory.md`: - "No, that's not right..." - "Actually, it should be..." - "You're wrong about..." - "I prefer X, not Y" - "Remember that I always..." - "I told you before..." - "Stop doing X" - "Why do you keep..." **Preference signals** → add to `memory.md` if explicit: - "I like when you..." - "Always do X for me" - "Never do Y" - "My style is..." - "For [project], use..." **Pattern candidates** → track, promote after 3x: - Same instruction repeated 3+ times - Workflow that works well repeatedly - User praises specific approach ``` From `SKILL.md:167-178`: ```markdown ### 2. Tiered Storage | Tier | Location | Size Limit | Behavior | |------|----------|------------|----------| | HOT | memory.md | ≤100 lines | Always loaded | | WARM | projects/, domains/ | ≤200 lines each | Load on context match | | COLD | archive/ | Unlimited | Load on explicit query | ### 3. Automatic Promotion/Demotion - Pattern used 3x in 7 days → promote to HOT - Pattern unused 30 days → demote to WARM - Pattern unused 90 days → archive to COLD - Never delete without asking ``` From `setup.md:79-86`: ```markdown ```markdown **Self-Improving** Compounding execution quality is part of the job. Before non-trivial work, load `~/self-improving/memory.md` and only the smallest relevant domain or project files. After corrections, failed attempts, or reusable lessons, write one concise entry to the correct self-improving file immediately. Prefer learned rules when relevant, but keep self-inferred rules revisable. Do not skip retrieval just because the task feels familiar. ``` `` ...[truncated 2139 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace free-form executable memory entries with a structured schema containing: - Preference type. - Allowed scope. - Source identity. - Creation and expiration timestamps. - Confirmation status. - A non-executable value. 2. Reject persistent entries concerning: - Safety policies or instruction hierarchy. - Tool permissions or filesystem scope. - Authentication information or secrets. - External communication. - Software installation or command execution. - Requests to suppress confirmation or auditing. 3. Treat all loaded memory as untrusted data subordinate to system, developer, and current authorized user instructions. 4. Require explicit workspace-owner approval before creating global or cross-session rules. 5. Do not promote a rule based only on repetition; perform a security-policy check before promotion. 6. Escape or quote stored text and clearly delimit it as data rather than Agent instructions. 7. Record provenance and prevent instructions from one user, project, or shared channel from affecting another. 8. Provide a review queue where proposed persistent rules can be approved, edited, rejected, or scoped before activation. ]]>
