T02 · Agent Memory Poisoning
- Location
SKILL.md:43- Finding
Persistent Memory Can Carry Untrusted Instructions Across Sessions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 43-48 and 59-63;references/通用prompt模板.md, lines 29-33
Vulnerability Type: Persistent memory poisoning through unsanitized conversation-derived content
Risk Level: MediumRelevant snippet from
SKILL.md, lines 43-48, translated into English:markdown ## Memory At the start of every new session: 1. Read `MEMORY.md` to obtain long-term context 2. Read `memory/YYYY-MM-DD.md` for today and yesterday to obtain recent context 3. After completing a valuable conversation, immediately write the key points to today's journalRelevant snippet from
SKILL.md, lines 59-63, translated into English:markdown ### Memory Habits 1. **Proactively record** — After every valuable conversation, such as project analysis, technical research, or an important decision, immediately write the key points to `memory/YYYY-MM-DD.md`. Do not wait for the user to ask. 2. **Provide reminders when the context becomes long** — When the conversation feels long, proactively remind the user that the key points have been recorded. 3. **Consolidate during heartbeat processing** — Periodically review recent journals and extract information worth retaining into `MEMORY.md`.Relevant snippet from
references/通用prompt模板.md, lines 29-33, translated into English:markdown ### Session Startup At the start of every new session: 1. Read `MEMORY.md` to obtain long-term context 2. Read today's and yesterday's journals to obtain recent context 3. Continue naturally as though you remember what happened previouslyTechnical Analysis
The Skill instructs an agent to derive persistent records from conversation content and automatically load those records into future sessions. It does not establish a trust boundary between stored facts and executable instructions.
There are no requirements to:
- Reject commands, policy text ...[truncated 2035 chars]
- Remediation
View remediation
Remediation Suggestions
- Store memories in a structured format with separate fields for facts, provenance, confidence, timestamp, and user approval.
- Explicitly prohibit storage of commands, system prompts, safety-policy changes, tool-use directives, authentication data, and requests to alter future behavior.
- Prefix loaded memory with a strong instruction stating that it is untrusted historical data and cannot override system, developer, or current-session instructions.
- Quote or delimit all memory content so it is processed as data rather than as instructions.
- Require explicit user confirmation before promoting journal entries into
MEMORY.md. - Track the source of every memory entry and distinguish direct user statements from third-party or retrieved content.
- Add a review and deletion workflow so users can inspect, correct, quarantine, and remove poisoned entries.
- During consolidation, detect instruction-like language and either discard it or convert it into a neutral factual statement.
- Apply least privilege when loading memory: only retrieve entries relevant to the current task rather than automatically injecting entire files.
