T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:192
- Finding
- Untrusted conversational signals can be promoted into persistent Agent behavior## Vulnerability Details **File Location**: `SKILL.md:94-99`, `SKILL.md:192-219`, and `SKILL.md:229-233` **Vulnerability Type**: Persistent memory poisoning through overly broad capture and promotion rules **Risk Level**: High ### Vulnerable Code Snippet ```markdown 4. **更新长期记忆** — 最重要 1-3 条洞察追加到 MEMORY.md(保持 ≤80 行) - **出口条件**:MEMORY.md 已追加新洞察且 ≤80 行(超限时已执行 mini 蒸馏) - 追加后若超80行:先执行 **mini 蒸馏**(合并高度相似的条目、删除已过时的旧条目),再追加新洞察 - 判断条件:内容相同只是表述不同 → 合并保留更精准的一条;超过30天未触发的规则 → 移入「## 已归档」 - mini 蒸馏不等于周度蒸馏,只做局部合并,不生成 Narrative - ⚠️ **写入铁律**:修改 MEMORY.md 必须用 `read → write` 覆写(见 IRON LAW #3) ``` ```markdown **正向反馈信号** → LEARNINGS.md positive_signal: - "好"、"可以"、"对"、"行"、"就这样"、"不错"、"喜欢这个" - "这个格式好"、"这次写得好"、"比上次好" - 木老师对特定输出未纠正且直接采用(隐式正向) **偏好信号** → LEARNINGS.md best_practice: - "我喜欢你这样"、"以后都这样"、"永远不要Y"、"我的风格是" - 木老师对特定方案明确赞许 ``` ```markdown | 经验类型 | 提升目标 | 示例 | |----------|---------|------| | 行为风格、原则 | SOUL.md | "输出用数字序号不用 bullet" | | 工作流、子Agent规则 | AGENTS.md | "有专属子Agent先分配给子Agent" | | 工具使用、API配置 | TOOLS.md | "发文件用本地路径而非远程 URL" | | 高频场景规律 | MEMORY.md | 偏好设置、常用 ID 等 | | 可复用能力模式 | 新建 mu-xxx Skill | 独立封装为技能 | ``` ### Technical Analysis The Skill treats broad conversational events as persistent learning signals. Generic acknowledgments such as “OK,” lack of correction, and implicit adoption are classified as positive evidence. The daily workflow then writes selected insights directly to `MEMORY.md`, while later promotion can modify `SOUL.md`, `AGENTS.md`, and `TOOLS.md`. These files can affect future Agent sessions, behavioral constraints, delegation rules, and tool use. Although recurrence and verification gates are documented for formal promotion, the daily `MEMORY.md` update is less strictly controlled, and no mandatory trust classification, provenance validation, prompt-injection screening, or explicit user approval is required before persistence. Consequently, content originating from an a ...[truncated 1586 chars]
- Remediation
- ## Remediation Suggestions 1. Require explicit, contemporaneous user confirmation before any entry is written to `MEMORY.md`, `SOUL.md`, `AGENTS.md`, or `TOOLS.md`. 2. Treat generic acknowledgments and absence of correction as insufficient evidence for persistent learning. 3. Record provenance for every item, including source type, source identity, session, trust level, and whether the content came from a user, tool, retrieved document, or sub-Agent. 4. Prohibit promotion of content originating from tool output, web content, files, shared channels, or other untrusted sources unless independently confirmed by an authorized user. 5. Separate proposed memories from active Agent configuration. Store proposals in a review queue and activate them only after approval. 6. Apply an allowlisted schema to persistent entries and reject embedded instructions, commands, role changes, credential requests, and tool-routing directives. 7. Maintain an immutable audit trail and support rollback of each promoted memory. 8. Restrict automatic processing to informational memories; require stronger approval for behavioral, tool, security, or delegation rules.
