Back to skill

Security audit

Email Migration Toolkit

Security checks for vulnerabilities and agentic risk

Overview

This email migration skill is mostly coherent, but it includes unsafe troubleshooting and script options that could expose mailbox passwords or email data.

Review before installing. Use this only with test or authorized migration accounts, do not use --no-ssl/--nossl or disable certificate validation with real credentials, avoid passing passwords on the command line, revoke app passwords after testing, and store exported MBOX/PST files only in encrypted, access-restricted locations.

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/imap-test.py:27
Finding

IMAP credentials can be transmitted without transport encryption

Content
View full analysis

Vulnerability Details

File Location: scripts/imap-test.py:27-46; scripts/mailbox-size.py:36-42; related unsafe guidance at references/troubleshooting.md:301-304
Vulnerability Type: Optional plaintext authentication over IMAP
Risk Level: High

Vulnerable Code

scripts/imap-test.py:27-46:

python
# Create IMAP connection
if use_ssl:
    print("Connecting with SSL/TLS...")
    if port == 993:
        imap = imaplib.IMAP4_SSL(server, port)
    else:
        # STARTTLS connection
        print("Using STARTTLS on non-standard port...")
        imap = imaplib.IMAP4(server, port)
        imap.starttls()
else:
    print("Connecting without encryption (not recommended)...")
    imap = imaplib.IMAP4(server, port)

print("✅ Connected successfully")

# Test authentication
print(f"Authenticating as {username}...")
result = imap.login(username, password)

scripts/mailbox-size.py:36-42:

python
# Create IMAP connection
if use_ssl:
    imap = imaplib.IMAP4_SSL(server, port)
else:
    imap = imaplib.IMAP4(server, port)

# Login
imap.login(username, password)

Both scripts expose the insecure mode through a command-line flag:

python
parser.add_argument('--no-ssl', action='store_true',
                    help='Disable SSL/TLS encryption')

The troubleshooting guide also recommends insecure transport as a diagnostic action:

text
### Third-Party Tools (ImapSync, etc.)

**Solutions:**
1. Install required dependencies
2. Use --nossl for testing
3. Process in smaller chunks
4. Monitor system resources

Technical Analysis

When --no-ssl is selected, each script creates an ordinary imaplib.IMAP4 connection and then invokes imap.login(username, password) without first negotiating STARTTLS. The IMAP authentication exchange therefore lacks transport confidentiality and integrity.

