Back to skill

Security audit

Simple Email

Security checks for vulnerabilities and agentic risk

Overview

This email skill mostly does what it says, but it needs review because attachment downloads can overwrite local files and the sample configuration allows broad workspace file access.

Install only if you are comfortable giving this skill access to read and send mail from the configured account. Use an app password or authorization code, keep .env private, avoid disabling certificate verification unless you control the server, and set ALLOWED_READ_DIRS and ALLOWED_WRITE_DIRS to narrow dedicated folders rather than the OpenClaw workspace. Review attachment names before downloading because a message sender can choose filenames that may replace existing files in the allowed download folder.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imap.js:16
Finding

Attachment Download Can Overwrite Files and Follow Symbolic Links

Content
View full analysis
path.resolve(d.trim().replace(/^~/, os.homedir())) ); const allowed = allowedDirs.some(dir => resolved === dir || resolved.startsWith(dir + path.sep) ); if (!allowed) { throw new Error(`Access denied: '${dirPath}' is outside allowed write directories`); } return resolved; } ``` ```javascript for (const attachment of parsed.attachments) { // If specificFilename is provided, only download matching attachment if (specificFilename && attachment.filename !== specificFilename) { continue; } if (attachment.content) { const filePath = path.join(resolvedDir, sanitizeFilename(attachment.filename)); fs.writeFileSync(filePath, attachment.content); downloaded.push({ filename: attachment.filename, path: filePath, size: attachment.size, }); } } ``` ### Technical Analysis The output-directory validation uses `path.resolve()`, which only performs lexical path normalization. It does not resolve symbolic links or verify that the actual filesystem destination remains beneath an authorized directory. Although `sanitizeFilename()` removes directory traversal components by retaining the basename, the final destination is passed directly to `fs.writeFileSync()`. This operation: - Follows an existing symbolic link at the destination. - Silently truncates and overwrites an existing file. - Does not use exclusive creation. - Does ...[truncated 2762 chars]
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (53)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

代码的主要行为与描述大体相关,确实实现了查看未读邮件、搜索邮件、标记已读/未读、下载附件,并兼容标准 IMAP 服务;还额外提供了列出邮箱文件夹功能,这可视为邮件技能的辅助能力,不构成明显越权。核心不匹配在于声明强调 IMAP/SMTP 且支持‘收发邮件’,但提供的代码文件只有 IMAP 客户端逻辑,没有任何 SMTP 连接、认证、发信、草稿或发送命令实现。因此描述高估了能力,属于实质性描述不准确。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

描述将该技能表述为完整的 IMAP/SMTP 邮件工具,覆盖收发和邮箱管理功能;但提供的代码片段是一个 SMTP CLI,只负责发信与连接测试。它会读取本地文件内容作为邮件主题/正文/附件,并通过环境变量配置的 SMTP 服务器发送邮件。代码没有任何 IMAP 连接、收件箱读取、邮件状态修改、附件下载等行为。因此,声明的主要能力明显超出代码实际实现范围,属于描述与行为不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The code chunk does relate to an IMAP/SMTP email skill, so the broad domain matches. However, the declared description emphasizes end-user email operations such as sending/receiving, unread mail viewing, search, marking read/unread, and attachment download. This specific code instead performs installation/setup tasks: it prompts for credentials, stores them in .env, sets file access whitelist directories, allows disabling certificate validation, and runs IMAP/SMTP connection tests. Those are materially different capabilities not disclosed in the description, especially credential capture/storage and filesystem whitelist configuration. Therefore the description does not accurately represent what this supplied code chunk actually does.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
89% confidence
Finding

The skill instructs users to place IMAP/SMTP credentials into a local .env file, which creates a concentrated secret store that may be exposed through accidental commits, weak local file permissions, agent file access, or logs. Because these are live mail credentials, compromise could enable mailbox access, email exfiltration, impersonation, and password-reset abuse across other services tied to the mailbox.

Content

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

复制配置模板并填写你的邮箱信息:

bash
cp .env.example .env

编辑 .env 文件,填入你的邮箱配置:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

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
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/imap.js check --limit 5

Static analysis

Detected: suspicious.env_credential_access

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/imap.js:17