T09 · Insecure Skill Coding Practices
- Location
scripts/smtp.js:60- Finding
SMTP Credentials and Message Data Can Be Transmitted Without Mandatory TLS
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This email skill mostly does what it says, but it handles full mailbox credentials and outbound email with important safety gaps around SMTP TLS and file write boundaries.
Review this before installing if you plan to use a real mailbox. Prefer provider app passwords or scoped credentials, keep .env out of version control, do not disable certificate verification unless you understand the risk, avoid sending sensitive attachments, and restrict ALLOWED_READ_DIRS and ALLOWED_WRITE_DIRS to narrow directories you control.
scripts/smtp.js:60SMTP Credentials and Message Data Can Be Transmitted Without Mandatory TLS
scripts/imap.js:16Attachment Write Whitelist Can Be Bypassed Through Symlinked Directories
scripts/smtp.js:14Attachment Read Validation Is Vulnerable to a Symlink TOCTOU Race
The implemented functionality substantially matches the read/search/fetch/mark/list/download portions of the description, but the declared description explicitly includes 'send email via IMAP/SMTP' and 'send emails with attachments.' This code chunk contains no SMTP logic, no mail composition, and no send operation. It also includes mailbox listing and attachment download-to-disk behavior, which are adjacent email-management features; these are not problematic undeclared capabilities in context. The primary mismatch is that a significant declared capability—outbound email sending—is absent from the code.
The declared description describes a full IMAP/SMTP email skill with both inbound mail access and outbound sending. However, this code chunk is limited to SMTP send/test operations using nodemailer. It creates an SMTP transporter, verifies connectivity, sends mail, and reads local files for composing messages and attachments. There is no code for connecting to an IMAP server, listing/searching messages, reading mailbox contents, or changing message flags. Therefore the implementation materially underdelivers on the declared behavior, making the description inaccurate for this code chunk.
Referenced artifact was not completely inspected
node scripts/imap.js check [--limit 10] [--mailbox INBOX] [--recent 2h]
Referenced artifact was not completely inspected
node scripts/imap.js check [--limit 10] [--mailbox INBOX] [--recent 2h]
Referenced artifact was not completely inspected
node scripts/imap.js check [--limit 10] [--mailbox INBOX] [--recent 2h]
Referenced artifact was not completely inspected
node scripts/imap.js check [--limit 10] [--mailbox INBOX] [--recent 2h]
Referenced artifact was not completely inspected
node scripts/imap.js check [--limit 10] [--mailbox INBOX] [--recent 2h]
Referenced artifact was not completely inspected
node scripts/imap.js check [--limit 10] [--mailbox INBOX] [--recent 2h]
Referenced artifact was not completely inspected
node scripts/imap.js check [--limit 10] [--mailbox INBOX] [--recent 2h]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
const path = require('path');
const os = require('os');
const fs = require('fs');
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });
function validateReadPath(inputPath) {
let realPath;
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
const path = require('path');
const os = require('os');
const fs = require('fs');
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });
function validateReadPath(inputPath) {
let realPath;
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
const path = require('path');
const os = require('os');
const fs = require('fs');
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });
function validateReadPath(inputPath) {
let realPath;
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
echo " IMAP/SMTP Email Skill Setup"
echo "================================"
echo ""
echo "This script will help you create a .env file with your email credentials."
echo ""
# Prompt for email provider
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
echo " IMAP/SMTP Email Skill Setup"
echo "================================"
echo ""
echo "This script will help you create a .env file with your email credentials."
echo ""
# Prompt for email provider
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
echo " IMAP/SMTP Email Skill Setup"
echo "================================"
echo ""
echo "This script will help you create a .env file with your email credentials."
echo ""
# Prompt for email provider
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
echo " IMAP/SMTP Email Skill Setup"
echo "================================"
echo ""
echo "This script will help you create a .env file with your email credentials."
echo ""
# Prompt for email provider
At this point the script begins writing a .env file that includes IMAP and SMTP credentials, resulting in persistent plaintext storage of authentication secrets. In the context of an email skill, those credentials grant broad mailbox access and sending capability, making compromise more sensitive than ordinary app configuration.
read -p "Allowed directories for reading files (comma-separated, e.g. ~/Downloads,~/Documents): " ALLOWED_READ_DIRS
read -p "Allowed directories for saving attachments (comma-separated, e.g. ~/Downloads): " ALLOWED_WRITE_DIRS
# Create .env file
cat > .env << EOF
# IMAP Configuration
IMAP_HOST=$IMAP_HOST
This finding is effectively the same credential-storage issue: the heredoc writes configuration that includes email account secrets into .env. Because these are live mailbox credentials, exposure could allow reading mail, sending mail as the user, and accessing sensitive attachments or reset links.
read -p "Allowed directories for saving attachments (comma-separated, e.g. ~/Downloads): " ALLOWED_WRITE_DIRS
# Create .env file
cat > .env << EOF
# IMAP Configuration
IMAP_HOST=$IMAP_HOST
IMAP_PORT=$IMAP_PORT
The skill requires environment variables, invokes shell commands via Node/NPM, and performs network access to IMAP/SMTP servers, but it does not declare an explicit tool scope such as permissions or allowed-tools. That makes the skill's effective capabilities broader and less transparent to users or policy engines, increasing the risk of unintended credential use, external data exfiltration, or unauthorized email actions.
The skill can transmit email contents and attachments to external servers and download attachments locally, but the user-facing description lacks an explicit privacy and external-action warning. In this context, that matters because the skill handles highly sensitive data and can cause outbound communication, making accidental disclosure or unsafe use more likely.
This code builds an IMAP connection using IMAP_USER and IMAP_PASS and then connects to the configured host, which necessarily transmits credentials and email access over the network. While the file has a high-level docstring, it does not visibly warn the user in code that their mailbox credentials and message data will be sent to a remote IMAP server.
The download command creates directories and writes attachment content to the local filesystem, which can affect user data and storage state. Although the function name and command imply downloading, the code does not provide a visible warning, confirmation, or explicit user disclosure when performing these file writes.
This code reads sensitive SMTP credentials from environment variables and uses them to establish an outbound SMTP connection that can transmit message content and attachments. Although the file has a high-level docstring describing email sending, it does not clearly warn users that credentials will be used and that message data will be transmitted to an external SMTP server.
The skill reads local files for attachments and email content, then includes that data in outbound email messages. While file path restrictions are enforced, there is no explicit disclosure in the user-facing usage/help or runtime output that selected files will be read and their contents may be sent externally.
The test command is presented as a connection check, but it also sends a real email to SMTP_USER. That side effect can trigger unintended outbound communication, leak that the account is active, and surprise users or automation that expected a non-invasive health check.