The warning printed by imap-test.py does ...[truncated 1887 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the --no-ssl option from both scripts.
  2. Require either:
    • Implicit TLS through imaplib.IMAP4_SSL; or
    • STARTTLS before any authentication command.
  3. Preserve certificate-chain and hostname validation. Do not add a certificate-bypass option.
  4. If plaintext connectivity diagnostics are indispensable, prohibit LOGIN, AUTHENTICATE, and all other credential-bearing commands in that mode.
  5. Separate unauthenticated TCP reachability testing from authenticated IMAP testing.
  6. Remove documentation that recommends --nossl or temporarily disabling certificate validation.
  7. Clearly state that authentication must never occur over plaintext IMAP, including on test networks.
  8. Prefer OAuth2 or narrowly scoped, revocable app passwords where supported.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imap-test.py:156
Finding

Mailbox passwords can be exposed through process command-line arguments

Content
View full analysis

Vulnerability Details

File Location: scripts/imap-test.py:156,201-204; scripts/mailbox-size.py:249,275-278; unsafe example at references/troubleshooting.md:137-142
Vulnerability Type: Sensitive credential accepted and documented as a command-line argument
Risk Level: Medium

Vulnerable Code

scripts/imap-test.py:156 and scripts/imap-test.py:201-204:

python
parser.add_argument('--password', help='Password (will prompt if not provided)')
python
# Get password
password = args.password
if not password:
    password = getpass("Password (or app password): ")

scripts/mailbox-size.py:249 and scripts/mailbox-size.py:275-278:

python
parser.add_argument('--password', help='Password (will prompt if not provided)')
python
# Get password
password = args.password
if not password:
    password = getpass("Password (or app password): ")

references/troubleshooting.md:137-142 encourages placing a credential directly in a shell command:

bash
# Check total message count via IMAP
# Use provided mailbox-size.py script
python3 scripts/mailbox-size.py user@provider.com password

Technical Analysis

Command-line arguments are not an appropriate channel for secrets. Depending on the operating system and execution environment, command arguments may be exposed through:

  • Shell history files
  • Process-listing and process-inspection interfaces
  • Terminal session recording
  • CI/CD or orchestration logs
  • Monitoring and endpoint-management agents
  • Support bundles and diagnostic reports
  • Parent-process telemetry or audit logs

Although both scripts provide a safer getpass() fallback, retaining --password encourages callers and automation systems to bypass it. The troubleshooting example compounds the problem by visibly placing a password in a command. That example is also inconsistent with the actual interface because the script ac ...[truncated 1405 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the --password argument from both scripts.

  2. Collect interactive credentials exclusively through getpass().

  3. For noninteractive use, integrate with an operating-system credential store or a dedicated secret manager rather than environment variables or command arguments.

  4. If file-based secret input is required, enforce restrictive permissions, read the secret without logging it, and securely delete temporary material where applicable.

  5. Correct the troubleshooting example to omit the password:

    bash
    python3 scripts/mailbox-size.py \
      --server imap.provider.com \
      --username user@provider.com
    

    The script should then request the password through its hidden prompt.

  6. Add explicit documentation warning users not to place mailbox passwords in shell commands, scripts, command history, or logs.

  7. Recommend revocable app passwords instead of primary account passwords and instruct users to revoke them after migration.

  8. Ensure exception messages and debug logging never include credential values.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The code only tests IMAP connectivity and basic mailbox access. While IMAP testing is one item mentioned in the description, the declared purpose presents a broad universal email migration toolkit with migration planning, backup/export, troubleshooting, and provider-specific migration support across many ecosystems. Those capabilities are not implemented in this code chunk. The actual primary purpose is much narrower than declared, so this is a clear description/behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The description presents a broad, multi-provider email migration toolkit for IT professionals, implying a comprehensive set of migration-related functions. The code chunk instead is narrowly focused on one task: estimating mailbox size and message volume via IMAP. While this is tangentially relevant to migration planning, it is only a small subset of the declared functionality. The script connects to an IMAP server, authenticates, lists folders, samples message sizes, estimates total mailbox size, and prints rough migration/storage estimates. It does not migrate mail, export or back up data, provide decision trees, troubleshoot provider-specific issues, or support non-IMAP/on-prem Exchange-specific workflows in any substantive way. Therefore the declared purpose materially overstates and misrepresents the actual behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Advising users to disable certificate validation 'temporarily for testing' removes the primary defense against man-in-the-middle attacks and server impersonation. In the context of IMAP/SMTP troubleshooting, this can directly expose authentication credentials and mailbox contents to interception if users connect over an untrusted or compromised network.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

Recommending --nossl for testing encourages plaintext or otherwise unprotected transport, defeating confidentiality and integrity protections for authentication and email content. In an email migration context, this is especially dangerous because operators may test against live mailboxes and production data, exposing credentials and message contents on the network.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The --no-ssl option allows IMAP authentication without TLS, which can expose mailbox credentials and message metadata to interception on the network. Given this skill is meant for email migrations across diverse providers and possibly legacy or on-prem environments, users may be tempted to use the insecure mode in production, increasing the chance of credential theft.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The migration steps instruct users to create app passwords, test IMAP connectivity, and handle mailbox data, but they omit explicit warnings about credential sensitivity, exposure through third-party clients, and retention of synchronized local copies. In an email migration context, this increases the risk of credential mishandling, unintended data duplication, and privacy violations during a high-sensitivity operation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The backup/export steps tell users how to create downloadable mailbox archives but do not explicitly warn that those archives contain highly sensitive communications, attachments, and personal data. In an IT migration context, this omission can lead to insecure storage, sharing, or transmission of exported MBOX/PST files, increasing risk of data leakage during normal operational use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The admin eDiscovery export workflow explains how to export other users' mailboxes but does not clearly state that this should only be done with proper authorization, legal basis, and privacy review. Because this skill is aimed at IT professionals performing migrations, the omission is more dangerous: it operationalizes bulk access to employee mail without reinforcing least-privilege, consent, or compliance boundaries.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The Exchange PowerShell example writes a mailbox export to a network share but does not warn that this creates a second copy of potentially sensitive mailbox contents in a location that may be broadly accessible or insufficiently protected. In enterprise migration scenarios, careless use of shared paths can expose large volumes of regulated or confidential mail data to unauthorized users or leave residual copies behind.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file contains step-by-step instructions for generating and entering authentication secrets such as app passwords and regular passwords into mail clients. Although there is a later general security section, the procedural sections do not clearly warn users that these credentials are sensitive and should not be shared, stored insecurely, or entered into untrusted clients.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The example python3 scripts/mailbox-size.py user@provider.com password normalizes passing real credentials directly on the command line. Command-line arguments are commonly exposed via shell history, process listings, audit logs, and remote support screenshots, which can leak mailbox credentials during a migration. In an email-migration skill, operators are especially likely to substitute production credentials, making the risk practical rather than theoretical.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Telling users to disable antivirus temporarily reduces endpoint protections during a period when they may be handling exported mail, attachments, and credentials. Without guardrails, readers may perform this on production systems and forget to re-enable protection, increasing exposure to malware or malicious attachments encountered during migration.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script accepts a password via the --password command-line argument, which can expose credentials through shell history, process listings, audit logs, CI job output, or remote management tooling. In an email-migration context this is particularly sensitive because the password may grant direct access to a user's mailbox or tenant data, and the script explicitly supports many providers used in production environments.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script accepts a password via the --password command-line option, which can expose credentials through shell history, process listings, audit logs, or job runners. In an IT migration context this is especially risky because operators may run the tool on shared admin hosts or automation systems handling real mailbox credentials.

Content

No source excerpt is available for this finding.