Back to skill

Security audit

Send Email Tool

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent email-sending tool, but it needs Review because it handles SMTP passwords in unsafe and partly under-disclosed ways.

Review before installing. Use only a dedicated SMTP app password, avoid the --password option, do not use this on shared machines, and install keyring first so the Base64 fallback files are not created. Check for and remove ~/.send_email_password and ~/.send_email_username if keyring ever failed.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/send_email.py:136
Finding

SMTP Credentials Stored Using Reversible Base64 Encoding

Content
View full analysis
None: """保存密码""" if KEYRING_AVAILABLE: try: keyring.set_password(self.service_name, username, password) print(f"✓ 密码已保存到 keyring (用户名: {username})") return except Exception as e: print(f"⚠️ keyring 保存失败: {str(e)},使用备用方案") # 备用方案:保存到文件 self._save_to_backup(self.password_backup_file, password) print(f"✓ 密码已保存到备用文件 (用户名: {username})") def _save_to_backup(self, backup_file: Path, content: str) -> None: """保存到备用文件(加密或编码)""" # 使用 base64 简单编码(注意:这不是加密,仅避免明文存储) import base64 encoded = base64.b64encode(content.encode('utf-8')).decode('utf-8') # 设置文件权限为仅用户可读写 backup_file.write_text(encoded) backup_file.chmod(0o600) def _read_from_backup(self, backup_file: Path) -> Optional[str]: """从备用文件读取""" if not backup_file.exists(): return None try: import base64 encoded = backup_file.read_text() return base64.b64decode(encoded).decode('utf-8') except Exception: return None ``` ### Technical Analysis When keyring is unavailable or any keyring operation raises an exception, the application automatically falls back to storing the SMTP password in `~/.send_email_password`. The fallback applies Base64 encoding, which is fully reversible and provides no cryptographic confidentiality. The code writes the file before applying mode `0600`. Consequently, the file is initially created with permissions determined by the process umask and is restricted only afterward. This creates a potential time-of-check window in which other local users or processes may be able to read the credential on systems with a permissive umask. The static pre-scan described ...[truncated 1633 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/send_email.py:725
Finding

Password Can Be Supplied Through a Command-Line Argument

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
SKILL.md:28
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (92)

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 31)May include surrounding context.

md
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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 92)May include surrounding context.

md
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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 108)May include surrounding context.

md
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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 634)May include surrounding context.

md
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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 696)May include surrounding context.

md
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 5)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 23)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 25)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 29)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 30)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 45)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 56)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 60)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 69)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 73)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 82)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 83)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 86)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 96)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 97)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 100)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 110)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 111)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 114)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

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/send_email.py (reported line 125)May include surrounding context.

python
"""
Send Email - 邮件发送工具
支持 SMTP 邮件发送,包括 HTML、附件、自动内嵌图片等功能
支持 keyring 密钥管理
"""

import smtplib

Static analysis

No suspicious patterns detected.