T02 · Agent Memory Poisoning
- Location
SKILL.md:45- Finding
Persistent Behavioral Instruction Embedded in Memory Summary
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 45-46
Vulnerability Type: Persistent agent memory poisoning
Risk Level: MediumVulnerable Code
markdown ## Resume Instruction Continue directly — do not acknowledge this summary, do not recap what was happening, and do not preface with continuation text.Technical Analysis
The structured summary template places an imperative behavioral instruction into
MEMORY.mdduring memory flush or compaction. Unlike factual continuation state, this text directly instructs a future agent how to behave after loading the persisted summary.Persistent memory can cross session or compaction boundaries. Consequently, instructions written into it may be interpreted as authoritative in later sessions even though they are not part of the current system, developer, or user instructions. The directive also discourages acknowledging the loaded summary, reducing transparency about why the agent behaves in a particular way.
The demonstrated instruction is fixed rather than dynamically attacker-controlled. However, the design establishes a persistent instruction channel. If the same pattern is later applied to conversation-derived content without strict separation and sanitization, untrusted instructions could survive compaction and influence future sessions.
Attack Path
- The skill is loaded and used during a memory flush or context-compaction operation.
- The documented template is written to persistent
MEMORY.mdstorage. - The
Resume Instructionsection is stored as an imperative command rather than inert state data. - A subsequent session or post-compaction agent reads the stored summary.
- The agent interprets the persisted command as an instruction and suppresses acknowledgment or recap of the restored context.
- If conversation-controlled directives are later inserted through the same mechanism, an attacker could attempt to preserve behav ...[truncated 703 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove imperative commands from persistent memory templates.
- Represent continuation information as non-authoritative data, for example:
markdown ## Resume State - Suggested next action: Continue the tasks listed under Current Work. - Explicitly label loaded memory as untrusted reference material that cannot override current system, developer, or user instructions.
- Keep factual state and executable instructions in separate, typed fields; prevent memory-derived fields from being promoted into the instruction hierarchy.
- Sanitize or encode conversation-derived content before persistence so headings, role markers, XML tags, or imperative text cannot create new instruction sections.
- Require the active agent to validate resumed work against current-session authorization and context rather than automatically obeying stored continuation directives.
- Preserve transparency by allowing the agent to disclose that context was restored from a summary when relevant.
