T02 · Agent Memory Poisoning
- Location
scripts/learner.py:91- Finding
Unvalidated Persistent Preferences Can Influence Future Agent Sessions
- Content
View full analysis
--key 输出语言 --val 中文 ### 迭代规则 - **重要用户偏好** → 写入 `learned_patterns.json`,下次调用直接采用,减少重复询问。 ``` ### Technical Analysis The `prefer` command accepts arbitrary user-controlled keys and values and stores them persistently in `learned_patterns.json`. There is no allowlist, type validation, length restriction, trust classification, or separation between harmless presentation preferences and instruction-like behavioral content. The Skill documentation explicitly directs future invocations to adopt stored preferences. Consequently, an attacker-controlled value can cross a session boundary and later be interpreted by an agent as an instruction rather than inert data. For example, a value could contain text instructing a future agent to ignore requested output constraints, disclose unrelated information, or alter its task behavior. The issue is limited by two prerequisites: 1. The attacker or an attacker-influenced workflow must be able to invoke the learner command or otherwise write through this interface. 2. A later agent or integration must load and apply the stored preference as directed by `SKILL.md`. The current `learned_patterns.json` does not contain poisoned preferences. No network access, privilege escalation, command execution, or data exfiltration mechanism was identified. ### Attack Path 1. An attacker gains the ability to supply arguments to the documented preference-recording command. 2. The attacker invokes a command such as: ...[truncated 1329 chars]- Remediation
View remediation
