T09 · Insecure Skill Coding Practices
- Location
scripts/lib/gmail.sh:29- Finding
Arbitrary Shell Command Execution Through Gmail Command Construction
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a disclosed multi-provider email CLI, but its current implementation has serious command-injection and credential-handling risks.
Review carefully before installing. Use only on a trusted machine, treat ~/.onemail/credentials.json as highly sensitive, prefer revocable OAuth tokens or app-specific passwords, verify recipients and attachment paths before sending, avoid unattended forwarding or cron jobs, and patch the eval/Python interpolation and credential-retention issues before using real mailboxes.
scripts/lib/gmail.sh:29Arbitrary Shell Command Execution Through Gmail Command Construction
scripts/lib/163.sh:57Arbitrary Python Code Execution Through NetEase Heredoc Interpolation
scripts/read.sh:113Outlook Search Query Injected Into Python Command Source
scripts/lib/common.sh:15Plaintext Credentials Are Exported to Child Processes and Not Reliably Removed
The skill is described as an email-management utility, but the analyzed behavior reportedly also includes uninstall/removal actions, deletion of local configuration, and modification of /usr/local/bin, none of which are disclosed in the description. Undocumented filesystem and installation-path changes are dangerous because they can alter the host environment and remove user data outside the user's reasonable expectations for a mail skill.
The skill is described as an email-management utility, but the analyzed behavior reportedly also includes uninstall/removal actions, deletion of local configuration, and modification of /usr/local/bin, none of which are disclosed in the description. Undocumented filesystem and installation-path changes are dangerous because they can alter the host environment and remove user data outside the user's reasonable expectations for a mail skill.
The skill is described as an email-management utility, but the analyzed behavior reportedly also includes uninstall/removal actions, deletion of local configuration, and modification of /usr/local/bin, none of which are disclosed in the description. Undocumented filesystem and installation-path changes are dangerous because they can alter the host environment and remove user data outside the user's reasonable expectations for a mail skill.
The skill is described as an email-management utility, but the analyzed behavior reportedly also includes uninstall/removal actions, deletion of local configuration, and modification of /usr/local/bin, none of which are disclosed in the description. Undocumented filesystem and installation-path changes are dangerous because they can alter the host environment and remove user data outside the user's reasonable expectations for a mail skill.
The trigger matches common words like 邮件, 邮箱, email, 发邮件, 收邮件, and 查邮件, which are broad enough to activate during ordinary conversation about email rather than a clear request to operate on a mailbox. In this context, broad activation is more dangerous because the skill can access private communications and potentially send messages, making accidental invocation a meaningful privacy and action risk.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
CONFIG_DIR="$HOME/.onemail"
CONFIG_FILE="$CONFIG_DIR/config.json"
CREDS_FILE="$CONFIG_DIR/credentials.json"
# 日志函数
log() {
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
CONFIG_DIR="$HOME/.onemail"
CONFIG_FILE="$CONFIG_DIR/config.json"
CREDS_FILE="$CONFIG_DIR/credentials.json"
# 日志函数
log() {
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
CONFIG_DIR="$HOME/.onemail"
CONFIG_FILE="$CONFIG_DIR/config.json"
CREDS_FILE="$CONFIG_DIR/credentials.json"
# 日志函数
log() {
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
CONFIG_DIR="$HOME/.onemail"
CONFIG_FILE="$CONFIG_DIR/config.json"
CREDS_FILE="$CONFIG_DIR/credentials.json"
# 日志函数
log() {
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
CONFIG_DIR="$HOME/.onemail"
CONFIG_FILE="$CONFIG_DIR/config.json"
CREDS_FILE="$CONFIG_DIR/credentials.json"
# 日志函数
log() {
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
CONFIG_DIR="$HOME/.onemail"
CONFIG_FILE="$CONFIG_DIR/config.json"
CREDS_FILE="$CONFIG_DIR/credentials.json"
# 日志函数
log() {
The function accesses high-value OAuth secrets including the client secret and refresh token, then uses them to mint access tokens. In this file, token error handling later prints the full token endpoint response, which can expose bearer tokens or diagnostic secrets to logs or stderr, increasing the risk of credential leakage if output is captured.
local client_secret=$(echo "$creds" | jq -r '.client_secret')
local refresh_token=$(echo "$creds" | jq -r '.refresh_token')
# 使用 refresh token 获取新的 access token
local token_response=$(curl -s -X POST \
"https://login.microsoftonline.com/common/oauth2/v2.0/token" \
-d "client_id=$client_id" \
When token acquisition fails, the script echoes the full OAuth token response to stderr. OAuth error responses may contain sensitive token material, correlation data, or other secrets; if terminal output, logs, or agent traces are retained, this can leak credentials that enable mailbox access and mail sending.
local new_refresh_token=$(echo "$token_response" | jq -r '.refresh_token')
if [ "$access_token" = "null" ]; then
echo "❌ 获取 Outlook access token 失败" >&2
echo "$token_response" >&2
exit 1
fi
This function transmits message content, recipients, and optional attachment contents to Microsoft Graph to send an email, which can materially affect user data and privacy. Aside from an attachment log and error output, there is no explicit user-facing warning or confirmation that outbound email and file contents will be sent to a remote service.
The script is explicitly designed to collect and retain email credentials in a persistent credentials.json file under the user's home directory. In the context of a multi-account email management skill, these secrets grant access to mailbox contents and sending capability; compromise of this file could expose sensitive communications across all configured accounts.
CONFIG_DIR="$HOME/.onemail"
CONFIG_FILE="$CONFIG_DIR/config.json"
CREDS_FILE="$CONFIG_DIR/credentials.json"
echo "🔧 one-mail 初始化配置"
echo ""
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
# 删除符号链接
echo "删除符号链接: $INSTALL_DIR/onemail"
if [ -w "$INSTALL_DIR" ]; then
rm -f "$INSTALL_DIR/onemail"
else
sudo rm -f "$INSTALL_DIR/onemail"
fi
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
# 删除符号链接
echo "删除符号链接: $INSTALL_DIR/onemail"
if [ -w "$INSTALL_DIR" ]; then
rm -f "$INSTALL_DIR/onemail"
else
sudo rm -f "$INSTALL_DIR/onemail"
fi
This markdown file contains natural-language statements that the skill documentation and user experience were changed to Chinese and unified in that language. Under the policy, forcing a specific language without user opt-in is a locale/language policy concern unless the constraint is clearly justified or optional.
This markdown file describes behaviors that can transmit user data externally, including sending email bodies and attachments to recipients. While usage is documented, there is no explicit warning that these actions send content to external parties or that account-removal operations may be irreversible, which fits the missing-user-warning criterion for markdown files.
The cron and auto-reply examples encourage unattended processing of incoming email and automatic outbound responses without emphasizing privacy review, recipient verification, or loop prevention. In an agent/skill context, this can normalize autonomous handling of sensitive communications and lead to accidental disclosure or spam-like behavior.
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
Test NetEase Mail connection:
The daily digest example collects unread email metadata and content summaries into a new outbound message, which can leak sensitive business or personal information to another mailbox. Although framed as convenience, it creates an easy path for bulk summarization and retransmission of private communications.
The backup and forwarding examples show bulk storage and redistribution of email content but omit warnings about retention, local file protection, and sensitivity of copied messages. Users may adopt these examples directly and inadvertently create plaintext archives or forward confidential information to secondary destinations.
The example script forwards selected email subject, sender, and snippet to another address automatically, which is a direct data exfiltration pattern. In a multi-account email skill, this is especially risky because it lowers the barrier to silently redistributing potentially sensitive message content across accounts or to third parties.
This markdown file describes storing sensitive credentials in ~/.onemail/credentials.json and managing multiple email accounts, which implies access to private mailbox contents and outbound transmission of email data. While the README notes storage location and permissions, it does not provide a user-facing warning about the privacy and data-sensitivity implications of using the tool.
No suspicious patterns detected.