Reconstructing SMTP Email Sessions and Extracting Attachments from Network Traffic Captures
Theory
Why This Matters
The 2016 DNC breach — attributed to APT28 — used spearphishing emails delivered via SMTP as the initial access vector, but the lateral-movement phase also involved exfiltrating harvested credentials and internal documents through the victim organisation's own SMTP relay. Post-incident forensic analysts recovered the full email content, attachment data, and destination addresses by replaying captured SMTP traffic. Corporate email accounts are among the most valuable exfiltration channels available to attackers: they are permitted outbound through almost every firewall, they blend with legitimate high-volume traffic, and they support large attachments that can carry compressed archives. Recognising and dissecting SMTP traffic in a PCAP — including extracting BASE64-encoded credentials and reconstructing MIME attachments — is a required skill for network forensic analysts.
Core Concept
SMTP (Simple Mail Transfer Protocol) operates by default on TCP port 25 (server-to-server relay), port 587 (mail submission from authenticated clients — MSA), and port 465 (SMTPS — SMTP wrapped in TLS). The protocol is command/response: the client issues a command, the server responds with a three-digit numeric code.
The standard session sequence: EHLO/HELO (identify client), optionally STARTTLS (upgrade to TLS), AUTH (authenticate), MAIL FROM (envelope sender), RCPT TO (one or more recipients), DATA (begin message body, terminated by .), QUIT.
AUTH LOGIN sends the username and password as separate base64-encoded values in response to server challenges. AUTH PLAIN sends a single base64-encoded string containing