T02 · Agent Memory Poisoning
Warning
- Location
- SKILL.md:38
- Finding
- Untrusted experience records can persistently influence future agent behavior<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 38-56 **Vulnerability Type**: Persistent memory poisoning through automatically reused experience records **Risk Level**: Medium ### Vulnerable Code Snippet ```markdown ### 1. For every skill you use When you install a new skill: - Create `memory/experiences/{skill-name}.json` - Define `commonMistakes[]` and `bestPractices[]` - *Before every invocation*, read it and remind yourself what to avoid ### 2. When you make a mistake 1. Stop immediately, don't keep retrying 2. Record the mistake in `self-improving/corrections.md` 3. Update the skill's experience JSON: - Add new entry to `experiences[]` with context, lesson, prevention - Update `commonMistakes[]` if it's a new pattern - Increment `failureCount` 4. If the *same mistake repeats 2+ times*, trigger `capability-evolver` to automatically improve the experience and best practices 5. Retry after updating ### 3. Regular maintenance - **Daily**: End-of-day review mistakes, update experiences - **Weekly**: Promote key lessons to long-term memory in MEMORY.md - **Automatic**: capability-evolver can continuously improve stale experiences ``` ### Technical Analysis The Skill directs the agent to persist task-derived context, lessons, prevention instructions, common mistakes, and best practices. It then instructs the agent to read these records before every subsequent skill invocation and eventually promote selected content into long-term memory. No validation, provenance tracking, trust separation, schema-level content restriction, or human review requirement is defined before generated content becomes persistent guidance. Consequently, adversarial material encountered during a task could be summarized as an imperative lesson or best practice and later treated as trusted behavioral instruction. The integration with `capability-evolver` increases the exposure because repeated events can trigger automatic modification of stored g ...[truncated 1639 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Treat all generated experience content as untrusted data rather than agent instructions. 2. Enforce a strict schema with allowlisted enumerations and bounded descriptive fields. 3. Reject or neutralize imperative language, tool commands, policy overrides, URLs, and embedded prompts in persisted fields. 4. Record provenance for every entry, including the originating task, author, timestamp, and review state. 5. Keep stored records outside the agent's privileged instruction context; summarize them through a trusted parser before use. 6. Require explicit human approval before adding content to `bestPractices[]`, invoking `capability-evolver`, or promoting any record to `MEMORY.md`. 7. Scope each experience record to the originating skill and prevent automatic cross-skill promotion. 8. Provide deletion, rollback, expiration, and audit-log mechanisms for all persistent entries. 9. Clearly distinguish factual telemetry from behavioral rules so task-controlled context cannot become a durable instruction. ]]>
