T02 · Agent Memory Poisoning
- Location
SKILL.md:39- Finding
Persistent Agent Memory Poisoning Through Untrusted Workspace Files
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 39-44; related behavior at lines 137-143, 165-175, and 283-287
Vulnerability Type: Persistent memory poisoning caused by treating writable workspace files as authoritative instructions
Risk Level: MediumVulnerable Code Snippets
markdown ## Source-of-Truth Hierarchy Use this hierarchy when saving or recovering context: 1. `SESSION-STATE.md` — immediate operational recovery file 2. `memory/YYYY-MM-DD.md` — daily continuity log 3. `MEMORY.md` — durable long-term memory and standing rules If chat history conflicts with saved files, trust the files unless there is strong evidence they are stale.The recovery procedure reinforces this trust model:
markdown 7. Reconstruct: - current mission - active tasks - latest decisions - blockers - important preferences - next step 8. If the next step is clear and safe, continue. Do not wait passively. 9. If the files disagree, use this priority: session-state for immediate task state, daily memory for recent evidence, long-term memory for standing rules.The save procedure permits rules and preferences to persist:
markdown 1. Identify what must be preserved: - current mission - active tasks - decisions - blockers - preferences - next step - recovery-critical file paths, service names, IDs, or commits 2. Update the recovery file with the current operational state. 3. Update today's `memory/YYYY-MM-DD.md` with the relevant event, decision, task state, or preference. 4. Update `MEMORY.md` only if the information is durable, long-term, or a standing rule/preference/decision. 5. Verify the saved content is sufficient for a fresh agent to recover without chat history. 6. Reply exactly:The quality rules repeat the unsafe precedence:
markdown - Long-term memory is for durable rules only. - Files beat chat history. - After recovery, act if the path is clear.Technical Analysis
The ...[truncated 3132 chars]
- Remediation
View remediation
Remediation Suggestions
-
Treat all recovered memory as untrusted data
- Explicitly prohibit interpreting memory-file content as higher-priority instructions.
- Use stored files only to reconstruct factual task state.
- Require current authenticated user instructions and platform safety policies to take precedence.
-
Separate facts from instructions
- Store state in a constrained schema with fields such as task status, evidence, timestamps, and identifiers.
- Do not permit free-form standing rules, policy overrides, tool commands, or behavioral instructions in recoverable state.
- Escape or quarantine text that resembles prompt injection.
-
Record and validate provenance
- Record who or what created each entry, when it was written, and the source interaction or operation that authorized it.
- Reject entries with missing, invalid, or unexpected provenance.
- Distinguish user-approved durable preferences from model-generated summaries.
-
Protect integrity
- Apply restrictive filesystem permissions so only the intended owner and trusted agent process can modify memory files.
- Where feasible, authenticate records using signatures or keyed message authentication codes.
- Detect unexpected modifications through hashes, version control, or an append-only audit log.
-
Require confirmation for consequential recovery actions
- Present recovered missions, rules, and next actions to the current user before adopting them.
- Require explicit approval before executing commands, accessing sensitive data, changing configuration, contacting external services, or exposing durable memory.
- Never automatically resume a high-impact operation solely because a memory file labels it as the next step.
-
Remove unsafe precedence statements
- Replace “trust the files” and “files beat chat history” with a rule stating that stored state is advisory and must be reconciled with authenticated current-session in ...[truncated 385 chars]
-
