Back to skill

Security audit

Email Assistant

Security checks for vulnerabilities and agentic risk

Overview

This email assistant is mostly purpose-aligned, but it handles mailbox credentials and email data in under-scoped ways that users should review carefully before installing.

Install only if you are comfortable granting mailbox access. Prefer disposable or least-privilege app passwords, do not pass real passwords on the command line, verify the IMAP server hostname before connecting, protect or delete local token/output files, and review generated calendar files before importing them.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (5)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/imap_client.py:55
Finding

Mailbox Credentials Can Be Sent to an Arbitrary IMAP Server

Content
View full analysis
imaplib.IMAP4_SSL: """Connect to IMAP server.""" try: config = IMAP_CONFIG.get(server) if not config: # Try as custom server config = {"server": server, "port": 993, "ssl": True} if config.get("ssl", True): imap = imaplib.IMAP4_SSL(config["server"], config["port"]) else: imap = imaplib.IMAP4(config["server"], config["port"]) imap.login(email_addr, password) print(f"✓ Connected to {config['server']}") return imap ``` ```python parser.add_argument("--server", help="IMAP server (auto-detected from email if not provided)") parser.add_argument("--email", required=True, help="Email address") parser.add_argument("--password", required=True, help="Password or app token") ``` ### Technical Analysis The declared functionality supports a fixed set of providers, but `--server` accepts an arbitrary hostname. If the value is not a key in `IMAP_CONFIG`, the code treats it as a custom server and sends the supplied email address and password to it using IMAP authentication. TLS only protects credentials while in transit. It does not establish that a user-selected endpoint is an authorized mailbox provider. An attacker controlling the endpoint and its valid TLS certificate can receive the credentials legitimately transmitted by `imap.login()`. This exceeds the minimum privilege and network scope necessary for the documented fixed-provider functionality. ### Attack Path 1. An attacker convinces a user or agent to run the client with `--server attacker.example`. 2. The code does not find that string in `IMAP_CONFIG` and treats it as a custom IMAP hostname. 3. The clien ...[truncated 588 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imap_client.py:205
Finding

Mailbox Passwords Are Exposed Through Command-Line Arguments

