T01 · Skill Instruction Hijacking
- Location
scripts/imap_client.py:186- Finding
Untrusted Email Content Is Passed Directly to the AI Agent for Interpretation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly coherent for reading email and creating calendar reminders, but it has Review-worthy risks around automatic processing of untrusted email, insecure IMAP configuration, and Keychain command handling.
Install only if you are comfortable granting the skill access to selected mailboxes and Calendar. Keep IMAP set to ssl:true, use app-specific mailbox passwords, configure a sender allowlist before automatic scans, review created events, and prefer fixing the Keychain account validation/security command construction before broad use.
scripts/imap_client.py:186Untrusted Email Content Is Passed Directly to the AI Agent for Interpretation
scripts/imap_client.py:148Plaintext IMAP Authentication Can Expose Mailbox Credentials and Email Content
scripts/keychain.py:19Newline Injection in Interactive Keychain Commands Allows Unintended Keychain Operations
代码行为与描述部分重合:确实会在 macOS 系统日历中创建事件、设置提醒、做跨日历去重,并支持查询本技能创建的事件,基本符合“写入日历并设置提醒/查询最近提醒”的一部分。但描述声称支持从截图、邮件中提取事项,以及多邮箱定时扫描与跨账户去重;当前代码中完全没有邮件访问、截图/OCR、自然语言解析、定时扫描或运行状态管理相关实现。所谓“跨账户去重”在代码里只是遍历名称前缀匹配的多个日历查找 description 中的 UID,并非邮箱账户级扫描能力。因此该代码块更像是底层日历集成模块,而不是描述中的完整技能能力,存在明显的描述-行为不一致。
声明描述的核心能力是把事项写入 macOS 系统日历并设置提醒,并支持提醒查询/运行状态查看。该代码片段实际仅处理邮箱读取相关流程:连接 IMAP、只读选择邮箱文件夹、搜索 UID、抓取邮件、清洗正文、解析 .ics 附件,以及列出/读取邮件。虽然“支持多邮箱定时扫描”中的邮箱扫描部分与整体产品方向部分相关,但此代码本身没有任何日历 API、提醒创建、macOS 系统日历写入、跨账户去重、截图解析、自然语言提取日程,或查询最近创建提醒/运行状态的实现。因此该代码的实际行为与声明用途存在明显不一致,属于未声明的邮箱读取能力且缺失所宣称的核心日历写入能力。
The declared description presents a calendar/reminder automation skill with email scanning and deduplication features. The supplied code chunk is only a journaling helper for writing, reading, and clearing local JSONL records on disk. While journaling could be a supporting component of a larger system, this specific chunk’s actual behavior is materially different from the declared end-user functionality and also introduces an undeclared filesystem logging capability. Therefore this code chunk does not accurately represent the declared purpose on its own.
声明的核心能力是创建 macOS 日历提醒、解析日程信息并支持邮箱扫描/去重与提醒查询;而该代码片段的实际职责是报告渲染与落盘,属于运行日志/状态输出模块。虽然“查询运行状态”与生成运行报告有一定相关性,但该片段没有实现所声明的主要功能,例如解析输入、访问日历、创建提醒、扫描邮箱或执行去重,仅消费已有 records 生成 Markdown。因此该代码行为与描述的主要目的存在明显不匹配。
声明描述的是一个日程/提醒自动化技能,核心能力应包括解析用户输入或邮件内容、访问 macOS 日历/提醒服务、创建事件、设置提醒,以及可能的邮箱扫描和去重逻辑。但提供的代码块仅是一个通用且受限的 YAML 解析器,负责把文本配置解析成 Python 数据结构。它既没有任何与日历、提醒、邮件、OCR/截图处理、系统 API、网络/邮箱访问相关的行为,也没有体现声明中的触发场景。YAML 解析器最多只能算配置层面的辅助实现细节,但当前代码块本身与声明的主要功能严重不符,因此应判定为描述与实际行为不匹配。
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# never-miss 配置(本文件不含密码——密码只存 macOS Keychain)
# 数据目录:本文件所在目录即数据根目录;paths.data 须与其一致(勿改动)
timezone: Asia/Shanghai
This duplicated finding points to the same risk: error handling after Keychain writes may surface unsanitized stderr from a secret-bearing command path. In a skill that handles email credentials, even low-probability leakage through logs materially increases risk because compromise of an IMAP password can expose mailbox contents and scheduling data.
SERVICE, _quote(email), _quote(password))
proc = _run_interactive(line)
if proc.returncode != 0:
raise KeychainError('E_KEYCHAIN', '写入 Keychain 失败:%s' % (proc.stderr or '').strip())
def get_secret(email):
This duplicated finding points to the same risk: error handling after Keychain writes may surface unsanitized stderr from a secret-bearing command path. In a skill that handles email credentials, even low-probability leakage through logs materially increases risk because compromise of an IMAP password can expose mailbox contents and scheduling data.
SERVICE, _quote(email), _quote(password))
proc = _run_interactive(line)
if proc.returncode != 0:
raise KeychainError('E_KEYCHAIN', '写入 Keychain 失败:%s' % (proc.stderr or '').strip())
def get_secret(email):