Back to skill

Security audit

Email IMAP/SMTP

Security checks for vulnerabilities and agentic risk

Overview

This email skill is mostly coherent, but it handles mailbox credentials and OAuth tokens in ways that can expose secrets if used carelessly.

Review before installing. Use environment variables or another protected secret mechanism instead of putting passwords or tokens in commands, avoid `--show-token`, only use known HTTPS OAuth token endpoints, and preview recipients, body, and attachments before sending mail.

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
scripts/email_ops.py:235
Finding

OAuth Credentials Can Be Transmitted to a Plaintext Token Endpoint

Content
View full analysis
dict: if not config.refresh_token: raise ValueError("Missing refresh token.") if not config.token_endpoint: raise ValueError("Missing token endpoint. Set --token-endpoint or EMAIL_TOKEN_ENDPOINT.") if not config.client_id: raise ValueError("Missing client id. Set --client-id or EMAIL_CLIENT_ID.") payload = { "grant_type": "refresh_token", "refresh_token": config.refresh_token, "client_id": config.client_id, } if config.client_secret: payload["client_secret"] = config.client_secret if config.scope: payload["scope"] = config.scope data = urllib.parse.urlencode(payload).encode("utf-8") request = urllib.request.Request( config.token_endpoint, data=data, method="POST", headers={"Content-Type": "application/x-www-form-urlencoded"}, ) try: with urllib.request.urlopen(request, timeout=30) as response: body = response.read().decode("utf-8") ``` ### Technical Analysis The OAuth token endpoint can be supplied through `--token-endpoint` or `EMAIL_TOKEN_ENDPOINT`, but its URL scheme and destination are not validated before the request is made. The form-encoded POST body contains a reusable refresh token, client ID, optional client secret, and requested scope. If the endpoint uses `http://`, these credentials ...[truncated 1503 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/email_ops.py:617
Finding

Mailbox Credentials and OAuth Secrets Can Be Exposed Through Command-Line Arguments

Content
View full analysis
" --client-id "" --client-secret "" ``` ### Technical Analysis The command-line interface accepts mailbox passwords, access tokens, refresh tokens, and OAuth client secrets directly as arguments. Command-line arguments can be retained in shell history, captured by terminal or agent transcripts, collected by process-auditing systems, and, depending on operating-system configuration, observed through process inspection. Although the Skill recommends environment variables, its documented token-refresh example explicitly encourages command-line secret submission. Environment variables also require careful handling, but they normally avoid shell-history and command-line process-list exposure. The ability to provide authentication material is necessary for the declared mailbox operations. Exposing reusable secrets through ordinary command-line arguments is not necessary and increases local credential exposure. ### Attack Path 1. A user follows the documented example or passes a password, token, or client secret through a CLI option. 2. The shell records the ...[truncated 1081 chars]
Remediation
View remediation
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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (17)

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

md
- Email address (login username)
- Authentication:
  - Password mode: app password / authorization code
  - OAuth2 mode: access token, or refresh token + client info
- IMAP host/port
- SMTP host/port

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

md
- Email address (login username)
- Authentication:
  - Password mode: app password / authorization code
  - OAuth2 mode: access token, or refresh token + client info
- IMAP host/port
- SMTP host/port

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

md
- Email address (login username)
- Authentication:
  - Password mode: app password / authorization code
  - OAuth2 mode: access token, or refresh token + client info
- IMAP host/port
- SMTP host/port

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

The CLI accepts sensitive secrets such as passwords, access tokens, refresh tokens, and client secrets directly as command-line arguments. On many systems, command-line arguments are visible to other local users via process listings, shell history, job control logs, or audit tooling, which can expose mailbox credentials and OAuth tokens.

Content

Scanner excerpt · scripts/email_ops.py (reported line 682)May include surrounding context.

python
parser.add_argument("--email", help="Mailbox login email")
    parser.add_argument("--auth-mode", choices=["auto", "password", "oauth2"], default="auto", help="Authentication mode")
    parser.add_argument("--password", help="Mailbox password or app password")
    parser.add_argument("--access-token", help="OAuth2 access token")
    parser.add_argument("--refresh-token", help="OAuth2 refresh token")
    parser.add_argument("--token-endpoint", help="OAuth2 token endpoint for refresh")
    parser.add_argument("--client-id", help="OAuth2 client id")

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

