Back to skill

Security audit

Create And Use New Agent Email Address

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its email-management purpose, but it handles powerful mailbox and OpenClaw identity credentials with under-scoped safeguards that merit review before installation.

Install only if you trust the Crustacean Email Gateway service and are comfortable granting it access to your OpenClaw identity for mailbox registration/recovery plus ongoing mailbox read, send, status-change, and forwarding authority. Avoid custom API bases unless you control them, protect the token file with restrictive permissions, do not share JSON-mode output from registration or recovery, and review forwarding changes carefully because forwarded mail can leave the mailbox without destination verification.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/common.py:179
Finding

Unrestricted API Base Can Expose Bearer Tokens and Identity Proofs to an Attacker-Controlled Server

Content
View full analysis
None: parser.add_argument("--api-base", default=os.environ.get("CRUSTACEAN_API_BASE", DEFAULT_API_BASE)) parser.add_argument( "--identity-path", default=os.environ.get("OPENCLAW_IDENTITY_PATH", DEFAULT_IDENTITY_PATH), ) parser.add_argument( "--token-path", default=os.environ.get("CRUSTACEAN_TOKEN_PATH", DEFAULT_TOKEN_PATH), ) ``` ```python def api_request( method: str, api_base: str, endpoint: str, *, payload: dict[str, Any] | None = None, token: str | None = None, ) -> dict[str, Any]: base = api_base.rstrip("/") path = endpoint if endpoint.startswith("/") else f"/{endpoint}" url = f"{base}{path}" data = None headers = {"Accept": "application/json"} if payload is not None: data = json.dumps(payload).encode("utf-8") headers["Content-Type"] = "application/json" if token: headers["Authorization"] = f"Bearer {token}" req = urllib.request.Request(url, data=data, method=method.upper(), headers=headers) try: with urllib.request.urlopen(req, timeout=30) as resp: raw_body = resp.read().decode("utf-8") body = json.loads(raw_body) if raw_body else {} return { "status": resp.status, "ok": 200 <= resp.status < 300, "body": body, } except urllib.error.HTTPError as exc: raw_body = exc.read().decode("utf-8", errors="replace") try: body = json.loads(raw_body) if raw_body else {} except json.JSONDecodeError: body = {"ok": False, "error": {"code": "http_error", "message": ...[truncated 3520 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/common.py:166
Finding

Bearer Token Is Persisted Without Enforcing Restrictive File Permissions

Content
View full analysis
None: ensure_parent_dir(path) resolved = pathlib.Path(path).expanduser().resolve() resolved.write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n", encoding="utf-8") ``` The parent-directory helper also creates directories without explicitly setting private permissions: ```python def ensure_parent_dir(path: str) -> None: pathlib.Path(path).expanduser().resolve().parent.mkdir(parents=True, exist_ok=True) ``` ### Technical Analysis The saved JSON document contains a bearer token that authorizes mailbox operations. The code writes it with `Path.write_text` but does not explicitly create the file with mode `0600`, verify the mode of an existing file, or enforce mode `0700` on the containing directory. The resulting permissions depend on the process umask. With a permissive umask, the token can become readable by other local users. If the target file already exists, its existing permissions generally remain in effect during truncation and rewriting. Therefore, a previously created group-readable or world-readable token file can remain exposed after registration or recovery. The use of `resolve()` does not itself provide safe secret-file creation. The implementation also lacks an atomic, no-follow creation strategy to protect against path replacement or unsafe pre-existing filesystem objects. ### Attack Path 1. Registration or recovery runs under a permissive umask, or the configured token path already exists with permissive permissions. 2. `save_token` writes the bearer token without enforcing a private file mode. 3. Another local user or process reads the token file. 4. The attacker extracts the `token` field. 5. The attacker authenticates to the mailbox API and performs actio ...[truncated 700 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/register_mailbox.py:82
Finding

Registration and Recovery JSON Output Discloses Newly Issued Bearer Tokens

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (15)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README explicitly advertises local bearer-token persistence but provides no warning that the token is a sensitive credential or that insecure storage could allow mailbox takeover. In this skill’s context, the token grants authenticated access to mailbox data and sending capabilities, so documenting storage without security guidance increases the chance of credential exposure through weak file permissions, backups, or logs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The README presents forwarding and outbound send as capabilities without warning that they transmit message content and metadata to external destinations. In an email-gateway skill, that omission is security-relevant because users or downstream agents may trigger data exfiltration, privacy violations, or unintended disclosure of sensitive communications without clear notice or confirmation expectations.

Content

No source excerpt is available for this finding.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · README.md (reported line 41)May include surrounding context.

md
- No attachments yet.

## Paths and defaults
- Skill entry: `skills/crustacean-email-gateway/SKILL.md`
- Default identity path: `/root/.openclaw/identity/device.json`
- Default API base: `https://api.crustacean.email/api/v1`
- Default token path: `~/.crustacean-email/token.json`

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill describes capabilities that read local identity files, write bearer tokens, access environment overrides, execute shell commands, and make network requests, but it declares no explicit tool scope or permissions. This creates an over-privileged and under-specified execution model where an agent may use sensitive capabilities without clear restriction, increasing the risk of secret exposure, unintended file access, or unauthorized outbound actions.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

The skill explicitly allows configuring email forwarding with 'no verification flow', meaning mail can be redirected to an arbitrary destination based only on mailbox-token authorization. If the token is compromised or the agent is induced to change forwarding, inbound messages can be silently exfiltrated without recipient ownership checks or user-confirmation safeguards.

Content

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

md
- Treat outbound message `id` as the public id used by `GET /outbox/{id}`.
- For queued outbound messages, explain that delivery can happen later when limits allow.
- Use `configure_forwarding.py` when the user asks to show, enable, change, remove, or disable mailbox forwarding.
- Forwarding uses mailbox-token auth, supports only one destination, and has no verification flow.
- Forwarding to the same mailbox address or any `crustacean.email` address/subdomain is not allowed.
- Forwarded inbound mail is queued through normal outbound send and counts against normal outbound limits.
- Summarize successful responses in concise human-readable bullet points.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The API explicitly allows enabling forwarding without any verification flow for the destination address. This can cause misdelivery of sensitive mailbox contents due to typos, attacker-supplied addresses, or unauthorized configuration changes, and the skill context makes this more dangerous because it handles mailbox management and could automate forwarding setup at scale.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The examples include actions that can transmit email externally, alter forwarding configuration, and change message state without any warning that these operations may expose private data, affect account behavior, or be difficult to undo. In an agent skill, terse examples often become executable affordances, so missing confirmation and privacy guidance increases the chance of unintended outbound communication or mailbox changes.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · README.md (reported line 43)May include surrounding context.

md
from dataclasses import dataclass
from typing import Any

DEFAULT_API_BASE = "https://api.crustacean.email/api/v1"
DEFAULT_IDENTITY_PATH = "/root/.openclaw/identity/device.json"
DEFAULT_TOKEN_PATH = os.path.expanduser("~/.crustacean-email/token.json")

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

md
from dataclasses import dataclass
from typing import Any

DEFAULT_API_BASE = "https://api.crustacean.email/api/v1"
DEFAULT_IDENTITY_PATH = "/root/.openclaw/identity/device.json"
DEFAULT_TOKEN_PATH = os.path.expanduser("~/.crustacean-email/token.json")

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/api.md (reported line 3)May include surrounding context.

md
from dataclasses import dataclass
from typing import Any

DEFAULT_API_BASE = "https://api.crustacean.email/api/v1"
DEFAULT_IDENTITY_PATH = "/root/.openclaw/identity/device.json"
DEFAULT_TOKEN_PATH = os.path.expanduser("~/.crustacean-email/token.json")

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/examples.md (reported line 78)May include surrounding context.

md
from dataclasses import dataclass
from typing import Any

DEFAULT_API_BASE = "https://api.crustacean.email/api/v1"
DEFAULT_IDENTITY_PATH = "/root/.openclaw/identity/device.json"
DEFAULT_TOKEN_PATH = os.path.expanduser("~/.crustacean-email/token.json")

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/common.py (reported line 21)May include surrounding context.

python
from dataclasses import dataclass
from typing import Any

DEFAULT_API_BASE = "https://api.crustacean.email/api/v1"
DEFAULT_IDENTITY_PATH = "/root/.openclaw/identity/device.json"
DEFAULT_TOKEN_PATH = os.path.expanduser("~/.crustacean-email/token.json")

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The helper loads the OpenClaw identity file, extracts the private key, writes it to a temporary file, and uses it to sign remote service challenges. That gives the skill direct access to a broader root identity credential, which is highly sensitive and can be abused by a compromised or overly permissive skill to impersonate the agent beyond ordinary email operations.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/common.py (reported line 145)May include surrounding context.

python
key_path = key_file.name

    try:
        proc = subprocess.run(
            ["openssl", "dgst", "-sha256", "-sign", key_path],
            input=message,
            capture_output=True,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script recovers a bearer token and persists it to disk automatically via save_token(...), but this file provides no explicit warning, confirmation, or visible safeguards around storing a highly sensitive credential. In the context of an email gateway skill, a recovered token likely grants mailbox access and sending capability, so accidental storage on shared systems, backups, or insecure paths can expose account access.

Content

No source excerpt is available for this finding.