T02 · Agent Memory Poisoning
- Location
- SKILL.md:31
- Finding
- Persistent Prompt Injection Through Employee Memory## Vulnerability Details **File Location**: `SKILL.md:31-34`; related execution flow in `routing.md:43-48` and write behavior in `lifecycle.md:28-39` **Vulnerability Type**: Persistent memory poisoning **Risk Level**: High ### Vulnerable Code `SKILL.md:31-34` ```markdown ### 2. Memory is Mandatory - Load `memory/context.md` before every task - Employees remember context across sessions - Log learnings after each task ``` `routing.md:43-48` ```text 1. Load employee.json → get config 2. Load skill (linked/embedded/clawhub) 3. Inject memory/context.md as context 4. Spawn as subagent with employee's model 5. Execute task 6. Log to logs/YYYY-MM-DD.md ``` `lifecycle.md:28-39` ```markdown ## Train **Syntax:** `train {name} on [documents/context]` **Actions:** - Append to `memory/context.md` - Optionally create domain-specific files - Update employee stats **Example:** ``` User: "Train Luna on our company style guide" ``` ### Technical Analysis The Skill permits content derived from arbitrary documents or context to be appended to persistent employee memory. That memory is subsequently injected into the subagent context before every task. The design does not require: - Separation of factual data from executable instructions. - Prompt-injection detection or instruction filtering. - Source provenance and trust classification. - Human approval before new persistent rules become active. - Integrity protection or review of later memory modifications. - A rule that memory content must be treated as untrusted reference data. Consequently, an attacker-controlled training document can contain instructions that are persisted as memory and interpreted as authoritative behavioral guidance in future sessions. The vulnerability crosses session boundaries because the poisoned content remains in `memory/context.md`. ### Attack Path 1. An attacker creates or modifies a document that ...[truncated 1140 chars]
- Remediation
- ## Remediation Suggestions 1. Treat all training documents and retrieved content as untrusted data rather than instructions. 2. Extract memory into a structured schema containing facts, preferences, source identifiers, timestamps, and trust levels. 3. Reject or quarantine imperative language, tool-use requests, policy changes, encoded content, and instructions directed at the agent. 4. Require explicit human approval before persistent memory is created or changed. 5. Delimit injected memory with an instruction stating that it is non-authoritative reference material and cannot modify system policies, permissions, or task goals. 6. Preserve source provenance and provide a reviewable diff for every memory update. 7. Apply integrity checks and maintain version history so poisoned changes can be detected and rolled back. 8. Restrict the employee's runtime permissions independently of prompt instructions so poisoned memory cannot grant itself additional capabilities.
