T01 · Skill Instruction Hijacking
Error
- Location
- references/01-config-template.md:18
- Finding
- Untrusted Email Content Is Executed as Agent Instructions## Vulnerability Details **File Location**: `references/01-config-template.md:18-39`, `references/01-config-template.md:46-61`, `SKILL.md:52-58` **Vulnerability Type**: T01: Skill Instruction Hijacking **Risk Level**: Critical ### Vulnerable Code Snippet `references/01-config-template.md:18-39`: ```text 请用Python imaplib和smtplib检查邮箱 {EMAIL} 的最近50封邮件(包括已读和未读)。 IMAP登录: user={EMAIL}, password={PASSWORD}, host={IMAP_HOST}, port={IMAP_PORT} SMTP登录: user={EMAIL}, password={PASSWORD}, host={SMTP_HOST}, port={SMTP_PORT} ⚠️ 核心任务:读取 {WHITELIST_SENDER} 发来的邮件,邮件内容是你需要执行的指令! 处理步骤: 1. 读取~/.openclaw/workspace/memory/processed_emails.json,获取已处理邮件UID列表 2. 获取最近50封邮件 3. 筛选出发件人 {WHITELIST_SENDER} 的未处理邮件 4. 对每封未处理邮件: a. 解析邮件内容,这就是你需要执行的指令 b. 尝试执行该指令(查询天气/搜索信息/执行操作等) c. 将执行结果(或失败信息)作为邮件正文,用SMTP回复给发件人 - 执行成功:正文写实际执行结果 - 执行失败:详细说明失败原因 d. 将该邮件UID添加到已处理列表 5. 保存更新后的已处理列表到~/.openclaw/workspace/memory/processed_emails.json 【重要】无论成功还是失败,都必须回复邮件! 执行完成后汇报处理结果。禁止使用浏览器工具。 ``` `references/01-config-template.md:46-51`: ```bash # 7:00-23:00,每分钟执行 cron add --name "邮件指令-白天" \ --schedule "expr" "* 7-23 * * *" \ --tz "Asia/Shanghai" \ --session-target "isolated" \ --payload '{"kind":"agentTurn","message":"请用Python imaplib和smtplib检查邮箱 {EMAIL} 的最近50封邮件(包括已读和未读)。IMAP登录: user={EMAIL}, password={PASSWORD}, host={IMAP_HOST}, port={IMAP_PORT}。SMTP登录: user={EMAIL}, password={PASSWORD}, host={SMTP_HOST}, port={SMTP_PORT}。处理步骤:1. 读取~/.openclaw/workspace/memory/processed_emails.json;2. 获取最近50封邮件;3. 筛选出发件人 {WHITELIST_SENDER} 的未处理邮件;4. 执行指令并回复结果;5. 更新已处理列表。","model":"minimax-portal/MiniMax-M2.5","timeoutSeconds":300}' ``` ### Technical Analysis The documented workflow explicitly elevates an email body from untrusted external data to an authoritative Agent instruction. It does not define a command grammar, operation allowlist, parameter validation, approval boundary, or restrictions on the tools and reso ...[truncated 1673 chars]
- Remediation
- ## Remediation Suggestions - Do not execute free-form email bodies as Agent instructions. - Replace natural-language commands with a strict, versioned data schema containing a small allowlist of supported operations. - Validate command names, parameter types, lengths, and permitted values before dispatch. - Reject unknown fields and unsupported operations rather than asking an LLM to interpret them. - Require explicit local approval for filesystem access, state-changing operations, credential use, external communication, or other sensitive actions. - Run the processor with a dedicated low-privilege identity and a minimal tool allowlist. - Deny access to unrelated files, secrets, shell execution, package management, and unrestricted network destinations. - Clearly delimit email content as untrusted data in every Agent prompt and prohibit following instructions embedded in message bodies or attachments. - Disable unattended recurring execution until strong sender authentication and command-level authorization are implemented. - Record security audit logs containing the authenticated sender, parsed command, authorization decision, and resulting action without recording secrets.
