The Simple Mail Transfer Protocol (SMTP) is a protocol for sending emails over an IP network. It can be used between an email client and an outgoing mail server or between two SMTP servers. SMTP is often combined with the IMAP or POP3 protocols, which can retrieve emails and send emails
Command: Description
AUTH PLAIN: AUTH is a service extension used to authenticate the client.
HELO: The client logs in with its computer name, thereby starting the session.
MAIL FROM: The client specifies the email sender.
RCPT TO: The client specifies the email recipient.
DATA: The client initiates the email transmission.
RSET: The client aborts the initiated transmission but maintains the connection between the client and the server.
VRFY: Verify users (enumerate them)
EXPN: The client also uses this command to check whether a mailbox is available for sending messages.
NOOP: The client requests a response from the server to avoid disconnection due to a timeout.
QUIT: The client ends the session.
To interact with the SMTP server, we can use telnet
Commands
HELO/EHLO
They are the same and are used to initiate the connection with the server
Nmap's default scripts include smtp-commands, which uses the EHLO command to enumerate all possible commands that can be executed on the target SMTP server
txt
sudo nmap 10.129.14.128 -sC -sV -p25
PORT STATE SERVICE VERSION
25/tcp open smtp Postfix smtpd
|_smtp-commands: mail1.inlanefreight.htb, PIPELINING, SIZE 10240000, VRFY, ETRN, ENHANCEDSTATUSCODES, 8BITMIME, DSN, SMTPUTF8, CHUNKING,
Open-Relay
To identify the target SMTP server as an open relay using 16 different tests
txt
PORT STATE SERVICE
25/tcp open smtp
| smtp-open-relay: Server is an open relay (16/16 tests)
| MAIL FROM:<> -> RCPT TO:<relaytest@nmap.scanme.org>
| MAIL FROM:<antispam@nmap.scanme.org> -> RCPT TO:<relaytest@nmap.scanme.org>
| MAIL FROM:<antispam@ESMTP> -> RCPT TO:<relaytest@nmap.scanme.org>
| MAIL FROM:<antispam@[10.129.14.128]> -> RCPT TO:<relaytest@nmap.scanme.org>
| MAIL FROM:<antispam@[10.129.14.128]> -> RCPT TO:<relaytest%nmap.scanme.org@[10.129.14.128]>
|_ MAIL FROM:<antispam@[10.129.14.128]> -> RCPT TO:<nmap.scanme.org!relaytest@ESMTP>