T02 · Agent Memory Poisoning
- Location
SKILL.md:165- Finding
Unnecessary Persistence of User-Controlled Workflow Data in Agent Memory
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:165-168
Additional Location:references/workflow_guide.md:161-166
Vulnerability Type: Persistent agent-memory poisoning
Risk Level: MediumVulnerable Code Snippets
From
SKILL.md:markdown ### Step 5: Finalize (完成) 1. **Package the skill** using `scripts/package_skill.py` from skill-creator 2. **Update MEMORY.md** with the new skill info 3. **Notify user** - Skill is ready for useFrom
references/workflow_guide.md:markdown ## Iteration Pattern **每次用户反馈后:** 1. 记录反馈内容到 memory/2026-03-15.md 2. 修改代码/文档 3. 重新呈现结果 4. 等待确认Technical Analysis
The skill instructs the agent to write newly generated skill information and user feedback into persistent memory files. Workflow discovery can collect user-controlled content such as file paths, data schemas, business rules, operational instructions, and generated skill behavior.
The instructions impose no restrictions on which fields may be stored, do not require user consent, and provide no validation or sanitization before persistence. Because the persisted content may be loaded in later sessions, an attacker can provide workflow descriptions or feedback containing crafted instructions that become durable agent state.
Persistent memory updates are not required for the skill's stated core functions of discovering requirements, generating a skill, testing it, and packaging it.
Attack Path
- An attacker invokes the workflow-building skill.
- During discovery or feedback, the attacker supplies crafted workflow content containing instructions intended to influence subsequent agent behavior.
- The skill follows its documented finalization or iteration process and records the new skill information or feedback in
MEMORY.mdor a file undermemory/. - A later agent session loads or consults that persistent memory.
- The attacker-controlled content can then influence later decisions or behavior beyond the original ...[truncated 716 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the automatic instruction to update
MEMORY.mdor files undermemory/. - Store workflow-specific metadata within the generated skill's own directory rather than in global agent memory.
- If persistence is genuinely needed, require explicit and informed user consent before every write.
- Apply strict data minimization: retain only a short identifier and non-sensitive status metadata.
- Reject or neutralize executable instructions, role directives, tool commands, and prompt-like content before persistence.
- Define retention and deletion controls so users can inspect and remove stored information.
- Keep sensitive paths, credentials, business data, schemas, and raw feedback out of long-term memory.
- Ensure later sessions treat persisted text as untrusted data rather than authoritative instructions.
- Remove the automatic instruction to update
