T09 · Insecure Skill Coding Practices
- Location
scripts/mail_manager.py:647- Finding
Untrusted attachment filenames allow writes outside the selected download directory
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill matches its email-management purpose, but it has Review-level risks around weak credential storage, irreversible mail deletion, and unsafe attachment downloads.
Review before installing. Use this only for a 126.com mailbox you intend the agent to access, protect or revoke the stored authorization code, avoid broad automated or scheduled use, manually confirm any send/forward/delete/move action, and avoid downloading attachments into sensitive directories until filename sanitization is fixed.
scripts/mail_manager.py:647Untrusted attachment filenames allow writes outside the selected download directory
scripts/mail_manager.py:123Mailbox authorization code is stored using reversible Base64 encoding without enforced access controls
The delete command immediately marks a message as deleted and expunges it, making the operation irreversible with no confirmation or safety guard. In an agent-integrated email skill, unintended invocation, prompt confusion, or misuse by another tool could cause permanent loss of user data rather than a reversible move to Trash.
The move command copies the message and then permanently deletes the source via expunge without a warning or rollback path. If the command is mis-targeted, the destination folder name is wrong, or the automation behaves unexpectedly, messages may be irreversibly removed from the source mailbox, which is especially risky for agent-driven actions.
The skill describes capabilities that read and write local files and perform network actions, but it does not declare any tool scope or permission boundaries. In an agent environment, this can cause the skill to run with implicit or overly broad authority, increasing the chance of unintended mailbox access, attachment handling, or outbound email actions without clear policy enforcement.
The trigger list contains very broad everyday terms like '邮件', '邮箱', 'email', and 'mail', making accidental invocation likely. Because this skill can read emails, send messages, delete mail, move mail, and download attachments, overbroad activation materially increases the risk of unintended sensitive actions in unrelated conversations or chained workflows.
The skill supports destructive actions like delete/move and externally transmitting actions like send/reply/forward, but the documentation provides no clear warning or mandatory confirmation requirements. In a mailbox context, mistaken or coerced execution could leak sensitive information, send unauthorized messages, or irreversibly alter user data.
The schema explicitly documents storing an email auth code in a local config file under the user's home directory, and only notes that it is Base64-encoded, which is not a security control. In a mail-management skill, this credential can grant mailbox access if the file is read by other local users, leaked via backups/logs, or exposed by another tool that accesses the same directory.
The attachment download schema describes writing files to an arbitrary output directory and returning full saved paths, but provides no warning about safe destination handling or risks from untrusted attachment filenames/content. In an email skill, attachments are attacker-controlled input, so unsafe writes can lead to overwriting files, placing dangerous content in sensitive locations, or encouraging downstream execution/opening of malicious files.
The tool persists mailbox credentials to disk in a JSON config file and only obfuscates the auth code with Base64, which is trivially reversible and provides no real protection. In an agent skill context, this is more dangerous because other local processes, users, backups, or chained skills may access the file and recover working email credentials without the user clearly understanding they were stored.
Attachment download writes attacker-controlled filenames from email content directly into a user-specified local directory with no sanitization or confirmation. A malicious sender can supply path traversal style names such as '../.bashrc' or absolute paths, potentially causing files to be written outside the intended download folder and overwriting sensitive local files in an automated agent workflow.
L235 明确写明所有操作通过命令行参数完成、无交互式输入,但 L067-L070 又说明在缺少授权码时要“主动引导”用户完成开通并提供授权码。这两处文档对技能交互方式的描述不一致:前者强调纯参数式 CLI,后者体现了面向用户的交互式凭据收集流程。
The natural-language interface, help text, and command messages are written entirely in Chinese, and the file provides no option to select another language or locale. This can violate language/locale policy where user opt-in or explicit locale scoping is required.