T09 · Insecure Skill Coding Practices
- Location
SKILL.md:76- Finding
SMTP Credentials and Email Content Can Be Transmitted Without Encryption
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 76–92
Vulnerability Type: Optional plaintext SMTP authentication and transmission
Risk Level: Highpython def send(self, draft_id: int, smtp_host: str, smtp_port: int, username: str, password: str, use_tls: bool = True) -> dict: draft = next((d for d in self.drafts if d["id"] == draft_id), None) if not draft: return {"error": f"Draft #{draft_id} not found"} msg = self.build_mime(draft_id) if not msg: return {"error": "Failed to build MIME message"} try: server = smtplib.SMTP(smtp_host, smtp_port, timeout=10) if use_tls: server.starttls() server.login(username, password) server.send_message(msg)Technical Analysis
The
sendmethod permits the caller to setuse_tls=False. Authentication throughserver.login(username, password)and message transmission throughserver.send_message(msg)still occur when TLS is disabled.SMTP authentication mechanisms frequently encode credentials but do not encrypt them. Without transport encryption, a network observer or a malicious intermediary can recover the username and password and inspect or modify recipient information, subjects, and message bodies. Network access is necessary for the declared email-sending functionality, but permitting unencrypted authentication is not necessary and violates secure minimum-privilege handling of mailbox credentials.
Attack Path
- A user, integration, or unsafe configuration invokes
sendwithuse_tls=False. - The Skill opens a plaintext SMTP connection to the caller-specified host and port.
server.login()sends authentication data without a protected TLS channel.- A network-positioned attacker, compromised access point, or malicious SMTP endpoint captures the authentication exchange.
- The attacker recovers the credentials and observes or ...[truncated 714 chars]
- A user, integration, or unsafe configuration invokes
- Remediation
View remediation
Remediation Suggestions
- Remove the
use_tls=Falsecapability and require an encrypted transport before authentication. - For implicit TLS endpoints, use
smtplib.SMTP_SSLwithssl.create_default_context(). - For STARTTLS endpoints, create a verified SSL context, call
starttls(context=context), and abort if negotiation or certificate validation fails. - Authenticate only after successful TLS establishment.
- Validate SMTP hosts and ports against an explicit user-approved configuration when the surrounding platform supports destination restrictions.
- Prefer provider-scoped application passwords or OAuth tokens instead of reusable account passwords.
- Ensure errors do not expose credentials or other authentication material.
- Document that certificate verification must never be disabled.
- Remove the
