T02 · Agent Memory Poisoning
- Location
SKILL.md:62- Finding
Unvalidated persistent preferences can influence future agent behavior
- Content
View full analysis
--key --val ``` ### Iteration rules - **Important user preferences** → Write them to `learned_patterns.json` and apply them directly during the next invocation, reducing repeated questions. ``` The corresponding implementation accepts unrestricted keys and values and persists them: ```python def record_preference(skill_dir, key, value): data = load_learning(skill_dir) data["preferences"][key] = value save_learning(skill_dir, data) return data ``` ```python p_pre = sub.add_parser("prefer"); p_pre.add_argument("skill_dir") p_pre.add_argument("--key", required=True); p_pre.add_argument("--val", required=True) ``` ```python elif args.cmd == "prefer": record_preference(sd, args.key, args.val) print("✅ Preference recorded") ``` ### Technical Analysis The `prefer` command accepts arbitrary strings for both the preference key and value. The values are written to persistent state without a schema, allowlist, provenance marker, expiration policy, or distinction between harmless presentation preferences and behavioral instructions. The persistence mechanism alone does not execute the stored text. The security boundary is crossed by the instruction in `SKILL.md` telling future agents to apply important stored preferences directly. An attacker can therefore present an instruction as a preference, such as a rule to ignore valida ...[truncated 1589 chars]- Remediation
View remediation
