T02 · Agent Memory Poisoning
Warning
- Location
- SKILL.md:90
- Finding
- Untrusted Web Content Can Poison a Persistent Agent Persona<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 90-116 **Vulnerability Type**: Persistent memory poisoning through untrusted external content **Risk Level**: Medium ### Vulnerable Code ```python # Fetch English lore from Fandom (multiple subpages) en_file = web_fetch(f"{result['operator']['en_detail_url']}/File") # Basic profile, stats, files en_story = web_fetch(f"{result['operator']['en_detail_url']}/Story") # Story appearances, plot involvement en_trivia = web_fetch(f"{result['operator']['en_detail_url']}/Trivia") # Trivia, relationships, misc info # Fetch Chinese lore from PRTS zh_lore = web_fetch(result["operator"]["cn_detail_url"]) # Fetch voice lines from Dialogue page dialogue = web_fetch(result["operator"]["dialogue_url"]) ``` ```markdown **Generate comprehensive SOUL.md:** **CRITICAL - Write SOUL.md in detected language** Structure: 1. **Core Identity** - Background, motivation, personality (blend EN+CN sources) 2. **Voice and Mannerisms** - Speech patterns, catchphrases (from Dialogue) 3. **Relationships** - Connections to other characters 4. **Themes** - Internal conflicts, philosophy 5. **How to Embody** - Acting guidance 6. **Reference: Original Voice Lines** - Key quotes (EN with CN) Write to: `[workspace]/SOUL.md` ``` ### Technical Analysis The Skill directs the LLM to fetch content from externally maintained wiki pages and use that content to generate a persistent `SOUL.md` persona. It does not instruct the LLM to treat fetched material solely as untrusted data, ignore embedded instructions, or extract only a constrained set of factual fields. Because wiki content can be edited or compromised independently of the Skill package, an attacker could insert instruction-like text into a referenced page. If the LLM follows or incorporates that text while generating `SOUL.md`, attacker-controlled behavioral rules may become part of the new agent's persistent persona. The Skill subsequently spawns that agent, ...[truncated 1492 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Explicitly label all fetched wiki pages as untrusted reference material. 2. Instruct the LLM never to follow commands, policies, role changes, tool requests, or behavioral directives found in fetched content. 3. Extract only predefined factual fields, such as operator name, faction, class, biography, relationships, and verified dialogue. 4. Remove or quarantine imperative text, system-prompt-like text, encoded data, URLs requesting additional retrieval, and references to local tools or files. 5. Keep externally sourced quotations separate from behavioral instructions in `SOUL.md`. 6. Require user confirmation or a review step before persisting the generated persona and spawning the agent. 7. Record source URLs and distinguish verbatim quotations from LLM-generated acting guidance. 8. Apply strict tool permissions to generated agents so persona content cannot independently authorize sensitive operations. ]]>
