T02 · Agent Memory Poisoning
- Location
references/merge-protocol.md:30- Finding
Unvalidated User Corrections Can Be Written into Persistent Agent State
- Content
View full analysis
Vulnerability Details
File Location:
references/merge-protocol.md, lines 30-45
Vulnerability Type: Persistent instruction poisoning
Risk Level: HighVulnerable Instruction Snippet
The following is an English rendering of the operative instructions:
markdown When the user says "incorrect," the following actions are mandatory: 1. Briefly acknowledge the error. 2. Immediately record it in MEMORY.md with a [LEARN] tag. 3. Correct the corresponding error in the do-file, if present. 4. Apply the correction continuously in similar future situations. MEMORY.md entry format: ## [LEARN] 2025-12-01 — Standard-error clustering level - Context: DiD analysis with panel data - Error: Clustered at the individual rather than state level - Correction: Use cluster(state_id) rather than cluster(id) - Reason: Treatment is correlated within statesA related instruction appears in
references/workflow-quickref.md, lines 102-104:markdown When the user provides a correction, record it in MEMORY.md, TOOLS.md, or CLAUDE.md.Technical Analysis
The workflow directs the agent to persist user-provided corrections without requiring validation, sanitization, or explicit approval of the exact stored content. It also permits writes to
CLAUDE.mdandTOOLS.md, which may contain durable behavioral or tool-use instructions loaded in later sessions.A malicious user could present an attacker-controlled behavioral rule as a correction. If the rule is copied into persistent state, it can influence future sessions after the original interaction has ended. The risk is especially significant for
CLAUDE.md, because that file may function as project-level agent instructions rather than as a passive research log.Attack Path
- An attacker tells the agent that an existing workflow rule is “incorrect.”
- The attacker embeds a new behavioral directive in the purported correction.
- The Skil ...[truncated 712 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove all automatic writes to
CLAUDE.md,TOOLS.md, and other agent instruction files. - Store lessons only in a dedicated passive file such as
quality_reports/proposed-learnings.md. - Require explicit user confirmation of the exact sanitized entry before writing it.
- Restrict entries to project facts, such as variable definitions or validated statistical conventions.
- Reject content containing tool directives, role changes, security-policy changes, external commands, secrets, or instructions for future sessions.
- Add provenance fields recording who proposed the correction, when it was validated, and what evidence supports it.
- Treat persistent learning files as untrusted data when loaded; never interpret their contents as higher-priority instructions.
- Remove all automatic writes to
