T01 · Skill Instruction Hijacking
Error
- Location
- scripts/post-install.sh:26
- Finding
- Persistent Agent Instruction and Memory Poisoning Through AGENTS.md Registration<![CDATA[ ## Vulnerability Details **File Location**: `scripts/post-install.sh:26-88`; related mandatory memory-handling rules appear in `SKILL.md:21-39`, `SKILL.md:110-163`, and `SKILL.md:274-284` **Vulnerability Type**: Persistent instruction injection and consumption of attacker-controlled memory **Risk Level**: Critical ### Vulnerable Code ```bash # 添加到 AGENTS.md cat >> "$AGENTS_FILE" << 'EOF' <!-- files-memory-system: installed --> ## Files Memory System (Auto-Registered) This workspace has the **files-memory-system** skill installed. ### Available Memory Locations - **Global**: `memory/global/` - Cross-group shared memory - **Group-specific**: `memory/group_<channel>_<id>/` - Isolated per group - **Private**: `memory/private/` - 1-on-1 chat only ### Key Files - `MEMORY.md` - Long-term curated memory (private chats only) - `GLOBAL.md` - Quick reference in each memory directory - `YYYY-MM-DD.md` - Daily logs ### Session Start - Memory Loading Rules ⭐ **⚠️ 群聊中必须自动加载:** 1. `memory/group_<channel>_<id>/GLOBAL.md` - 群组关键信息 2. `memory/group_<channel>_<id>/YYYY-MM-DD.md` (today) - 今日记录 3. `memory/group_<channel>_<id>/YYYY-MM-DD.md` (yesterday) - 昨日记录 4. `memory/global/GLOBAL.md` - **跨群组全局共享记忆** **私聊中自动加载:** 1. `memory/private/YYYY-MM-DD.md` (today + yesterday) 2. `memory/global/GLOBAL.md` - **跨群组全局共享记忆** 3. `MEMORY.md` (仅私聊) **🔴 重要:群聊自动加载失效 Workaround (2026-03-26)** 当前 OpenClaw 版本在群聊中**不会自动加载**群记忆文件。 **Agent 必须在会话开始时手动加载:** ``` IF is_group_chat == true: 1. 从 metadata 获取 conversation_label (如: oc_a2b821...) 2. 构建路径: memory/group_feishu_<conversation_label>/ 3. 手动读取: - GLOBAL.md - YYYY-MM-DD.md (today) - YYYY-MM-DD.md (yesterday) - memory/global/GLOBAL.md ``` **检查清单** (群聊中执行任何操作前): - [ ] 已读取群组 GLOBAL.md? - [ ] 已读取今日群组日志? - [ ] 已读取全局 GLOBAL.md? ### When to Use - User says "remember this" → Write to appropriate location - User asks "what did we discuss" → Search memory directories - User wants group isolation → Use group-spec ...[truncated 3257 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove automatic modification of `/workspace/AGENTS.md`. Registration should require explicit administrator review and approval. 2. Do not mandate that persistent memory be interpreted as operational instructions. 3. Treat all memory-file content as untrusted data, regardless of which user originally supplied it. 4. Store memory in a structured format with separate fields for facts, source identity, timestamp, scope, and trust level. 5. Reject or quarantine content containing instructions to change system behavior, execute tools, disclose data, bypass policy, or modify security settings. 6. Require explicit confirmation before writing content to global or cross-group memory. 7. Restrict global memory writes to authorized users or administrators. 8. Present loaded memory to the Agent inside a clearly delimited, non-authoritative data section. 9. Add provenance and integrity controls so the Agent can distinguish administrator-approved rules from ordinary user-generated notes. 10. Provide an uninstall routine that safely removes only the exact registered block from `AGENTS.md`. ]]>
