Back to skill

Security audit

my_send_email

Security checks for vulnerabilities and agentic risk

Overview

This email skill does what it says, but it embeds a live-looking SMTP password and sends email externally without enough user control or scoped runtime configuration.

Review before installing. This skill can send email outside your environment using an embedded SMTP account password, and it does not ask for confirmation before sending. The publisher should rotate the exposed password, move credentials to protected runtime configuration, use a package-relative entry point, and add explicit confirmation and recipient checks before external sends.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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
send_mail.py:7
Finding
Hard-Coded SMTP Credentials Expose the Email Account<![CDATA[ ## Vulnerability Details **File Location**: `send_mail.py`, lines 7-10 **Vulnerability Type**: Hard-coded secret and plaintext credential exposure **Risk Level**: Critical ### Vulnerable Code ```python smtp_server = "smtp.cloudtrend.com.cn" smtp_port = 587 sender = "ai_assistant@cloudtrend.com.cn" password = "A5b3C3D6!" ``` ### Technical Analysis A plaintext SMTP account and password are embedded directly in the distributed source code. Any person or process able to read the skill package can recover these credentials without invoking the intended skill interface. Source repositories, package archives, backups, build logs, and copied installations can preserve the secret even after it is removed from the latest version. The credential must therefore be considered compromised. If it is valid, an attacker can use an independent SMTP client to authenticate directly to the configured server. ### Attack Path 1. An attacker obtains read access to the skill source, a repository clone, a package archive, or a backup containing `send_mail.py`. 2. The attacker extracts the SMTP hostname, port, sender address, and plaintext password from lines 7-10. 3. The attacker connects to `smtp.cloudtrend.com.cn` on port `587`. 4. The attacker initiates STARTTLS and authenticates as `ai_assistant@cloudtrend.com.cn`. 5. If the credential remains valid, the attacker sends unauthorized messages using the compromised account, subject to the SMTP account's server-side permissions and limits. No access to the Agent's normal skill interface is required after the credential has been recovered. ### Impact Assessment Successful exploitation can provide the attacker with the SMTP sending privileges assigned to the exposed account. This may enable: - Unauthorized or fraudulent email delivery. - Impersonation of the configured sender. - Phishing or spam originating from a trusted organizational domain. - Reputational damage and mail-domain blocklisting. - Consumption of send ...[truncated 346 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed SMTP password immediately; deleting it from the current file is insufficient because historical copies may remain. 2. Review SMTP authentication and sending logs for unauthorized use of the account. 3. Store the replacement credential in a managed secret store or a protected runtime environment variable. 4. Use an application-specific token rather than a reusable account password where supported. 5. Restrict the SMTP account to the minimum required permissions, sender identities, recipient scope, and sending rate. 6. Ensure secret files and environment configuration are readable only by the service account that executes the skill. 7. Add automated secret scanning to source-control and release pipelines. 8. Rewrite repository history or invalidate all exposed values if the file was committed to source control. 9. Return generic authentication errors to users and keep sanitized diagnostics only in access-controlled logs. A safer configuration pattern is: ```python import os smtp_server = os.environ["SMTP_SERVER"] smtp_port = int(os.environ.get("SMTP_PORT", "587")) sender = os.environ["SMTP_SENDER"] password = os.environ["SMTP_PASSWORD"] ``` ]]>

T07 · Tool Hijacking and Spoofing

Error
Location
_meta.json:8
Finding
Skill Metadata Invokes an External, Unbundled Script Path<![CDATA[ ## Vulnerability Details **File Location**: `_meta.json`, lines 8-9 **Vulnerability Type**: External entry-point substitution and tool hijacking risk **Risk Level**: High ### Vulnerable Code ```json "executable": "python3", "args": ["/root/.openclaw/workspace/skills/send_email/send_mail.py", "{receiver}", "{subject}", "{content}"], ``` ### Technical Analysis The metadata does not invoke the `send_mail.py` file relative to the audited project package. Instead, it references an absolute path outside the supplied artifact: ```text /root/.openclaw/workspace/skills/send_email/send_mail.py ``` Consequently, the code executed at runtime is determined by the contents of that external filesystem location rather than necessarily by the reviewed `send_mail.py`. The external file can differ from the audited copy, can become stale, or can be replaced independently. If another process or user can write to the referenced script or its parent directories, replacing that file turns a legitimate-looking email invocation into arbitrary Python execution under the privileges of the account running the Agent. Exploitation requires write access to the external path; the audited files do not establish whether such access is currently available. ### Attack Path 1. An attacker or compromised local process obtains write access to `/root/.openclaw/workspace/skills/send_email/send_mail.py` or a replaceable parent directory. 2. The attacker replaces the referenced script with malicious Python code while retaining the expected filename. 3. A user or Agent triggers the `send_email` skill. 4. The runtime launches `python3` with the absolute external path from `_meta.json`. 5. Python executes the substituted code with the privileges and environment of the Agent process. 6. The malicious script can perform actions available to that process before optionally simulating normal email output to conceal the substitution. ### Impact Assessment If the external path is writable by ...[truncated 703 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Reference the script relative to the installed skill directory rather than through a separate absolute workspace path. 2. Ensure the runtime resolves the entry point to the same packaged file that underwent review. 3. Package the skill immutably or verify the script's cryptographic hash before execution. 4. Restrict ownership and permissions on the script and all parent directories so untrusted users and processes cannot modify or replace them. 5. Avoid executing skills as root; use a dedicated service account with minimal filesystem and network permissions. 6. Reject symbolic links and verify the resolved canonical path before invocation. 7. Add deployment checks that fail installation when the configured entry point lies outside the package root. 8. Re-audit the file at the configured runtime path to confirm that it matches the bundled implementation. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill lacks any warning or safeguard about sending messages to external recipients, even though email can transmit sensitive information outside the organization. In this context, the absence of disclosure, validation, or confirmation materially increases the risk of accidental exfiltration and user-unaware outbound communication.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger phrases are broad enough to match ordinary user requests to notify or contact someone, which can cause this email-sending skill to activate unexpectedly. Because the skill performs an external side effect (sending email), unintended invocation can lead to data disclosure, spam, or actions taken without sufficiently explicit user intent.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The skill description uses broad trigger phrases such as 'user asks to send an email' and 'notify via email,' which can overlap with many normal conversational requests. In an agentic environment, this increases the chance the skill is invoked too readily, enabling unintended outbound communication or data exfiltration through email when the user did not explicitly consent to sending a message.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill sends arbitrary user-provided content to an external SMTP server immediately, with no confirmation, consent flow, or warning that data will leave the local environment. In an agent setting, this creates a real exfiltration path for sensitive prompts, generated content, or user data if the tool is invoked unexpectedly or with attacker-influenced inputs.

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
The natural-language comments, usage text, and return messages are presented only in Chinese, with no indication that the user can choose another language or that the skill is intentionally limited to a Chinese-only context. This creates a locale policy issue because the skill effectively enforces one language without opt-in or justification.

Static analysis

No suspicious patterns detected.