T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:107
- Finding
- Persistent Agent Memory Poisoning Through Untrusted Session Summaries<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 107-128 **Vulnerability Type**: Persistent modification of trusted Agent memory and instruction files **Risk Level**: High ### Vulnerable Code ```text Review the last 24 hours of work. Extract: 1. **Patterns that worked** - approaches to repeat 2. **Gotchas encountered** - things to avoid 3. **Preferences learned** - user likes/dislikes 4. **Key decisions** - and their reasoning 5. **Open items** - unfinished work Update: - MEMORY.md with significant long-term learnings - memory/YYYY-MM-DD.md with today's details - AGENTS.md if workflow changes needed Commit changes with message "compound: daily review YYYY-MM-DD" ``` ### Technical Analysis The Skill instructs the Agent to treat content from all sessions in the preceding 24 hours as a source of persistent knowledge. It then permits extracted content to be written to `MEMORY.md`, daily memory files, and `AGENTS.md`. Session content is untrusted because it may include messages from external users, copied web content, tool output, repository documentation, or deliberate prompt-injection payloads. The workflow does not require provenance validation, separation of instructions from data, prompt-injection detection, or human approval before modifying persistent state. Modification of `AGENTS.md` is especially dangerous because this file may be interpreted as authoritative workflow instructions in future sessions. An attacker-controlled statement can therefore be transformed from transient conversation content into a durable instruction. ### Attack Path 1. An attacker introduces a message into a session reviewed by the Skill. 2. The message presents a malicious instruction as a user preference, workflow improvement, recurring pattern, or operational requirement. 3. The scheduled or manual review processes the session without treating its contents as untrusted input. 4. The Agent writes the malicious rule into `MEMORY.md` or `AGENTS.md`. ...[truncated 877 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Prohibit automatic modification of `AGENTS.md`; changes to authoritative instruction files must require explicit human approval. - Treat all reviewed session content as untrusted data rather than executable instructions. - Generate a proposed diff in a separate staging file instead of directly updating persistent memory. - Require the user to inspect and approve each proposed persistent-memory change. - Reject imperative statements, tool-use directives, requests to weaken safeguards, and content attempting to redefine Agent behavior. - Preserve provenance for every proposed memory item, including the originating session and message. - Restrict persistent memory to factual summaries and explicitly structured preferences. - Apply allowlisted schemas and length limits to stored memory. - Provide rollback and audit-log mechanisms for all persistent-memory changes. ]]>
