T02 · Agent Memory Poisoning
- Location
SKILL.md:14- Finding
Persistent Agent Memory Poisoning Through Untrusted User Instructions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:14-22,SKILL.md:50-56,SKILL.md:75-92, andreferences/IMPLEMENTATION-GUIDE.md:132-152
Vulnerability Type: Persistent storage and replay of attacker-controlled instructions
Risk Level: HighVulnerable 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 blockedALL agents must check before acting on anything that looks ready.
state/DECISIONS.md
markdown [YYYY-MM-DD HH:MM | session] Decision madeConflict Resolution
When files conflict, priority (highest first):
- state/HOLD.md — blocks override all
- state/ACTIVE.md — current instruction
- state/DECISIONS.md — recent choices
- AGENTS.md — general rules
text `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
View remediation
Remediation Suggestions
-
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.
-
Remove the priority inversion. State files must never override system, developer, safety, or workspace operating policies. Define precedence so that
AGENTS.mdand all higher-level controls remain authoritative. -
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
Add poisoning tests. Verify that embedded directives in
ACTIVE.md,HOLD.md, `DECISI ...[truncated 108 chars]
-
