T02 · Agent Memory Poisoning
Warning
- Location
- SKILL.md:213
- Finding
- Persistent Memory Can Store and Reapply Attacker-Controlled Behavioral Instructions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:213-216`, `SKILL.md:235-242`; `references/architecture.md:35-38`, `references/architecture.md:57-61`; `references/memory_templates.md:145-154` **Vulnerability Type**: Persistent memory poisoning **Risk Level**: Medium ### Vulnerable Code and Instructions `SKILL.md:213-216`: ```markdown | Learning Type | Promote To | |---------------|-----------| | Behavioral patterns | `/memories/user_preferences.md` | | Workflow improvements | `/memories/workflow_library.md` | | Tool tips | `/memories/domain_knowledge.md` | | Project facts/conventions | `/memories/project/[slug]/context.md` | ``` `SKILL.md:235-242`: ```markdown ## Common Mistakes to Avoid 1. **session_notes stack appending** — Update in-place, keep file lean 2. **Not reading memory before work** — Must read session_notes + user_preferences first 3. **Logging everything to memory** — Only write reusable content, avoid noise 4. **No confidence tags on memory** — Knowledge without confidence is blindly adopted 5. **Not saving before restart** — Must write all in-progress state before restart ``` `references/architecture.md:35-38`: ```markdown │ /memories/user_preferences.md ─ 用户偏好 [永不删除] │ │ /memories/domain_knowledge.md ─ 领域知识 │ │ /memories/workflow_library.md ─ 工作流程库 │ │ /memories/project/[slug]/ ─ 项目级记忆 │ ``` `references/memory_templates.md:145-154`: ```markdown ## Self-Improvement Directives ### 当前活跃指令 1. **[优先级-High]**: [指令内容] 2. **[优先级-Medium]**: [指令内容] ### 已完成指令 - [指令]: 已于 YYYY-MM-DD 完成 ### 待验证指令 - [指令]: 等待验证 ``` ### Technical Analysis The Skill promotes information derived from conversations, user feedback, observed behavior, and task content into persistent memory files. It then explicitly requires the Agent to read some of those files before performing subsequent work. The same architecture permits generated “Self-Improvement Directives” t ...[truncated 2106 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Treat every memory entry as untrusted data, not executable Agent instruction. 2. Store memories in a strict schema with separate fields for facts, preferences, provenance, scope, confidence, and authorization. 3. Reject or quarantine entries containing imperative instructions, tool commands, policy changes, requests to ignore constraints, or attempts to redefine memory-processing rules. 4. Explicitly prohibit persistent memories from overriding system instructions, safety policies, authorization checks, or tool restrictions. 5. Require explicit user confirmation before promoting conversational content into cross-session behavioral preferences. 6. Scope memories by authenticated user, project, and task; do not automatically apply project-specific memories elsewhere. 7. Record the exact source and creation context for each entry and display that provenance when the entry is applied. 8. Add expiration, revocation, review, and deletion mechanisms instead of treating user preferences as permanently retained. 9. Render free-form memory fields as quoted reference material and never concatenate them into privileged instruction contexts. 10. Require a safety review before activating generated “Self-Improvement Directives.” ]]>
