Back to skill

Security audit

Mail Mate

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real IMAP email automation tool, but it handles private mailbox data and secrets with risky cron, webhook, and validation behavior that users should review before installing.

Install only for mailboxes and notification destinations you explicitly control. Avoid the cron helper until its argument validation and .env handling are fixed; if you use push notifications, treat subjects, senders, extracted fields, and previews as data that may leave your organization.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
setup_cron.sh:72
Finding

Cron Command Injection Enables Persistent Arbitrary Command Execution

Content
View full analysis
> ${LOG_PATH} 2>&1" NEW_ENTRY="${CRON_EXPR} ${CRON_CMD} ${TAG}" # 幂等写入:先剔除旧的同 TAG 行,再追加新条目 TMP="$(mktemp)" ( crontab -l 2>/dev/null || true ) | grep -v -F "$TAG" > "$TMP" || true echo "$NEW_ENTRY" >> "$TMP" crontab "$TMP" ``` ### Technical Analysis The script directly interpolates the user-supplied `CRON_EXPR` and `LOG_PATH` values into a crontab entry. It does not reject newline characters, shell metacharacters, command substitutions, or redirection syntax. The generated paths in `CRON_CMD` are also not shell-quoted. Consequently, metacharacters or whitespace in `LOG_PATH`, `ENV_FILE`, `PYTHON_BIN`, or `MAIN_PY` can alter the command interpreted by cron. This is particularly serious because the injected command is written to the user's crontab. It therefore survives the setup process and is executed according to the supplied schedule. ### Attack Path 1. An attacker obtains influence over an argument passed to `setup_cron.sh`, such as the log path. 2. The attacker supplies a value containing shell syntax, for example: ```bash ./setup_cron.sh "* * * * *" '/tmp/output; /path/to/attacker-command #' ``` 3. The script inserts the value into `CRON_CMD` without escaping. 4. The resulting malicious entry is installed using `crontab "$TMP"`. 5. Cron executes the injected command repeatedly under the account that installed the task. A newline in `CRON_EXPR` or `LOG_PATH` could similarly be used to introduce additional crontab entries. ### Impact Assessment Successful exploitation provides arbitrary command execution with the privileges of the user running `setup_cron.sh`. If the script is run by a privileged service account or administrator, the injected command receives ...[truncated 322 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
setup_cron.sh:54
Finding

Persisted Credential File May Retain Insecure Permissions

Content
View full analysis
"$ENV_FILE" ``` ### Technical Analysis The script stores the mailbox authorization code, webhook URL, and push signing secret in `.env`. Although `umask 077` ensures restrictive permissions when a new file is created, it does not change the mode of an existing file. If `.env` already exists with group-readable or world-readable permissions, truncating it with `> "$ENV_FILE"` preserves those permissions. Sensitive values are then written to a file that remains accessible to unintended local users. This contradicts the script and documentation claim that the file will have mode `0600`. The redirection also follows an existing symbolic link. In a writable or shared installation directory, an attacker could potentially pre-create `.env` as a link to another user-writable target, causing sensitive data to be written to an unintended location. ### Attack Path 1. An attacker or previous deployment creates `.env` in the project directory with permissive permissions, such as mode `0644`. 2. The legitimate user exports `SKILL_AUTH_PASSWORD`, `SKILL_WEBHOOK_URL`, and `SKILL_PUSH_SECRET`. 3. The user executes `setup_cron.sh`. 4. The existing file is truncated and rewritten, but its permissive mo ...[truncated 855 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
pusher.py:56
Finding

Unrestricted Webhook URL Permits SSRF and Disclosure of Email Content

Content
View full analysis
dict: data = json.dumps(payload, ensure_ascii=False).encode("utf-8") req = urllib.request.Request( url, data=data, headers={"Content-Type": "application/json; charset=utf-8"}, method="POST", ) with urllib.request.urlopen(req, timeout=timeout) as resp: raw = resp.read().decode("utf-8", errors="replace") try: return json.loads(raw) except json.JSONDecodeError: return {"raw": raw, "status": resp.status} ``` The sensitive payload is assembled and passed to this function through the unified push entry point: ```python title, md_body = format_markdown(emails, keyword_desc) try: if platform == "dingtalk": resp = push_dingtalk(webhook_url, secret, title, md_body) elif platform == "feishu": resp = push_feishu(webhook_url, secret, title, md_body) elif platform == "tg": resp = push_telegram(webhook_url, secret, title, md_body) ``` ### Technical Analysis The implementation accepts an arbitrary `webhook_url` and passes it directly to `urllib.request.urlopen`. It does not: - Require HTTPS. - Enforce the documented DingTalk, Feishu, or Telegram hostnames. - Reject loopback, private, link-local, or reserved IP addresses. - Revalidate redirect destinations. - Bind a platform selection to that platform's legitimate endpoint format. The transmitted message can contain email subjects, sender addresses, timestamps, extracted fields, body previews, and filter descriptions. A maliciously supplied URL can therefore exfiltrate mailbox-derived data to an attacker-controlled service. The same primitive can send HTTP POST requests from the host running the Skill to internal servi ...[truncated 1431 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
reader.py:232
Finding

