Explore this comprehensive guide on SMTP penetration testing, a crucial technique for assessing the security of your email servers.

In this article, Kali is used as a client, and a Windows Server 2012 as an SMTP Server.

SMTP Introduction

MUA → MSA → MTA → internet → MTA → MDA → MUA
Outlook → Exchange → firewall → internet → SMTP-Server of the receiving side → mail-server of the receiving side → Outlook of receiver

SMTP Commands

HELOIdentifies the sending SMTP serverRFC 5321
EHLOExtended HELO, provides more informationRFC 5321
MAIL FROMSpecifies the sender’s email addressRFC 5321
RCPT TOSpecifies the recipient’s email addressRFC 5321
DATAInitiates the message data transmissionRFC 5321
RSETResets the session to initial stateRFC 5321
VRFYRequests verification of an email addressRFC 5321
EXPNRequests the expansion of a mailing listRFC 5321
NOOPNo operation, used for testing or keep-aliveRFC 5321
QUITCloses the SMTP sessionRFC 5321
AUTHInitiates authentication processRFC 4954
STARTTLSInitiates a secure TLS sessionRFC 3207
HELPRequests help information from the serverRFC 5321

RFC 821 – Simple Mail Transfer Protocol

Protocol definition for SMTP. This document covers the model, operating procedure, and protocol details for SMTP.

RFC 1869 – SMTP Service Extensions

Definition of the ESMTP extensions for SMTP. This describes a framework for extending SMTP with new commands, supporting dynamic discovery of the commands provided by the server, and defines a few additional commands.

SMTP Penetration Testing

  1. SMTP Tools
  2. Footprinting SMTP Service
  3. Enumerate SMTP Service
  4. SMTP Vulnerabilities
  5. SMTP Attacks

SMTP – Pentest Tools

swaksSwiss Army Knife for SMTP
nmapNetwork Scanner
THC Hydra

SMTP Reconnaissance

Nmap SMTP NSE Scripts

nmap --script smtp-brute,smtp-commands,smtp-enum-users,smtp-vuln-cve2011-1764 -p 25,465,587 <target-ip>
nmap --script smtp-ntlm-info --script-args smtp-ntlm-info.domain=example.com -p 25,465,587 <target-ip>

SMTP Metasploit Modules


Footprinting SMTP Service

sudo nmap -sC -sV -p25,465,587

SMTP Enumeration

SMTP Enumeration is a crucial aspect of the cybersecurity landscape that offers detailed insights into a system’s mail server.

This process is particularly significant for network administrators, IT professionals, and ethical hackers who are continuously working to identify and rectify system vulnerabilities.

In this article, we will delve into the world of SMTP Enumeration, its functions, merits, demerits, and the critical role it plays in network security.

Furthermore, we’ll explore different tools used in SMTP enumeration and discuss common strategies for preventing potential exploitation.

nmap -p25 --script smtp-commands
nc -vn 25

SMTP User Enumeration

nmap –script smtp-enum-users.nse
smtp-user-enum -M VRFY -U list.txt -t

Open Relay

sudo nmap -p25 --script smtp-open-relay -v
nmap -p25 --script smtp-open-relay -v

SMTP Vulnerabilities

SMTP Injection

Directory harvest attack (DHA)

SMTP Post Exploitation


swaks --to [email protected] --from local-user@<local-ip> --server mail.example.com --body "hello"
sendEmail -t [email protected] -f [email protected] -s -u Important Upgrade Instructions -a /tmp/BestComputers-UpgradeInstructions.pdf
sudo python -m smtpd -n -c DebuggingServer :25

SMTP Attacks

Attack TypeDescription
Email SpoofingForging the sender’s email address to appear as if it’s from a different source.
Email PhishingSending deceptive emails to trick recipients into revealing sensitive information.
Man-in-the-Middle (MITM)Intercepting and possibly altering communication between the email client and server.
Brute-Force AttacksRepeatedly attempting different username and password combinations to gain unauthorized access.
Email BombingFlooding an email inbox with an overwhelming number of emails, causing denial of service.
Email Relay AttacksExploiting open email relays to send spam or malicious emails through a compromised server.
SMTP User EnumerationDetermining valid email addresses by exploiting SMTP server responses.
SMTP Command InjectionManipulating SMTP commands to execute arbitrary code on the SMTP server.
SMTP Header InjectionInjecting malicious content into email headers to trick email clients into unintended actions.
Denial of Service (DoS)Overwhelming SMTP servers with excessive traffic, causing email service disruption.
Email HarvestingUsing automated tools to gather email addresses for spam campaigns or other malicious purposes.
Email EavesdroppingIntercepting unencrypted emails during transmission to access sensitive information.
Email Attachment ExploitsExploiting vulnerabilities in email attachments to execute malware on the recipient’s system.
Malicious Email AttachmentsSending attachments or links to infected files or websites to trick recipients into downloading malware or revealing sensitive information.
List of SMTP Attacks

SMTP Hacking Labs – Join us

SMTP Penetration Testing

SSH Penetration Testing

FTP penetration testing

RDP Penetration Testing

SMB Penetration Testing

PostgreSQL Penetration Testing