Back to skill

Security audit

smtp-sender

Security checks for vulnerabilities and agentic risk

Overview

This SMTP email skill broadly matches its stated purpose, but it ships unsafe SMTP configuration defaults and can send arbitrary local files outside the environment without strong guardrails.

Review before installing. Use only a dedicated least-privileged SMTP account, replace the packaged example values, require TLS, and do not allow an agent to attach files unless you explicitly approve each path and recipient. Do not rely on the documented markdown conversion, retries, or audit logs unless they are actually implemented later.

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

T09 · Insecure Skill Coding Practices

Error
Location
smtp-config.example.json:2
Finding
Concrete SMTP Credentials Shipped in Example Configuration## Vulnerability Details **File Location**: `smtp-config.example.json:2-7` **Vulnerability Type**: Hardcoded credentials and sensitive configuration disclosure **Risk Level**: High ### Vulnerable Code ```json { "server": "192.168.50.3", "port": 8025, "username": "admin", "password": "admin1234", "emailFrom": "openclaw@njavc.com", "useTLS": false } ``` ### Technical Analysis The example configuration contains a concrete private-network SMTP address, an administrative-looking username, a plausible password, and an organization-specific sender address. These values are not clearly marked placeholders. Because configuration examples are commonly copied directly into active configuration files, the values may represent exposed credentials or may become insecure defaults. The application uses the configured username and password directly in `server.login()`, so any valid credentials grant the same SMTP access available to the application. The audit could not verify whether the private SMTP endpoint is currently reachable or whether the credentials remain valid. Exploitation therefore depends on an attacker obtaining network access to the endpoint or successfully reusing the credentials against another service. ### Attack Path 1. An attacker downloads or otherwise obtains the skill package. 2. The attacker extracts the SMTP host, port, username, password, and sender identity from `smtp-config.example.json`. 3. The attacker gains access to the `192.168.50.0/24` network through local access, VPN access, a compromised internal host, or an SSRF/pivoting primitive. Alternatively, the attacker tests the exposed credential pair against related authorized services. 4. If the endpoint is reachable and the credentials are valid, the attacker authenticates to the SMTP service. 5. The attacker sends unauthorized messages using the compromised account or configured sender identity. ### Impact Assessm ...[truncated 577 chars]
Remediation
## Remediation Suggestions 1. Immediately determine whether the supplied username and password are genuine. If so, revoke or rotate them and review SMTP authentication and delivery logs for misuse. 2. Replace all concrete values with unmistakable placeholders, for example: ```json { "server": "smtp.example.com", "port": 465, "username": "SMTP_USERNAME", "password": "REPLACE_WITH_SECRET", "emailFrom": "sender@example.com", "useTLS": true } ``` 3. Store production credentials in a dedicated secret manager or inject them through protected environment variables rather than distributing them in the skill package. 4. If a JSON credential file must be used, exclude it from version control and package publication, restrict its permissions to the owning account, and verify those permissions before loading it. 5. Use a dedicated, least-privileged SMTP account with sending restrictions, rate limits, and sender-address controls. 6. Add automated secret scanning to the repository and release pipeline to prevent future credential publication.

T09 · Insecure Skill Coding Practices

Error
Location
email_sender.py:21
Finding
SMTP Authentication and Message Transmission Allowed Without TLS## Vulnerability Details **File Locations**: `email_sender.py:21-22`; `smtp-config.example.json:7` **Vulnerability Type**: Plaintext transmission of credentials and email content **Risk Level**: High ### Vulnerable Code `email_sender.py:21-22`: ```python server = smtplib.SMTP_SSL(config['server'], config['port']) if config.get('useTLS') else smtplib.SMTP(config['server'], config['port']) server.login(config['username'], config['password']) ``` `smtp-config.example.json:7`: ```json "useTLS": false ``` ### Technical Analysis When `useTLS` is false, the application creates a regular `smtplib.SMTP` connection and immediately calls `server.login()` without first negotiating TLS through `starttls()`. The supplied example configuration explicitly enables this unsafe path. SMTP authentication mechanisms generally protect only the transport representation of credentials, not the transport itself. Without TLS, authentication material can be observed or recovered by an attacker capable of monitoring or modifying the network connection. Message bodies and attachments are also transmitted without transport encryption. An active network attacker may additionally alter SMTP traffic or impersonate the configured server because the plaintext branch provides neither transport encryption nor certificate-based server authentication. ### Attack Path 1. A user copies the supplied configuration or otherwise sets `useTLS` to `false`. 2. The application connects to the configured SMTP endpoint using plaintext SMTP. 3. The application calls `server.login()` and subsequently transmits the message, including its body and attachments, over the unprotected connection. 4. An attacker positioned on the same network, a compromised router, a malicious access point, or another network intermediary captures or modifies the SMTP session. 5. The attacker obtains authentication material and sensitive email content, or redirects/manipulates the ...[truncated 701 chars]
Remediation
## Remediation Suggestions 1. Require encrypted SMTP transport by default and reject configurations that request plaintext authentication. 2. For implicit TLS, use `smtplib.SMTP_SSL` with a secure default SSL context: ```python import ssl import smtplib context = ssl.create_default_context() server = smtplib.SMTP_SSL( config["server"], config.get("port", 465), context=context, timeout=30, ) server.login(config["username"], config["password"]) ``` 3. If STARTTLS is required, establish the connection, negotiate TLS, and only then authenticate: ```python import ssl import smtplib context = ssl.create_default_context() server = smtplib.SMTP( config["server"], config.get("port", 587), timeout=30, ) server.ehlo() server.starttls(context=context) server.ehlo() server.login(config["username"], config["password"]) ``` 4. Do not silently fall back to plaintext if TLS negotiation or certificate validation fails. 5. Replace the ambiguous `useTLS` Boolean with an explicit validated transport mode such as `implicit_tls` or `starttls`. 6. Change the example configuration to use TLS and the correct TLS-enabled port. 7. Rotate credentials that may previously have been transmitted over untrusted plaintext connections.
Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The skill advertises markdown conversion, retry handling, and logging, but the analyzed behavior indicates those controls/features are not actually implemented. This mismatch is security-relevant because users may rely on nonexistent logging for auditability or retry/error handling for reliable delivery, leading to unsafe operational assumptions and possible data handling surprises.

Lp3

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding
The skill documentation describes behavior that reads a local configuration file (`smtp-config.json`) but does not declare any tool scope or permissions. Undeclared file access weakens user visibility and policy enforcement, making it easier for a skill to access local data without explicit approval.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The skill states that it logs sent emails and errors but does not warn that logs may contain sensitive metadata such as recipients, subjects, attachment names/paths, or server error details. Such logging can create a secondary data exposure channel, especially on shared systems or where logs are retained centrally.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
}
```

Ensure file permissions are secured (chmod 600).

## Usage
Send a basic email:
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
This code logs into an SMTP server and sends email to an externally supplied recipient without any confirmation, disclosure, or policy guardrails about transmitting data off-host. In an agent-skill context, that creates a real exfiltration channel because downstream workflows may invoke it on sensitive content and users may not realize data is leaving the environment.

Missing User Warnings

Medium
Confidence
98% confidence
Finding
The skill reads arbitrary local file paths from the attachments argument and emails their contents externally with no warning, validation, or restriction. In an agent environment, this materially increases risk because any prompt-influenced path selection could turn the skill into a local file exfiltration primitive for credentials, configs, tokens, or user documents.

Static analysis

No suspicious patterns detected.