T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:105
- Finding
- Unvalidated Task Content Can Poison Persistent Agent Memory<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 105–111 **Vulnerability Type**: Persistent memory poisoning through untrusted task-derived content **Risk Level**: High ### Vulnerable Code ```markdown ## 长期记忆更新 任务结束后,按以下优先级更新 MEMORY.md: 1. **关键经验**: 影响未来决策的洞察 2. **工具配置**: 已验证可用的工具和配置 3. **问题模式**: 重复出现的问题类型 4. **最佳实践**: 形成规范的工作方式 ``` ### Technical Analysis The skill directs the agent to update `MEMORY.md` with lessons, tool configurations, problem patterns, and practices derived from completed tasks. It does not require user approval, source verification, sanitization, review, expiration, or separation between trusted policy and untrusted task content. Task descriptions, command output, error messages, and alleged solutions can be controlled or influenced by an attacker. If such content is summarized as a lesson or best practice and written to persistent memory, it can continue influencing the agent after the original task ends. In particular, malicious imperative text may be transformed into persistent operational guidance. ### Attack Path 1. An attacker supplies a task, error message, document, or tool output containing false operational guidance. 2. The agent processes the attacker-controlled material while using this skill. 3. The material is classified as a key lesson, verified configuration, recurring problem pattern, or best practice. 4. The skill instructs the agent to write the derived guidance into `MEMORY.md`. 5. A future session reads the poisoned memory and applies the attacker's guidance outside the context of the original task. 6. Depending on the stored instruction and tools available in that future session, the agent may disclose information, use unsafe configurations, or execute inappropriate operations. ### Impact Assessment The immediate capability is persistent modification of the agent's long-term state within the write permissions available to the skill. The affected scope includes future sessions that cons ...[truncated 308 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit, informed user confirmation before every modification to `MEMORY.md`. 2. Treat task descriptions, logs, documents, web content, and tool output as untrusted data rather than instructions. 3. Store task-specific observations in a skill-scoped journal instead of global agent memory. 4. Permit only narrowly structured memory entries with defined fields, provenance, creation time, and expiration time. 5. Reject or neutralize imperative instructions, policy changes, credential material, and executable commands in proposed memory entries. 6. Present the exact proposed memory change to the user for review before writing it. 7. Record the source of every entry and distinguish verified facts from hypotheses or untrusted claims. 8. Provide mechanisms to audit, revoke, expire, and delete previously stored entries. 9. Restrict filesystem permissions so the skill can modify only its dedicated storage unless broader access is explicitly approved. ]]>
