T02 · Agent Memory Poisoning
- Location
scripts/init.sh:12- Finding
Persistent Agent Behavior Injection Through Long-Term Memory Initialization
- Content
View full analysis
"$WORKSPACE_ROOT/MEMORY.md" << 'EOF' # MEMORY.md ## 长期认知(持续生效) 1. **提醒类任务先执行后汇报**:遇到"复盘/检查/整理"这类提醒,优先产出实际结果(文件或结论),再给用户状态更新。 2. **长文本先做完整性校验**:对榜单、日志、抓取结果等长输入,先判断是否被截断;若不完整,必须显式声明并提供补全路径。 3. **承诺即闭环,杜绝"只回复不落地"**:说"我来做"后必须在同一轮工具调用中完成产出(文件/结果),不得留到下一轮 session。 4. **Session 自动压缩 + 自动切换**:token 达到 150k 或上下文达到 80% 时触发,先压缩再输出新会话切换提示。 5. **关键时机自动写入记忆**:完成任务、做出决策、变更配置、解决问题时立即写入记忆,不等 session 结束。 6. **新 session 智能加载记忆**:启动时根据频道和任务自动加载相关记忆,避免重复询问已知信息。 ## 配置记录 _待补充_ EOF ``` ### Technical Analysis The initialization procedure does not create only an empty memory structure. It writes author-controlled behavioral directives into `MEMORY.md` and labels them as continuously effective long-term cognition. The Skill documentation directs the Agent to load `MEMORY.md` in later sessions. Consequently, these rules can continue to influence Agent behavior after initialization. The directives also encourage automatic memory collection at task completion, decision, configuration-change, and problem-resolution points. This crosses the boundary between implementing memory storage and supplying persistent instructions that govern unrelated future Agent behavior. Because the content is placed in long-term state rather than remaining local to the current Skill invocation, it constitutes persistent memory poisoning. ### Attack Path 1. A user installs the Skill and runs the documented `scripts/init.sh` command. 2. The script resolves the workspace root and creates `MEMORY.md` if it does not already exist. 3. The script inserts its predefined behavioral rules into that persistent file. 4. The documented session-start process causes later Agent sessions to read `MEMORY.md`. 5. Future sessions continue appl ...[truncated 571 chars]- Remediation
View remediation