User-Controlled Regular Expressions Can Exhaust CPU

Content
View full analysis
dict: if not patterns: return {} if isinstance(patterns, str): try: patterns = json.loads(patterns) except json.JSONDecodeError: return {} if not isinstance(patterns, dict): return {} compiled = {} for name, expr in patterns.items(): try: compiled[str(name)] = re.compile(str(expr), re.IGNORECASE | re.MULTILINE) except re.error: compiled[str(name)] = None return compiled def _apply_patterns(body: str, compiled: dict) -> dict: out = {} for name, regex in compiled.items(): if regex is None: out[name] = None continue m = regex.search(body or "") if not m: out[name] = None elif m.groups(): out[name] = m.group(1) else: out[name] = m.group(0) return out ``` The expressions are applied to full message bodies at lines 341–342: ```python extracted_data = _apply_patterns(body, compiled_patterns) ``` ### Technical Analysis The caller can provide arbitrary values in `extract_patterns`. These expressions are compiled with Python's standard backtracking regular-expression engine and evaluated against complete email bodies. The implementation imposes no maximum pattern length, pattern count, input-body size, nesting restriction, or evaluation deadline. Expressions containing nested or ambiguous quantifiers can exhibit catastrophic backtracking on specially structured input. A single `regex.search` operation may then consume substantial CPU for an unbounded period. Because the same process performs mailbox retrieval and scheduled execution, one expensive expression can block the entire pipeline and cause subsequent ...[truncated 1075 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (27)

Credential Access

High
Category
Privilege Escalation
Confidence
92% confidence
Finding

The script persists sensitive credentials such as SKILL_AUTH_PASSWORD into a plaintext .env file on disk so cron can source them later. Although umask 077 reduces exposure, storing reusable secrets in a local file increases the risk of credential disclosure through backups, accidental commits, filesystem access, or operational mishandling.

Content

Scanner excerpt · setup_cron.sh (reported line 39)May include surrounding context.

sh
# 解析脚本所在目录(支持软链接)
SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "$0")")" && pwd)"
MAIN_PY="${SCRIPT_DIR}/main.py"
ENV_FILE="${SCRIPT_DIR}/.env"
PYTHON_BIN="$(command -v python3 || echo /usr/bin/python3)"

if [ ! -f "$MAIN_PY" ]; then

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The README promotes forwarding email-derived content, including extracted fields, to external webhook platforms such as DingTalk, Feishu, and Telegram without warning about privacy, compliance, or data-minimization concerns. In an email-processing skill, this is especially sensitive because messages may contain internal alerts, personal data, tokens, or confidential operational details that would be transmitted to third-party services.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
84% confidence
Finding

This is a real external-transmission behavior: the README documents sending processed email content to Telegram's API endpoint. In context, the capability is intentional rather than malicious, but it still expands the data-exfiltration surface because email contents or extracted structured data may leave the local environment and be stored or processed by a third party.

Content

Scanner excerpt · README.md (reported line 179)May include surrounding context.

md
|---|---|---|---|
| 钉钉 | `dingtalk` | 群机器人 Webhook | 加签密钥(`SEC...`,可选) |
| 飞书 | `feishu` | 群机器人 Webhook | 签名密钥(可选) |
| Telegram | `tg` | `https://api.telegram.org/bot<TOKEN>/sendMessage` | 目标 `chat_id` |

