Back to skill

Security audit

Email Smart Reply (AI-Powered)

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent email automation tool, but it needs review because it handles real mailbox and knowledge-base data through third-party services and includes an unsafe shell-command path reachable from email-derived input.

Review carefully before installing. Use only in a contained service account with a non-production mailbox first, fix the execSync command-injection issue, avoid printing .env files, restrict KB and mailbox scope, confirm OpenRouter and Discord are approved for customer data, and define retention/cleanup for drafts, review records, and test reports.

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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/kb-retrieval.js:29
Finding

Shell Command Injection Through Email-Derived Knowledge-Base Queries

Content
View full analysis
Remediation
View remediation
0 && limit <= 20 ? limit : 3; const result = execFileSync( CONFIG.venvPython, [searchScript, query, '--limit', String(safeLimit)], { encoding: 'utf8', timeout: 10000, stdio: ['pipe', 'pipe', 'ignore'], shell: false } ); ``` Additional hardening should include: 1. Resolve the Python executable to an administrator-approved absolute path rather than accepting an unrestricted `PYTHON_PATH`. 2. Validate that `searchScript` resolves inside the expected vector-store directory. 3. Apply length and character limits to LLM-generated entities before using them. 4. Treat all LLM output as untrusted input, even when the model is instructed to return structured JSON. 5. Run the pipeline under a dedicated least-privileged account with access only to required mailbox, draft, and knowledge-base resources. 6. Avoid passing unnecessary secrets in the child process environment. 7. Add regression tests containing shell metacharacters and command-substitution syntax to verify that values are passed as literal arguments. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/intent-recognition.js:91
Finding

Unredacted Email Content Disclosed to OpenRouter During Intent Classification

Content
View full analysis
", "confidence": <0.0-1.0>, "key_entities": ["entity1", "entity2"], "language": "en|zh|other", "reasoning": "" } Email to classify: Subject: ${subject} Body: ${body.slice(0, 2000)} Classification:`; try { const response = await fetch('https://openrouter.ai/api/v1/chat/completions', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${process.env.OPENROUTER_API_KEY}`, 'HTTP-Referer': 'https://farreach-electronic.com', 'X-Title': 'Farreach EmailIntent', }, body: JSON.stringify({ model: 'anthropic/claude-sonnet-4', messages: [ { role: 'system', content: 'You are an email intent classifier. Return ONLY valid JSON. No markdown, no explanations outside the JSON.' }, { role: 'user', content: prompt } ], temperature: 0.1, max_tokens: 200 }) }); ``` ### Technical Analysis The classifier transmits the complete email subject and up to 2,000 characters of the email body to OpenRouter. Incoming business email may contain personal data, quotations, order identifiers, technical details, signatures, telephone numbers, credentials, contractual information, or other confidential material. The external LLM integration is part of the documented functionality and is not covert exfiltration. However, the implementation sends raw content without: - Redact ...[truncated 1877 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/reply-generation.js:178
Finding

Email and Internal Knowledge-Base Content Disclosed to OpenRouter During Reply Generation

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
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (44)

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The README instructs users to print the contents of an .env file containing IMAP/SMTP credentials and a Discord configuration file directly to the terminal. Exposing secrets in documentation-driven workflows increases the chance of credential leakage through shell history, terminal logging, screen sharing, CI logs, or copied troubleshooting output.

Content

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

bash
# IMAP/SMTP credentials
cat $WORKSPACE/skills/imap-smtp-email/.env

# Discord bot config
cat config/discord-config.json

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

Persisting generated drafts to the local filesystem and relying on a manual-review flag instead of guaranteed review routing can create confidentiality and process-control gaps if operators assume reviewed handling when drafts are merely stored locally. The undocumented persistence of customer email-derived content expands the exposure surface, especially on shared workspaces or poorly secured hosts.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Persisting generated drafts to the local filesystem and relying on a manual-review flag instead of guaranteed review routing can create confidentiality and process-control gaps if operators assume reviewed handling when drafts are merely stored locally. The undocumented persistence of customer email-derived content expands the exposure surface, especially on shared workspaces or poorly secured hosts.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Persisting generated drafts to the local filesystem and relying on a manual-review flag instead of guaranteed review routing can create confidentiality and process-control gaps if operators assume reviewed handling when drafts are merely stored locally. The undocumented persistence of customer email-derived content expands the exposure surface, especially on shared workspaces or poorly secured hosts.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `scripts/intent-recognition.js` | Classifies email intent via LLM (OpenRouter) with keyword fallback |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `scripts/kb-retrieval.js` | Retrieves relevant knowledge from LanceDB + Obsidian vault |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `scripts/reply-generation.js` | Generates personalized reply drafts using templates + KB context |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `scripts/discord-review.js` | Pushes drafts to Discord for human approval before sending |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `scripts/discord-review.js` | Pushes drafts to Discord for human approval before sending |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `scripts/discord-review.js` | Pushes drafts to Discord for human approval before sending |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `scripts/discord-review.js` | Pushes drafts to Discord for human approval before sending |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `scripts/integration-test.js` | End-to-end pipeline test with `--dry-run` mode |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `scripts/integration-test.js` | End-to-end pipeline test with `--dry-run` mode |

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 · scripts/integration-test.js (reported line 253)May include surrounding context.

js
const fs = require('fs');
const path = require('path');
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });

