Back to skill

Security audit

AI Email Agent

Security checks for vulnerabilities and agentic risk

Overview

This is a real email automation tool, but it can send customer emails automatically and exposes stored customer ticket data through an unauthenticated dashboard.

Review this carefully before installing. Use only test mailboxes at first, disable or gate automatic SMTP replies until reviewed, bind the dashboard to localhost with authentication, avoid exposing ticket APIs, redact customer data before LLM/webhook use, and pin or verify dependencies for production use.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (5)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
main.py:63
Finding

Unauthenticated Dashboard Exposes Sensitive Customer and Ticket Data

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
dashboard.html:370
Finding

Stored Cross-Site Scripting Through Unescaped Ticket Data

Content
View full analysis
暂无升级工单 🎉'; return; } tbody.innerHTML = tickets.map(t => { const levelBadge = t.escalation_level === 'P0' ? 'badge-p0' : t.escalation_level === 'P1' ? 'badge-p1' : 'badge-p2'; const sentBadge = t.sentiment === 'angry' ? 'badge-red' : t.sentiment === 'negative' ? 'badge-yellow' : 'badge-gray'; return ` ${t.ticket_id} ${t.from_name || t.from_addr} ${CATEGORY_LABELS[t.category] || t.category} ${SENTIMENT_LABELS[t.sentiment] || t.sentiment} ${'🔴'.repeat(t.urgency_level || 0)}${'⚪'.repeat(5 - (t.urgency_level || 0))} ${t.escalation_level} ${t.escalation_reason || ''} ${(t.created_at || '').slice(11,16)} `; }).join(''); } ``` ```javascript function renderRecentTable(tickets) { const tbody = document.getElementById('recentTable'); if (!tickets.length) { tbody.innerHTML = '暂无工单'; return; } tbody.innerHTML = tickets.map(t => { const statusBadge = t.status === 'AUTO_REPLIED' ? 'badge-green' : t.status === 'ESCALATED' ? 'badge-red' : t.status === 'RESOLVED' ? 'badge-blue' : t. ...[truncated 2784 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
agent/classifier.py:75
Finding

Excessive Disclosure of Customer PII to Configurable LLM Endpoints

Content
View full analysis
主题: {subject} 正文: {body} """ ``` ```python body = email.body_plain[:3000] if len(email.body_plain) > 3000: body += "\n... [正文已截断]" prompt = CLASSIFICATION_PROMPT.format( from_name=email.from_name, from_addr=email.from_addr, subject=email.subject, body=body, ) response = self.client.chat.completions.create( model=self.model, messages=[ {"role": "system", "content": "你是一个精确的邮件分类器。只输出 JSON,不要输出 markdown 代码块或任何其他文本。"}, {"role": "user", "content": prompt}, ], max_tokens=self.max_tokens, temperature=self.temperature, ) ``` A separate generation path can also transmit customer content: ```python prompt = f"""作为电商客服,请用 {classification.language} 语言回复以下客户邮件: 客户: {email.from_name} <{email.from_addr}> 主题: {email.subject} 原文: {email.body_plain[:500]} 分类: {classification.category} 情感: {classification.sentiment} 工单号: {ticket_id} 承诺回复时限: {variables['reply_deadline']} ... """ ``` The destination is configurable: ```yaml llm: provider: "openai" api_key: "${LLM_API_KEY}" base_url: "https://api.openai.com/v1" model: "gpt-4o-mini" ``` ### Technical Analysis LLM processing is part of the declared functionality, so external model communication is not inherently unauthorized. However, classification sends the customer's name, full email address, subject, and up to 3,000 characters of body content. Support messages may contain order identifiers, monetary amounts, tracking numbers, addresses, legal issues, or other sensitive information. The classification task generally does not require the sender's real identity. The ...[truncated 1338 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
agent/classifier.py:35
Finding

Prompt Injection Through Attacker-Controlled Email Content

Content
View full analysis
主题: {subject} 正文: {body} """ ``` ```python prompt = CLASSIFICATION_PROMPT.format( from_name=email.from_name, from_addr=email.from_addr, subject=email.subject, body=body, ) response = self.client.chat.completions.create( model=self.model, messages=[ {"role": "system", "content": "你是一个精确的邮件分类器。只输出 JSON,不要输出 markdown 代码块或任何其他文本。"}, {"role": "user", "content": prompt}, ], max_tokens=self.max_tokens, temperature=self.temperature, ) ``` The reply-generation path similarly concatenates raw email content: ```python prompt = f"""作为电商客服,请用 {classification.language} 语言回复以下客户邮件: 客户: {email.from_name} <{email.from_addr}> 主题: {email.subject} 原文: {email.body_plain[:500]} 分类: {classification.category} 情感: {classification.sentiment} 工单号: {ticket_id} 承诺回复时限: {variables['reply_deadline']} 要求: - 回复专业、友好、体贴 - 如果客户不满,先道歉 - 包含工单号和回复时限 - 提供切实可行的后续步骤 - 字数控制在 150 词以内 """ ``` ### Technical Analysis Email senders fully control the subject and body. These values are concatenated into model instructions without a strong data/instruction boundary. A sender can include model-directed text asking the LLM to disregard the classification policy, return a selected category, suppress urgency, fabricate entities, or generate attacker-selected reply content. The code parses JSON syntactically, but it does not enforce a strict schema or validate category membership, numeric ranges, allowed language codes, entity types, or output lengths before downstream use. Although rule-based checks cover selected legal, social, and safety keywords, they do not provide ...[truncated 1445 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Unpinned Python Dependencies and Unverified Remote Dashboard Script

Content
View full analysis
=1.30.0 pyyaml>=6.0 python-dotenv>=1.0.0 requests>=2.31.0 ``` ```html ``` ### Technical Analysis The Python requirements specify only lower bounds. A future installation can therefore resolve to dependency versions that were not reviewed with the Skill. No lockfile or package hashes are present to verify artifact integrity. The dashboard also loads executable JavaScript from a public CDN. Although a specific Chart.js version is included in the URL, the tag has no Subresource Integrity hash. The browser therefore trusts whatever content is returned by that remote dependency source. No evidence was found that the currently named packages are malicious. This finding concerns reproducibility and supply-chain hardening rather than a confirmed malicious package. ### Attack Path 1. A dependency account, package release, distribution channel, DNS path, or CDN is compromised. 2. An operator runs `pip install -r requirements.txt` or opens the dashboard. 3. The environment retrieves code that was not cryptographically pinned to the reviewed artifact. 4. The untrusted dependency executes with the Python process's privileges or within the dashboard origin. 5. It may access environment variables, customer data, API responses, or network capabilities available to that process. ### Impact Assessment A compromised Python dependency could execute with the privileges of the account running the agent and access mailbox credentials, SMTP credentials, the LLM API key, local ticket data, and network services. A compromised dashboard script could access and exfiltrate all data exposed by same-origin dashboard APIs. Exploitation depends on an external supply-chain compromise; no such ...[truncated 52 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (64)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

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

