T02 · Agent Memory Poisoning
Warning
- Location
- SKILL.md:1120
- Finding
- Mandatory Persistent Self-Modification Can Poison Future Skill Behavior<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 1120–1123 **Vulnerability Type**: Persistent instruction poisoning through mandatory self-modification **Risk Level**: Medium ### Vulnerable Instruction The following is a faithful English rendering of the relevant instruction: ```markdown When you obtain a correct result only after multiple attempts—for example, after trial and error with parameter formats, changing interface selection, or discovering undocumented constraints—you must briefly append the experience to the pitfall records in Chapter 16. Recording standard: - Only record cases that succeeded after two or more attempts. ``` ### Technical Analysis The Skill requires the agent to append runtime observations to `SKILL.md`, which is persistent instruction state loaded by future sessions. This creates a write channel from runtime data into trusted Skill instructions. The instruction does not require: - Confirmation that the observed workaround is accurate. - Verification against authoritative documentation. - Sanitization of content originating from API responses or user input. - Human approval before modifying the Skill. - Separation of untrusted observations from executable agent instructions. - Provenance, integrity protection, or rollback support. If an external financial-data source, API response, or user-controlled workflow causes repeated failures and then presents a crafted workaround, the agent may treat that workaround as learned experience and persist it. Later sessions could trust the resulting text as part of the Skill. This is classified as memory poisoning rather than session-only instruction hijacking because the prescribed modification is intended to survive the current run and influence future sessions. ### Attack Path 1. The agent performs a financial-data query using the Skill. 2. An attacker-controlled or compromised data source causes the first two or more attempts to fail. 3. The source then retur ...[truncated 1375 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the mandatory requirement to edit `SKILL.md` during ordinary Skill execution. 2. Store runtime observations in a separate, non-instructional log that is not automatically loaded as trusted agent guidance. 3. Require explicit human approval before promoting an observation into Skill documentation. 4. Validate proposed changes against authoritative Baostock or Akshare documentation and independent test cases. 5. Record provenance for every proposed entry, including the source, timestamp, affected library version, and validation results. 6. Treat API responses and user-provided content as untrusted data and prohibit copying them directly into persistent instructions. 7. If automated updates are necessary, use a constrained schema, content validation, integrity checks, version control, and a reviewable pull-request workflow. 8. Ensure the installed Skill directory is read-only during normal execution and only writable by a separate, authorized maintenance process. ]]>