Content
View full analysis
--email --password ``` ### Technical Analysis Passwords and app tokens supplied as command-line arguments can become visible through: - Shell history files - Process-listing tools - `/proc` process metadata on applicable platforms - Terminal session capture - Agent tool-call logs - Job scheduler and process supervisor logs - Diagnostic or crash reports that record the full command line Using an app password reduces the consequences compared with exposing a primary account password, but an app password remains a reusable authentication secret and must not be treated as non-sensitive. ### Attack Path 1. A user follows the documented command and enters a mailbox password after `--password`. 2. The shell stores the full command in history or an execution framework records it. 3. Another local user, administrator, support operator, or log consumer accesses the recorded command. 4. The exposed password or app token is replayed against the mailbox provider. ### Impact Assessment The exposed secret may grant ongoing access to email until it is revoked. An attacker may read private correspondence and password-reset messages, gather personal or business data, or alter mailbox state where the provider permits it. ]]>
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/gmail_client.py:51
Finding

OAuth Token Cache Uses Unsafe Pickle Deserialization

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/scheduler.py:153
Finding

Untrusted Email Content Can Inject ICS Properties and Components

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/gmail_client.py:208
Finding

Default Gmail Execution Silently Modifies Mailbox State

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (22)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 35)May include surrounding context.

md
使用前需要:
1. 在 Google Cloud Console 创建项目
2. 启用 Gmail API
3. 下载 credentials.json 到脚本目录
4. 首次运行会打开浏览器进行授权

功能:

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 42)May include surrounding context.

md
使用前需要:
1. 在 Google Cloud Console 创建项目
2. 启用 Gmail API
3. 下载 credentials.json 到脚本目录
4. 首次运行会打开浏览器进行授权

功能:

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/email_config.md (reported line 13)May include surrounding context.

md
使用前需要:
1. 在 Google Cloud Console 创建项目
2. 启用 Gmail API
3. 下载 credentials.json 到脚本目录
4. 首次运行会打开浏览器进行授权

功能:

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/email_config.md (reported line 134)May include surrounding context.

md
使用前需要:
1. 在 Google Cloud Console 创建项目
2. 启用 Gmail API
3. 下载 credentials.json 到脚本目录
4. 首次运行会打开浏览器进行授权

功能:

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/gmail_client.py (reported line 9)May include surrounding context.

python
使用前需要:
1. 在 Google Cloud Console 创建项目
2. 启用 Gmail API
3. 下载 credentials.json 到脚本目录
4. 首次运行会打开浏览器进行授权

功能:

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/gmail_client.py (reported line 40)May include surrounding context.

python
使用前需要:
1. 在 Google Cloud Console 创建项目
2. 启用 Gmail API
3. 下载 credentials.json 到脚本目录
4. 首次运行会打开浏览器进行授权

功能:

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/gmail_client.py (reported line 270)May include surrounding context.

python
使用前需要:
1. 在 Google Cloud Console 创建项目
2. 启用 Gmail API
3. 下载 credentials.json 到脚本目录
4. 首次运行会打开浏览器进行授权

功能:

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/gmail_client.py (reported line 296)May include surrounding context.

python
使用前需要:
1. 在 Google Cloud Console 创建项目
2. 启用 Gmail API
3. 下载 credentials.json 到脚本目录
4. 首次运行会打开浏览器进行授权

功能:

Context Leakage

High
Category
Data Exfiltration
Confidence
95% confidence
Finding

When a date-like string is found, the extractor captures surrounding text and stores it as the event description and uses part of it as the summary. Because the surrounding context comes directly from email bodies and previews, unrelated sensitive content near the matched date can be copied into exported calendar files, causing privacy leakage far beyond the actual event details. In this skill, that is especially dangerous because emails often contain confidential personal, business, or security-relevant information adjacent to scheduling text.

Content

Scanner excerpt · scripts/scheduler.py (reported line 139)May include surrounding context.

python
dt = parse_datetime(match, year_hint)
            
            if dt:
                # Extract context (surrounding text)
                start = max(0, match.start() - 30)
                end = min(len(text), match.end() + 100)
                context = text[start:end].strip()

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill advertises mailbox access and email analysis features but does not clearly warn users that it will read mailbox contents and send authentication/account data to external mail services during OAuth or IMAP operations. This is dangerous because users may authorize access to sensitive email data without informed consent, increasing privacy and data-handling risk.

Content

No source excerpt is available for this finding.

Insecure deserialization: pickle.load()

Medium
Category
Dangerous Code Execution
Confidence
97% confidence
Finding

The code deserializes token.pickle with pickle.load(), which can execute arbitrary code if the file is replaced or tampered with. In this context the file is read from disk automatically during authentication, so any local attacker or malicious process that can write to that path can achieve code execution when the script starts.

Content

Scanner excerpt · scripts/gmail_client.py (reported line 61)May include surrounding context.

python
# 尝试加载已保存的令牌
        if os.path.exists(self.token_path):
            with open(self.token_path, 'rb') as token:
                creds = pickle.load(token)
        
        # 如果没有有效凭证,进行认证
        if not creds or not creds.valid:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code persists OAuth credentials to token.pickle, which affects sensitive user data because it stores reusable Gmail access material on the local system. While the file documents browser-based authorization, it does not disclose that a token will be saved locally, and there is no runtime warning at the point of writing.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The method documentation at L203-L210 describes only adding the STARRED label, implying a single 'important' action. However, the code at L216-L219 also removes the UNREAD label, which changes read state and is a distinct side effect not reflected by the docstring.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

These API calls change user mailbox data by adding STARRED and removing UNREAD, which can affect message state and workflow. Although the example prints when it marks a message important, the module description does not clearly warn that running the script can modify mailbox labels and read/unread state.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The top-level docstring describes a "Universal IMAP email client," which suggests a generic client but does not reflect that the script performs state-changing operations on messages. The implementation includes write-like IMAP actions via flag changes, which is a meaningful behavioral distinction for user intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Accepting the email password via a command-line argument exposes credentials to local disclosure through shell history, process listings, audit logs, and job control systems. In a skill context, this is especially risky because users may copy-paste real mailbox credentials or app passwords into automation environments where other users or monitoring tools can observe them.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code writes fetched email metadata and previews to a user-specified file, which can persist sensitive personal or business data on disk. While the code prints a success message after saving, it does not warn the user beforehand that mailbox contents will be stored locally.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The keyword and priority pattern lists explicitly mix English and Chinese terms, which embeds a language/locale assumption into the skill's behavior. Under the policy, forcing specific language handling without user opt-in or documented justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script writes calendar data derived from email content directly to ICS and JSON files without any user confirmation, minimization, or warning that potentially sensitive meeting details, subjects, senders, and descriptions are being persisted to disk. In this skill context, the data source is email, which commonly contains private schedules, locations, and personal correspondence, so silent export increases the risk of unintended disclosure through local file access, syncing, backups, or accidental sharing.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

A natural-language policy violation can occur when a skill effectively forces a specific language or locale without user opt-in. Although some technical terms are in English, the main instructions and operational guidance are in Chinese and do not offer an alternative language or note a justified locale restriction.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The documentation instructs users to generate an ICS file from email-derived schedule information without warning that this creates a local file containing potentially sensitive meeting details, dates, and contacts. If stored insecurely or shared inadvertently, this derived file could expose private schedule information.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file-level documentation and user-facing strings are written entirely in Chinese, which imposes a specific language/locale by default. The policy allows locale constraints when opt-in or justified, but this file does not offer a language choice or document that it is intentionally limited to Chinese-speaking users.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.