2. 配置

bash
cp .env.example .env
# 编辑 .env,填入 LLM_API_KEY (OpenAI 兼容)
# 编辑 config.yaml,填入 IMAP/SMTP 服务器信息

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

Exposing a local HTTP dashboard/API and operational commands is a meaningful expansion of attack surface beyond a simple email assistant. If these capabilities are not disclosed up front, operators may run the skill in environments where local web exposure, data leakage through stats endpoints, or unintended admin/test actions become possible.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Exposing a local HTTP dashboard/API and operational commands is a meaningful expansion of attack surface beyond a simple email assistant. If these capabilities are not disclosed up front, operators may run the skill in environments where local web exposure, data leakage through stats endpoints, or unintended admin/test actions become possible.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Exposing a local HTTP dashboard/API and operational commands is a meaningful expansion of attack surface beyond a simple email assistant. If these capabilities are not disclosed up front, operators may run the skill in environments where local web exposure, data leakage through stats endpoints, or unintended admin/test actions become possible.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Exposing a local HTTP dashboard/API and operational commands is a meaningful expansion of attack surface beyond a simple email assistant. If these capabilities are not disclosed up front, operators may run the skill in environments where local web exposure, data leakage through stats endpoints, or unintended admin/test actions become possible.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Exposing a local HTTP dashboard/API and operational commands is a meaningful expansion of attack surface beyond a simple email assistant. If these capabilities are not disclosed up front, operators may run the skill in environments where local web exposure, data leakage through stats endpoints, or unintended admin/test actions become possible.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Exposing a local HTTP dashboard/API and operational commands is a meaningful expansion of attack surface beyond a simple email assistant. If these capabilities are not disclosed up front, operators may run the skill in environments where local web exposure, data leakage through stats endpoints, or unintended admin/test actions become possible.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This path sends raw customer identity fields, subject, and email body content to the external LLM to generate a reply. Because it includes directly identifying information and unstructured message text, it materially increases exposure of PII and potentially financial/order data, making the issue more severe than generic template polishing.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · main.py (reported line 281)May include surrounding context.

