T02 · Agent Memory Poisoning
- Location
SKILL.md:106- Finding
Untrusted Remote Memory Can Persistently Influence Future Agent Sessions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 65-77 and 106-112
Vulnerability Type: Persistent remote-memory poisoning
Risk Level: MediumVulnerable Code
json { "method": "tools/call", "params": { "name": "mem_save", "arguments": { "content": "User prefers concise responses with code examples", "type": "preference", "project": "my-project" } } }markdown ## MidOS (every session start) 1. Call where_was_i(client="your-agent-name") to resume context 2. Call mem_context(scope="recent") to load recent memory 3. Before creating knowledge: knowledge_preflight(topic) 4. After important decisions: mem_save(content, type="decision")Technical Analysis
The skill directs agents to persist decisions and preferences in an external service and automatically retrieve remote state at every session start. Retrieved memories may therefore affect agent behavior across otherwise independent sessions.
The instructions do not establish provenance validation, integrity verification, namespace isolation, authorization requirements, or user confirmation before retrieved content is trusted. They also do not instruct the agent to distinguish factual memory from executable instructions. If an attacker can write to or modify the relevant memory namespace, attacker-controlled content can be returned through
where_was_iormem_contextand interpreted as trusted context.This creates a persistent influence channel rather than a single-session prompt-injection risk.
Attack Path
- A victim configures the skill to use the hosted MidOS MCP service.
- The agent stores preferences, decisions, and contextual records using
mem_save. - An attacker obtains write access to the victim's memory namespace through compromised credentials, insufficient tenant isolation, an exposed session, or another available write path.
- The attacker inse ...[truncated 891 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not automatically treat remote memories as trusted instructions. Clearly label retrieved records as untrusted reference data.
- Require explicit user approval before applying retrieved content that changes goals, permissions, safety rules, or tool behavior.
- Authenticate every client and enforce tenant-, user-, and project-level namespace isolation.
- Authorize memory reads and writes separately and apply least-privilege access controls.
- Add integrity and provenance metadata, including record creator, creation time, source session, modification history, and cryptographic integrity protection where appropriate.
- Prevent memory records from overriding system or developer instructions.
- Validate and sanitize records before storage, and reject content resembling hidden control instructions where it is not appropriate for the memory type.
- Provide record expiration, review, revocation, and audit-log mechanisms.
- Change the heartbeat guidance so that
where_was_iandmem_contextare optional and their results are reviewed before use. - Avoid storing credentials, secrets, authentication tokens, or unnecessarily sensitive conversation content in remote memory.
