T09 · Insecure Skill Coding Practices
- Location
SKILL.md:63- Finding
SMTP Command Injection Through Unsanitized Email Addresses
- Content
View full analysis
\r\n") time.sleep(2) s.recv(512) s.send(f"RCPT TO:<{email}>\r\n".encode()) time.sleep(2) resp = s.recv(512).decode() code = resp[:3] # 250 = valid, 550 = nonexistent s.send(b"QUIT\r\n") s.close() time.sleep(3) ``` ### Technical Analysis The workflow collects or infers email addresses from external web content and interpolates each value directly into a raw SMTP command: ```python s.send(f"RCPT TO:<{email}>\r\n".encode()) ``` No validation rejects carriage returns, line feeds, control characters, malformed mailbox syntax, or oversized values. SMTP is a line-oriented protocol in which `\r\n` terminates a command. If an attacker-controlled email value contains CRLF characters, the value can terminate the intended `RCPT TO` command and append additional SMTP commands. This also invalidates the document's assertion that execution stops safely at the `RCPT TO` stage. The code does not technically enforce that boundary when untrusted input can inject protocol delimiters. ### Attack Path 1. An attacker publishes a crafted email-like value on a company website, search result, or another source processed during the contact-discovery phase. 2. The Agent extracts the value and adds it to the `emails` collection without strict mailbox validation. 3. The crafted value contains an SMTP delimiter and an additional command, conceptually: ```text victim@example.com>\r\nADDITIONAL_SMTP_COMMAND ``` 4. The s ...[truncated 1164 chars]- Remediation
View remediation