python
print("=" * 60)

    print("\n💡 提示:")
    print("  1. 配置 .env 文件中的 LLM_API_KEY 后,可真实调用 LLM 分类")
    print("  2. 配置 IMAP/SMTP 后,运行 'python main.py run' 启动真实 Agent")
    print("  3. 运行 'python main.py dashboard' 查看监控看板")

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The README presents the system as a fully automatic pipeline that fetches customer email, classifies content with an LLM, and sends SMTP replies, but does not prominently warn that this can process real customer data and generate outbound communications without human review. In this context, operators may connect production mailboxes and enable autonomous handling too early, creating privacy, compliance, and customer-impact risk from misclassification or unsafe responses.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The run instructions explicitly tell users how to start continuous live processing against IMAP/SMTP, but omit any warning that this may connect to production inboxes and send automatic replies to real customers. That omission is risky because it lowers operator caution and can lead to unintended mass outbound email, mishandled complaints, or exposure of sensitive customer content to the LLM and downstream systems.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill declares required binaries and sensitive environment variables, and its documented commands imply filesystem and network activity, but it does not declare an explicit tool/permission scope. This creates a transparency and containment problem: a reviewer or runtime may not realize the skill can access secrets, read configuration, and communicate over IMAP/SMTP or HTTP, increasing the chance of over-privileged execution.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest description is written in Chinese and the file does not indicate that language selection is optional or region-specific. Under the policy, forcing a specific language without user opt-in can be a locale/language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

A skill that can process and potentially send replies to real emails should clearly warn users that it may act on live mailbox data and generate outbound communications. Without an explicit warning, users may test or deploy it against production inboxes without understanding the operational and privacy consequences, leading to accidental customer contact or mishandling of sensitive content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The agent changes mailbox state by calling mark_read in multiple paths, which is a user-data affecting operation. While there are operational logs, this file does not clearly disclose in comments or docstrings that running the agent will modify message read status, including on failures and filtered messages.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code sends outbound emails automatically via self.sender.send(...), which is a safety-relevant external action affecting user communications. Although the file logs processing status, it does not include a clear warning, confirmation step, or explicit disclosure in comments/docstrings that the skill will autonomously transmit replies to external recipients.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The classifier sends full email content, sender identity, and subject line to an external LLM service, which can expose sensitive personal, financial, or business information to a third party. In an e-commerce customer support context, emails may contain order IDs, addresses, refund details, complaints, and other PII, so forwarding them off-platform without explicit notice, consent, or minimization creates a real privacy and compliance risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring and function docstring are written entirely in Chinese, which imposes a specific language on users and maintainers without any opt-in or justification that the skill is intended only for a Chinese-language environment. The policy explicitly flags language or locale constraints when no user choice or documented rationale is provided.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The notification path sends customer-identifying and case-content data to external WeCom/Feishu webhooks, including name, email address, summary, sentiment, and possible order identifiers. In a customer support email agent, this materially increases privacy and data-leak risk because webhook endpoints may be third-party managed, misconfigured, or exposed outside the intended trust boundary.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
95% confidence
Finding

This code transmits escalation messages containing customer metadata and ticket details to an external webhook URL using requests.post(). In the context of an email support agent processing potentially sensitive customer communications, such exfiltration can leak personal data and business-sensitive information if the webhook is compromised, misdirected, or points to an untrusted SaaS tenant.

Content

Scanner excerpt · agent/escalation.py (reported line 108)May include surrounding context.

python
"msgtype": "markdown",
                "markdown": {"content": message.replace("\n", "\n> ")},
            }
            requests.post(self.wecom_webhook, json=payload, timeout=10)
        except Exception as e:
            print(f"[WARN] 企微通知发送失败: {e}")

External Transmission

Medium
Category
Data Exfiltration
Confidence
95% confidence
Finding

This second webhook transmission sends the same class of potentially sensitive escalation content to Feishu. Because the message includes customer identity and case details, the external transmission broadens the attack surface and can violate privacy or data-handling requirements if endpoint governance is weak.

Content

Scanner excerpt · agent/escalation.py (reported line 121)May include surrounding context.

python
"msg_type": "text",
                "content": {"text": message},
            }
            requests.post(self.feishu_webhook, json=payload, timeout=10)
        except Exception as e:
            print(f"[WARN] 飞书通知发送失败: {e}")

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code reads SMTP username and password from configuration and later uses them to authenticate and send email over the network. While the docstrings describe sending mail, there is no user-facing confirmation, warning, or logging that credentials will be used and message content transmitted externally.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The LLM polishing prompt is always written in Chinese (请将以下客服邮件回复翻译为 {lang} 语言), regardless of operator preference or deployment locale. This imposes a specific language in natural-language instructions without any opt-in or documented justification, which matches the language/locale policy violation category.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The code sends full email reply content to an external LLM for translation/polishing without any indication of consent, minimization, or privacy controls. In a customer-support context, the body can contain personal, order, or complaint data, so transmitting it to a third-party model provider creates a real confidentiality and compliance risk.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The prompt embeds raw customer identity and message content and asks the LLM to process and reproduce that data in generated replies. This creates prompt-injection and privacy risks: hostile email text can steer the model, and sensitive user data is unnecessarily exposed to the provider and may be echoed back into outputs.

Content

No source excerpt is available for this finding.