推送消息自动渲染为 Markdown / 交互式卡片,并携带 `extracted_data` 字段。

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README explicitly instructs users to persist sensitive SKILL_* variables, including mailbox credentials and webhook secrets, into a local .env file for unattended cron execution. Even with 600 permissions, this creates credentials-at-rest exposure on disk, increasing risk from local compromise, backups, misconfigured file ownership, or accidental inclusion in archives or repos.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The manifest describes a broad 'general-purpose' IMAP email processing pipeline with filtering, extraction, and outbound notification features, but it does not clearly constrain when the skill should be invoked or what classes of mail/data are appropriate. In agent environments, underspecified scope increases the chance the skill is applied to sensitive mailboxes or high-risk content without explicit user intent, expanding unnecessary access to email contents and credentials.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest advertises push to DingTalk, Feishu, and Telegram based on matched email content, but it does not explicitly warn that email-derived data may be transmitted to third-party services outside the mailbox provider. Because the skill also supports regex extraction and previews, users may unintentionally exfiltrate sensitive content, identifiers, or secrets to external platforms.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This entrypoint ingests highly sensitive credentials and outbound push secrets from environment variables or stdin, then uses them to access a mailbox and potentially forward results externally. In the context of an agent skill, this is dangerous because it enables bulk access to private email and data exfiltration without any built-in consent check, scope restriction, masking, or warning at the point of use.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The code always includes fetched emails in the output object and can additionally forward them to a configured push platform, creating a straightforward path for sensitive message contents to be disclosed outside the mailbox. In an email-processing skill, this context materially increases risk because email often contains credentials, personal data, business secrets, and reset links, so broad output and forwarding behavior can become data exfiltration.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This module formats email metadata and previews, then sends them via HTTP POST to DingTalk, Feishu, or Telegram webhooks. Although the behavior is clear from the code, there is no confirmation prompt, logging, or warning comment/docstring disclosing that potentially sensitive email content will be transmitted to third-party services.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · pusher.py (reported line 114)May include surrounding context.

python
def push_telegram(webhook_url: str, chat_id: str, title: str, md_body: str) -> dict:
    """
    webhook_url 格式:https://api.telegram.org/bot<TOKEN>/sendMessage
    chat_id 通过 push_secret 传入。
    """
    text = f"*{title}*\n\n{md_body}"

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The function accepts an authentication secret via auth_password and uses it directly in imap.login, but the surrounding docstring does not warn that callers must provide mailbox credentials or app passwords. For a skill file, accessing and transmitting account credentials is safety-relevant and should be explicitly disclosed somewhere visible to users or integrators.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code connects to an IMAP server, authenticates with user credentials, downloads message headers and full message bodies, and returns previews and extracted data. Although this is the function's purpose, the file contains no confirmation prompt, logging, or explicit user-facing warning in comments/docstrings that it will transmit credentials to a remote mail server and retrieve potentially sensitive mailbox content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The natural-language comments and usage guidance are entirely in Chinese, which imposes a specific language on users without any opt-in or stated regional justification. This matches the policy category for language or locale constraints expressed in natural language.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · README.md (reported line 238)May include surrounding context.

md
# 幂等写入:先剔除旧的同 TAG 行,再追加新条目
TMP="$(mktemp)"
( crontab -l 2>/dev/null || true ) | grep -v -F "$TAG" > "$TMP" || true
echo "$NEW_ENTRY" >> "$TMP"
crontab "$TMP"
rm -f "$TMP"

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · README.md (reported line 239)May include surrounding context.

