T02 · Agent Memory Poisoning
Warning
- Location
- SKILL.md:166
- Finding
- Conversation-Derived Content Can Be Promoted into Persistent Agent Control Files<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:99-103`, `SKILL.md:166-176`, `SKILL.md:277-305`, `SKILL.md:380` **Vulnerability Type**: Persistent memory poisoning through insufficiently controlled promotion **Risk Level**: Medium ### Vulnerable Code ```markdown | 学习类型 | 提升到 | 示例 | |----------|--------|------| | 行为模式 | `SOUL.md` | "简洁回复,不说废话" | | 工作流改进 | `AGENTS.md` | "长任务 spawning 子代理" | | 工具技巧 | `TOOLS.md` | "Git push 需要先配置 auth" | ``` ```markdown **会话中:** - 重要决策 → `memory/decisions/` - 犯错/教训 → `.learnings/LEARNINGS.md` 或 `ERRORS.md` - 用户纠正 → `.learnings/LEARNINGS.md` (category: correction) - 发现更好方法 → `.learnings/LEARNINGS.md` (category: best_practice) ``` ```markdown ### 如何 Promotion 1. **提炼** 学习成简洁的规则或事实 2. **添加** 到目标文件的相关部分 3. **更新** 原始条目: - 改 `**Status**: pending` → `**Status**: promoted` - 添加 `**Promoted**: SOUL.md` 或 `AGENTS.md` 或 `TOOLS.md` ``` ```markdown 7. **积极 Promotion** - 有疑问就提升到配置文件 ``` ### Technical Analysis The Skill instructs the Agent to record user corrections and conversation-derived lessons in `.learnings/LEARNINGS.md`, and later promotes selected content into `SOUL.md`, `AGENTS.md`, or `TOOLS.md`. These target files can influence persistent Agent behavior, workflows, and tool usage across later sessions. The documented promotion process does not require trusted-user approval, source validation, security review, content sanitization, or a preview of the resulting configuration changes. The recommendation to promote content when uncertain further weakens the trust boundary. Because conversation content may be attacker-controlled, an attacker can phrase malicious operational instructions as corrections, best practices, or reusable lessons. If the Agent subsequently promotes those instructions, they can survive beyond the originating session and influence future behavior. The scripts do not directly automate these promotions, so exploitation depends on the Agent following the documented workflow. Nevertheless, ...[truncated 1326 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit approval from a trusted user before writing promoted content to `SOUL.md`, `AGENTS.md`, or `TOOLS.md`. 2. Treat all conversation-derived learning entries as untrusted data rather than executable instructions. 3. Record provenance for every learning entry, including the originating user, session, timestamp, and whether the source was authenticated. 4. Display a complete proposed diff before promotion and require confirmation for each target file. 5. Reject or quarantine entries containing: - Instruction-priority overrides. - Requests to ignore safety constraints. - Shell commands or executable code. - External URLs or payload retrieval instructions. - Credential-handling directives. - Requests to weaken approval or access controls. 6. Replace “promote when uncertain” with a conservative policy that prohibits promotion when trust or intent is uncertain. 7. Restrict promotion to concise, declarative facts or preferences and prohibit autonomous promotion of tool-execution rules. 8. Maintain an auditable promotion log and provide a straightforward rollback mechanism. 9. Where supported, enforce schema validation and allowlisted sections for persistent configuration changes. ]]>
