T02 · Agent Memory Poisoning
- Location
SKILL.md:67- Finding
Persistent User-Controlled Content Can Poison Future Agent Sessions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 67–89
Vulnerability Type: Persistent memory poisoning
Risk Level: MediumVulnerable Code
markdown ## Trigger Words | User Says | Action | |-----------|--------| | "Remember this" | `smart_ingest` immediately | | "Don't forget" | `smart_ingest` with high priority | | "I always..." / "I never..." | Save as preference | | "I prefer..." / "I like..." | Save as preference | | "This is important" | `smart_ingest` + `promote_memory` | | "Remind me..." | Create `intention` | ## Session Start Routine At the start of conversations, search for relevant context: ```bash # Search user preferences echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search","arguments":{"query":"user preferences instructions"}}}' | ~/bin/vestige-mcp 2>/dev/null | jq -r '.result.content[0].text' # Search project context echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search","arguments":{"query":"current project context"}}}' | ~/bin/vestige-mcp 2>/dev/null | jq -r '.result.content[0].text'text ### Technical Analysis The skill directs the agent to persist broadly defined, user-controlled statements as preferences or important memories. It then searches persistent storage at the beginning of subsequent conversations using a query that explicitly includes the term `instructions`. No trust boundary, provenance check, session scope, confirmation step, or instruction/data separation is defined. Consequently, an attacker can phrase behavioral directives as preferences and cause them to be stored. When those records are retrieved in a later session, instruction-like memory content may be introduced into the agent's context and treated as authoritative user guidance. Semantic search increases this risk because a malicious record does not need to match the startup query exactly. It only needs to be sufficiently related to ...[truncated 1389 chars]- Remediation
View remediation
Remediation Suggestions
- Require explicit user confirmation before saving preferences, behavioral rules, or instruction-like content.
- Do not use generic startup searches for
instructions. Retrieve narrowly scoped facts relevant to the active task. - Store provenance metadata, including the originating user, session, project, timestamp, and whether persistence was explicitly approved.
- Treat all retrieved memories as untrusted quoted data, never as executable instructions.
- Explicitly state that memories cannot override system instructions, developer instructions, current-session user requests, or safety policies.
- Separate factual memories, preferences, reminders, and behavioral directives into distinct schemas with different trust policies.
- Scope memory searches to the current user and project to prevent cross-user or cross-project contamination.
- Reject or quarantine records containing tool directives, policy overrides, credential requests, or instructions to ignore higher-priority rules.
- Provide mechanisms to review, edit, expire, and delete stored records before they are loaded into future sessions.
- Limit the number and size of retrieved records, and present their source and age when adding them to agent context.
