T02 · Agent Memory Poisoning
- Location
SKILL.md:45- Finding
Untrusted conversation content can poison persistent agent memory
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:45-59; supporting implementation insrc/memory.py:180-218andsrc/memory.py:383-410
Vulnerability Type: Persistent memory poisoning
Risk Level: MediumVulnerable Code
markdown ## Integration with Clawdbot Add to your AGENTS.md or HEARTBEAT.md: ```markdown ## Memory Protocol On session start: 1. Load recent lessons: `mem.get_lessons(limit=5)` 2. Check entity context for current task 3. Recall relevant facts On session end: 1. Extract durable facts from conversation 2. Record any lessons learned 3. Update entity informationtext The corresponding storage operation accepts arbitrary content without a trust or review state: ```python def remember(self, content: str, tags: List[str] = None, source: str = "conversation", confidence: float = 1.0, expires_in_days: int = None) -> str: """ Store a fact in memory. Args: content: The fact to remember tags: Categories/labels for the fact source: Where this fact came from (conversation, observation, inference) confidence: How confident we are (0-1) expires_in_days: Auto-expire after N days (None = never) Returns: The fact ID """ fact_id = self._generate_id(content) now = self._now() tags = tags or [] expires_at = None if expires_in_days: expires_at = (datetime.utcnow() + timedelta(days=expires_in_days)).isoformat() conn = sqlite3.connect(self.db_path) cursor = conn.cursor() cursor.execute(""" INSERT INTO facts (id, content, tags, source, confidence, created_at, last_accessed, access_count, expires_at) VALUES (?, ?, ?, ?, ?, ?, ?, 1, ?) """, (fact_id, content, json.dumps(tags), source, confidence, now, now, expires_at)) cursor.execute(""" I ...[truncated 3534 chars]- Remediation
View remediation
Remediation Suggestions
- Treat all recalled facts, lessons, and entity attributes as untrusted data rather than executable instructions.
- Add immutable provenance fields, including origin identity, conversation identifier, ingestion method, creation actor, and whether the content was user-approved.
- Introduce trust states such as
unreviewed,verified, andrejected; only load verified behavioral lessons into agent context. - Require explicit user confirmation before persisting rules, credentials, security decisions, tool-use policies, or other behavior-changing material.
- Detect and quarantine instruction-like records, especially content containing requests to ignore constraints, invoke tools, reveal secrets, or modify future behavior.
- Render recalled records inside explicit data delimiters with a system-level instruction that memory content must never override current policies or higher-priority instructions.
- Restrict the startup protocol to narrowly relevant, trusted records instead of automatically loading recent lessons.
- Provide interfaces to inspect, audit, correct, and delete stored records, including the ability to identify every record created from a particular conversation.
- Add tests demonstrating that attacker-supplied instructions are not automatically promoted into trusted long-term guidance.
