T02 · Agent Memory Poisoning
Error
- Location
- assets/AGENTS.md:31
- Finding
- Persistent Self-Modification of Trusted Agent Instructions<![CDATA[ ## Vulnerability Details **File Location**: `assets/AGENTS.md:31-35` and `assets/AGENTS.md:135-142` **Vulnerability Type**: Persistent modification of trusted agent policy **Risk Level**: High ### Complete Code Snippet ```markdown - Memory is limited — if you want to remember something, WRITE IT - "Mental notes" don't survive session restarts - "Remember this" → update daily notes or relevant file - Learn a lesson → update AGENTS.md, TOOLS.md, or skill file - Make a mistake → document it so future-you doesn't repeat it ``` ```markdown ## Self-Improvement After every mistake or learned lesson: 1. Identify the pattern 2. Figure out a better approach 3. Update AGENTS.md, TOOLS.md, or relevant file immediately Don't wait for permission to improve. If you learned something, write it down now. ``` ### Technical Analysis The Skill treats `AGENTS.md`, `TOOLS.md`, and Skill files as persistent trusted instructions while simultaneously directing the agent to modify those files automatically. Because `assets/AGENTS.md:11-17` instructs future sessions to reload persistent state before performing other work, newly written rules can continue influencing behavior across sessions. The instruction does not distinguish untrusted observations from approved operating policy. If external content, tool output, or an incorrect model inference is interpreted as a “lesson,” it can be promoted into a trusted instruction file. This creates a persistent memory-poisoning path even though the Skill separately warns against following instructions from external content. ### Attack Path 1. The agent processes attacker-controlled content, such as a webpage, email, document, log entry, or repository file. 2. The content causes an error or presents a plausible instruction as a reusable operational lesson. 3. The self-improvement directive causes the agent to write the derived rule into `AGENTS.md`, `TOOLS.md`, or another Skill file without human approval. 4. A later session rea ...[truncated 572 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Prohibit automatic modification of `AGENTS.md`, `SOUL.md`, Skill files, and other trusted policy documents. - Write proposed lessons to a separate non-executable review file, such as `memory/proposed-lessons.md`. - Require explicit human approval before promoting a lesson into trusted instructions. - Record the source and trust classification of each proposed lesson. - Never derive persistent policy from external content, logs, webpages, emails, API responses, or generated sub-agent output without validation. - Add integrity monitoring or version control for trusted policy files so unauthorized changes are visible and reversible. ]]>
