Back to skill

Security audit

Mailscope Email Detection

Security checks for vulnerabilities and agentic risk

Overview

This email-analysis skill is purpose-aligned, but it can upload any readable file to a third-party service and stores the API key locally without strong safeguards.

Install only if you are comfortable sending analyzed emails, including headers, body, and attachments, to Mailscope. Run it only on files you have verified are intended email samples, avoid confidential or regulated messages unless your organization approves that upload, and protect or rotate the API key because the skill stores it locally in `config.json`.

Vulnerability Patterns
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/analyze.ts:69
Finding

Arbitrary Local File Upload to an External Analysis Service

Content
View full analysis
{ const fileBuffer = readFileSync(filePath); const blob = new Blob([fileBuffer]); const form = new FormData(); form.append("file", blob, basename(filePath)); const res = await fetch(`${API_BASE_URL}/api/v1/workspace/upload`, { method: "POST", headers: { "X-API-Key": apiKey }, body: form, }); ``` The caller performs only an existence check: ```ts const filePath = resolve(args[0]); if (!existsSync(filePath)) { console.error(`❌ 文件不存在: ${filePath}`); process.exit(1); } ``` ### Technical Analysis The Skill is documented as an email security analyzer that accepts `.eml` files, but the implementation accepts any filesystem path. It resolves the supplied argument, checks only whether that path exists, reads its complete contents with `readFileSync`, and sends those contents to `https://x.lizhisec.com`. There is no verification that: - The path identifies a regular file. - The filename has an `.eml` extension. - The content is plausibly an email message. - The path is within an approved input directory. - The path is not a symbolic link to a sensitive file. - The file is within a safe size limit. - The user has explicitly approved transmission of that particular file. Consequently, any file readable by the process can be submitted to the external service. This is especially relevant in an Agent environment, where an attacker may use social engineering or crafted instructions to induce the Agent to pass a credential file, private key, configuration file, or other sensitive path as the analysis target. ### Attack Path 1. An attacker supplies or recommends ...[truncated 1317 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:42
Finding

Unpinned Remote Package Execution Through npx

Content
View full analysis
``` ### Technical Analysis The documented execution workflow invokes `tsx` through `npx` without declaring or pinning a package version. If an appropriate local installation is unavailable, `npx` can resolve and download the package from the configured package registry before executing it. This makes the effective executable dependency mutable after the Skill has been audited. Its behavior can vary according to the package version selected at execution time, the active npm registry configuration, and the integrity of the upstream package and its transitive dependencies. Because package installation scripts and executable entry points run with the permissions of the invoking account, compromise of the selected package, registry, dependency chain, or local npm configuration could result in arbitrary code execution. The repository structure shown in the audit does not include a package manifest or lockfile that pins and verifies the expected `tsx` release. ### Attack Path 1. The user or Agent follows the workflow in `SKILL.md`. 2. No trusted local `tsx` executable is available. 3. `npx` consults the configured npm registry and resolves an unpinned package version. 4. The selected package and its dependency graph are downloaded at runtime. 5. Package lifecycle behavior or the downloaded executable runs with the invoking user's permissions. 6. If the registry source or resolved package version is compromised, attacker-controlled code executes before or while the email analyzer starts. Exploitation depends on a malicious or compromised dependency source, package release, transitive dependency, or npm configuration. The codebase itself does not prove that the current upstream `tsx` package is mal ...[truncated 659 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (9)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
npx tsx scripts/analyze.ts <path/to/email.eml>

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill performs network-backed analysis by instructing uploads to an external platform, but it declares no tool scope or permission boundary. That omission can cause users or hosting agents to underestimate what the skill is allowed to do, reducing transparency and weakening policy enforcement around outbound data transfer.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill tells the agent to upload .eml files to an external analysis platform but does not provide a clear user-facing warning that full email contents, headers, attachments, and possibly personal or regulated data will leave the local environment. Because email files often contain highly sensitive data, this creates a meaningful privacy and compliance risk if users are not explicitly informed and do not consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The API key setup flow instructs writing a user-provided credential into config.json without warning the user that the secret will be stored on disk. This can lead to inadvertent credential exposure through filesystem access, backups, source control, or shared environments.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
91% confidence
Finding

Using npx tsx without pinning an exact version introduces supply-chain risk because dependency resolution may fetch an unexpected or compromised package version at execution time. In a security-analysis skill, this is especially dangerous because the tool may process sensitive email data and API credentials.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script reads a local .eml file and uploads it to https://x.lizhisec.com/api/v1/workspace/upload, which transmits full email contents and possibly sensitive metadata, attachments, and personal data to a third-party service. In an email-security skill, this behavior is contextually expected, but it is still dangerous if users are not explicitly warned and asked to consent before off-system transmission, especially for confidential or regulated email data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file's natural-language strings and timestamp formatting are fixed to Chinese, including toLocaleString("zh-CN") and Chinese-only CLI/report output. This can violate a language/locale policy when the skill forces a specific language without user opt-in or documented justification.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.