md
# 幂等写入:先剔除旧的同 TAG 行,再追加新条目
TMP="$(mktemp)"
( crontab -l 2>/dev/null || true ) | grep -v -F "$TAG" > "$TMP" || true
echo "$NEW_ENTRY" >> "$TMP"
crontab "$TMP"
rm -f "$TMP"

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · setup_cron.sh (reported line 76)May include surrounding context.

sh
# 幂等写入:先剔除旧的同 TAG 行,再追加新条目
TMP="$(mktemp)"
( crontab -l 2>/dev/null || true ) | grep -v -F "$TAG" > "$TMP" || true
echo "$NEW_ENTRY" >> "$TMP"
crontab "$TMP"
rm -f "$TMP"

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · setup_cron.sh (reported line 84)May include surrounding context.

sh
# 幂等写入:先剔除旧的同 TAG 行,再追加新条目
TMP="$(mktemp)"
( crontab -l 2>/dev/null || true ) | grep -v -F "$TAG" > "$TMP" || true
echo "$NEW_ENTRY" >> "$TMP"
crontab "$TMP"
rm -f "$TMP"

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · setup_cron.sh (reported line 84)May include surrounding context.

sh
echo "[OK] 已写入 crontab:"
echo "    $NEW_ENTRY"
echo ""
echo "可用 'crontab -l' 查看,用 'crontab -e' 手动编辑。"
echo "日志输出路径:${LOG_PATH}"

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill explicitly supports sending extracted email data to third-party platforms such as DingTalk, Feishu, and Telegram, but the documentation does not warn that mailbox-derived content may leave the original trust boundary. Because the pushed message includes extracted_data and may include previews or other sensitive operational content, this creates a real exfiltration path if users enable push features without understanding the data-sharing implications.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This documentation normalizes forwarding extracted mailbox content into external chat systems, which is a direct natural-language data leakage channel. Even if the feature is intended for notifications, mailbox data often contains confidential business, personal, or regulated information, and the skill does not appear to impose minimization, masking, or approval controls in the documented workflow.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
94% confidence
Finding

The Telegram webhook example is concrete evidence of external transmission capability, and the surrounding text states pushed messages contain extracted key information from emails. In this skill's context, that is dangerous because it bridges private mailbox data to an external API endpoint, potentially violating confidentiality expectations or compliance requirements if users are not clearly warned and protected.

Content

Scanner excerpt · skill.md (reported line 194)May include surrounding context.

md
|---|---|---|---|
| 钉钉 | `dingtalk` | 群机器人 Webhook | 加签密钥(`SEC...`,可选) |
| 飞书 | `feishu` | 群机器人 Webhook | 签名密钥(可选) |
| Telegram | `tg` | `https://api.telegram.org/bot<TOKEN>/sendMessage` | 目标 `chat_id` |

推送的 Markdown 消息会携带 `extracted_data` 字段,群里一眼可见关键信息。

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The cron setup example instructs users to export email credentials, authorization codes, webhook URLs, and push secrets as environment variables without discussing exposure risks. Environment variables can leak through process listings, crash reports, shell history, inherited child processes, or misconfigured logging, so documenting this pattern without safeguards encourages insecure secret handling.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The advanced prompt instructs the agent to read matched emails and then output subjects and timestamps for abnormal items, which operationalizes disclosure of mailbox contents into a generated summary. In context, this increases risk because it encourages transforming potentially sensitive emails into a more shareable form without any warning, approval gate, or confidentiality constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The display name and description are presented entirely in Chinese, with no indication that the skill is intended only for a Chinese-speaking audience or that users can opt into another language. This can violate a language/locale policy when a skill imposes a specific language without documented justification or user choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

User-visible title and error messages are written in Chinese, and the file does not indicate that language selection is configurable or that the skill is intentionally limited to a Chinese-speaking context. This can violate a language/locale policy when users are not given an explicit opt-in or alternative.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.