T02 · Agent Memory Poisoning
- Location
SKILL.md:37- Finding
Persistent Agent Memory and Instruction Poisoning Through Conversation-Derived Rules
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:37-38,SKILL.md:44-55,SKILL.md:62-76,references/templates.md:12,references/templates.md:35-46, andreferences/templates.md:48-55
Vulnerability Type: Persistent memory poisoning and instruction-file modification
Risk Level: HighRelevant Snippets
The following is a faithful English translation of the relevant instructions in
SKILL.md:37-38:markdown 3. Check for duplicates before writing: before writing, search user-profile.md, the experience library, and the project's CLAUDE.md. If an entry conflicts with an old entry, update the old entry instead of adding a new one. 4. Keep entries concise: the "general rule" field must be one line and directly executable by the AI.The following is a faithful English translation of the persistence workflow in
SKILL.md:44-55:markdown 1. Review the current conversation's editing history, failed approaches, and user feedback. 3. Draft one to three candidate experiences and profile updates: - Personal general experience: ~/.claude/experience/general/<topic>.md - Project experience: the "Experience and Pitfalls" section of the current project's CLAUDE.md - Domain experience: ~/.claude/skills/<domain>-experience/ 5. Write: - Merge personal experience into the global experience store. - Append project experience to the project's CLAUDE.md. - Write domain experience into the corresponding domain skill. - Incrementally merge profile information into ~/.claude/user-profile.md.The following is a faithful English translation of the global scope and self-modification behavior in
SKILL.md:62-76:markdown | User profile | ~/.claude/user-profile.md | All projects; imported by the global CLAUDE.md | | Project experience | Project CLAUDE.md | Current project only | If the distilled experience conce ...[truncated 3719 chars]- Remediation
View remediation
Remediation Suggestions
- Store distilled experience as inert, structured data outside automatically loaded instruction files.
- Do not write conversation-derived content to
CLAUDE.md,SKILL.md, domain Skill instructions, or any globally imported profile. - Separate descriptive facts from executable instructions. Remove the requirement that a general rule be directly executable by the AI.
- Enforce a strict schema with allowlisted fields and reject imperative directives, tool-use instructions, policy overrides, hidden prompts, and references to unrelated files or commands.
- Require separate, explicit confirmation for each destination, clearly displaying whether the scope is project-local, domain-wide, or global.
- Treat global writes and Skill self-modification as privileged operations requiring an independent approval step.
- Prohibit automatic self-modification of
SKILL.mdandreferences/templates.md. Changes to Skill instructions should use a reviewed development process. - Keep immutable audit records containing the source conversation, normalized entry, destination, timestamp, approval, and previous file state.
- Provide atomic rollback for every persistence operation and show a complete diff before writing.
- During maintenance, never replace or merge trusted instructions solely through semantic similarity. Require review of each proposed change and preserve the original entry.
- Apply least-privilege filesystem controls so the Skill can only write to a dedicated data directory and cannot modify Agent instruction files.
