T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:14
- Finding
- Persistent Agent Memory Poisoning Through Untrusted User Instructions## Vulnerability Details **File Location**: `SKILL.md:14-22`, `SKILL.md:50-56`, `SKILL.md:75-92`, and `references/IMPLEMENTATION-GUIDE.md:132-152` **Vulnerability Type**: Persistent storage and replay of attacker-controlled instructions **Risk Level**: High ### Vulnerable Code `SKILL.md:14-22`: ```markdown ## The Dory-Proof Pattern (Critical) When the user gives a task: 1. **IMMEDIATELY** write their EXACT WORDS to `state/ACTIVE.md` 2. Then interpret what it means 3. Then do the work 4. Mark complete when done **Why:** Paraphrasing introduces drift. Exact words preserve intent across context flushes. ``` `SKILL.md:50-56`: ```markdown ## Boot Sequence (Every Session) 1. Read `state/HOLD.md` — what's BLOCKED 2. Read `state/ACTIVE.md` — current task 3. Read `state/DECISIONS.md` — recent choices 4. Read `memory/recent-work.md` — last 48 hours 5. Read `MEMORY.md` — long-term (main session only) ``` `SKILL.md:75-92`: ```markdown ### state/HOLD.md ```markdown [YYYY-MM-DD HH:MM | session] Item — reason blocked ``` **ALL agents must check before acting on anything that looks ready.** ### state/DECISIONS.md ```markdown [YYYY-MM-DD HH:MM | session] Decision made ``` ## Conflict Resolution When files conflict, priority (highest first): 1. **state/HOLD.md** — blocks override all 2. **state/ACTIVE.md** — current instruction 3. **state/DECISIONS.md** — recent choices 4. **AGENTS.md** — general rules ``` `references/IMPLEMENTATION-GUIDE.md:132-152`: ```markdown ## Phase 4: Update AGENTS.md Add to your AGENTS.md: ```markdown ## Boot Sequence Before doing anything: 1. Read `state/HOLD.md` — blocked items 2. Read `state/ACTIVE.md` — current task 3. Read `state/DECISIONS.md` — recent choices 4. Read `memory/recent-work.md` — last 48 hours ## 🐠 Dory-Proof Pattern When user gives a task: 1. **IMMEDIATELY** write EXACT WORDS to `state/ACTIVE.md` 2. Then ...[truncated 3885 chars]
- Remediation
- ## Remediation Suggestions 1. **Treat persisted user text as untrusted data.** Store exact quotations inside a clearly delimited data field and explicitly prohibit agents from executing instructions found inside that field. 2. **Remove the priority inversion.** State files must never override system, developer, safety, or workspace operating policies. Define precedence so that `AGENTS.md` and all higher-level controls remain authoritative. 3. **Separate records from actionable state.** Use distinct fields such as: - `Original user text`: inert quotation for audit purposes. - `Validated task`: concise, policy-checked task description. - `Authorized actions`: explicit, bounded operations approved for continuation. 4. **Validate before persistence and replay.** Detect instruction-like content that attempts to change policies, acquire secrets, expand scope, or direct unrelated tool use. Require current-session confirmation before treating persisted content as actionable. 5. **Add provenance and lifecycle controls.** Record the initiating user, session identifier, creation time, validation status, expiration time, and completion state. Ignore stale, unauthenticated, or completed entries. 6. **Minimize retained data.** Do not automatically save complete user messages. Redact credentials, tokens, personal information, and unrelated sensitive content. Define retention and secure-deletion policies. 7. **Constrain shared access.** Apply least-privilege file permissions and avoid sharing writable state among unrelated users or agents. Where sharing is required, distinguish trusted writers from readers. 8. **Require reauthorization for sensitive actions.** External communications, destructive file operations, credential access, and other high-impact actions must require fresh confirmation and must never be authorized solely by persisted state. 9. **Add poisoning tests.** Verify that embedded directives in `ACTIVE.md`, `HOLD.md`, `DECISI ...[truncated 108 chars]