The token subcommand can print the resolved OAuth access token in full when --show-token is used, creating a straightforward secret exposure path to stdout, logs, terminal scrollback, and calling agent transcripts. In an agent skill context, this is more dangerous because tool output is often captured and persisted automatically.

Content

Scanner excerpt · scripts/email_ops.py (reported line 726)May include surrounding context.

python
p_send.add_argument("--html-file", help="Path to HTML body file")
    p_send.add_argument("--attach", action="append", help="Attachment path (repeatable)")

    p_token = subparsers.add_parser("token", help="Resolve OAuth2 access token")
    p_token.add_argument("--show-token", action="store_true", help="Print full token instead of masked output")

    p_auth = subparsers.add_parser("auth-url", help="Build OAuth2 authorization URL")

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding

The skill invokes local scripts that rely on environment variables, file access, and outbound network connectivity, but the manifest declares no explicit tool scope or permissions boundary. This creates an authorization gap where an agent may use broader capabilities than reviewers or users expect, increasing the chance of unintended credential access, file reads, or network operations.

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 · references/provider-presets.md (reported line 21)May include surrounding context.

md
"smtp_port": 465,
        "smtp_ssl": True,
        "oauth": {
            "auth_endpoint": "https://api.login.yahoo.com/oauth2/request_auth",
            "token_endpoint": "https://api.login.yahoo.com/oauth2/get_token",
            "scope": "openid mail-r mail-w",
        },

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/provider-presets.md (reported line 22)May include surrounding context.

md
"smtp_port": 465,
        "smtp_ssl": True,
        "oauth": {
            "auth_endpoint": "https://api.login.yahoo.com/oauth2/request_auth",
            "token_endpoint": "https://api.login.yahoo.com/oauth2/get_token",
            "scope": "openid mail-r mail-w",
        },

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/provider-presets.md (reported line 29)May include surrounding context.

md
"smtp_port": 465,
        "smtp_ssl": True,
        "oauth": {
            "auth_endpoint": "https://api.login.yahoo.com/oauth2/request_auth",
            "token_endpoint": "https://api.login.yahoo.com/oauth2/get_token",
            "scope": "openid mail-r mail-w",
        },

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/provider-presets.md (reported line 30)May include surrounding context.

md
"smtp_port": 465,
        "smtp_ssl": True,
        "oauth": {
            "auth_endpoint": "https://api.login.yahoo.com/oauth2/request_auth",
            "token_endpoint": "https://api.login.yahoo.com/oauth2/get_token",
            "scope": "openid mail-r mail-w",
        },

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

python
"smtp_port": 465,
        "smtp_ssl": True,
        "oauth": {
            "auth_endpoint": "https://api.login.yahoo.com/oauth2/request_auth",
            "token_endpoint": "https://api.login.yahoo.com/oauth2/get_token",
            "scope": "openid mail-r mail-w",
        },

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

python
"smtp_port": 465,
        "smtp_ssl": True,
        "oauth": {
            "auth_endpoint": "https://api.login.yahoo.com/oauth2/request_auth",
            "token_endpoint": "https://api.login.yahoo.com/oauth2/get_token",
            "scope": "openid mail-r mail-w",
        },

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

python
"smtp_port": 465,
        "smtp_ssl": True,
        "oauth": {
            "auth_endpoint": "https://api.login.yahoo.com/oauth2/request_auth",
            "token_endpoint": "https://api.login.yahoo.com/oauth2/get_token",
            "scope": "openid mail-r mail-w",
        },

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

python
"smtp_port": 465,
        "smtp_ssl": True,
        "oauth": {
            "auth_endpoint": "https://api.login.yahoo.com/oauth2/request_auth",
            "token_endpoint": "https://api.login.yahoo.com/oauth2/get_token",
            "scope": "openid mail-r mail-w",
        },

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The token refresh flow transmits refresh tokens and possibly client secrets to a remote token endpoint, which is a sensitive network operation. Although this is standard OAuth behavior, the code provides no warning, confirmation, or nearby disclosure about sending credential material to external services.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
80% confidence
Finding

The list and read commands connect to IMAP and retrieve email headers, bodies, and attachment names, which are typically sensitive user data. The code contains functional help text but no explicit warning or disclosure that it accesses and outputs private mailbox contents.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code performs an external SMTP send of user-provided body content and attachment files, which can transmit sensitive data off-system. In this file there is no confirmation prompt, visible user disclosure at send time, or warning-oriented comment/docstring around the operation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.