// 加载 intent schema
const SCHEMA_PATH = path.join(__dirname, '..', 'config', 'intent-schema.json');

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 · scripts/intent-recognition.js (reported line 11)May include surrounding context.

js
const fs = require('fs');
const path = require('path');
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });

// 加载 intent schema
const SCHEMA_PATH = path.join(__dirname, '..', 'config', 'intent-schema.json');

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · scripts/reply-generation.js (reported line 267)May include surrounding context.

js
Generate the reply:`;

  return prompt;
}

/**

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The README states that this directory is only a packaged, documented copy, while instructing operators to execute active scripts from a different skill directory that has direct IMAP/SMTP and Discord capabilities. This indirection can conceal the true execution surface, bypass review expectations, and cause users to trust documentation in one location while running code from another, which is dangerous for a skill that processes and sends email.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill documents and appears to require access to environment variables and multiple networked services (IMAP, SMTP, OpenRouter, Discord) but does not declare an explicit tool scope such as permissions or allowed-tools. That omission weakens reviewability and can lead operators to enable broader capabilities than intended, increasing the chance of unauthorized data access or exfiltration through email and external APIs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The description omits a clear privacy warning that inbound email content is processed by external services, specifically OpenRouter, and may also be relayed through Discord during review. Because customer emails can contain personal data, account details, pricing, contracts, or proprietary technical content, failing to warn users about third-party transmission can lead to noncompliant handling and unintentional data leakage.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
76% confidence
Finding

This JSON schema enables language-based handling via the natural-language setting "language_detection": true, but the file does not indicate that users can choose or opt into language/locale behavior. Under the policy, locale-related behavior should either offer a user choice or be clearly documented and justified as region-specific.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest describes this skill as generating draft replies and routing low-confidence replies for human review via Discord. In this file, the review workflow is coupled to actual message delivery: approved reviews invoke SMTP sending, which turns the module from a drafting/review tool into an email-sending component.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The module performs a real outbound email send by invoking another script through execFile after an approve/send action. Although sending email is part of the module's purpose, the local CLI approval path executes the send immediately without an additional confirmation or clear warning that this action will dispatch a real email to the recipient.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code sends email content, sender metadata, and intent classification to Discord, a third-party service, without any data-minimization, redaction, or explicit consent/check in this module. If drafts contain sensitive customer information, this can cause unintended data exposure to Discord infrastructure and everyone with channel access.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The top-level comments, usage guidance, and runtime messages are presented in Chinese only, with no mechanism for selecting another language. This is a natural-language policy concern because the skill imposes a locale/language choice rather than offering user opt-in or documenting a justified region-specific constraint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This integration test pulls real mailbox contents and writes detailed pipeline results to disk, creating a privacy and data-retention risk. In this skill context, emails may contain customer contact details, business inquiries, and message bodies that become locally persisted in test artifacts without minimization or clear operator consent.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec, suspicious.env_credential_access

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/kb-retrieval.js:29

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/integration-test.js:57

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/intent-recognition.js:117

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/reply-generation.js:24