githubEdit

SMTP Pentesting

SMTP (Simple Mail Transfer Protocol) Pentesting

It is used for sending e-mail. POP3 or IMAP are used for receiving e-mail. Default ports are 25 (SMTP), 465 (SMTPS), 587 (SMTPS).

Enumeration

nmap --script smtp-brute -p 25,465,587 <target-ip>
nmap --script smtp-commands -p 25,465,587 <target-ip>
nmap --script smtp-enum-users -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>
nmap --script smtp-vuln-cve2011-1764 -p 25,465,587 <target-ip>
nmap --script smtp-* -p 25,465,587 <target-ip>

MX Domains

dig mx example.com

Users

# VRFY - check if the user exists in the SMTP server
smtp-user-enum -M VRFY -u <username> -t <target-ip>
smtp-user-enum -M VRFY -U usernames.txt -t <target-ip>

# RCPT - check if the user is allowed to receive mails in the SMTP server
smtp-user-enum -M RCPT -u <username> -t <target-ip>
smtp-user-enum -M RCPT -U usernames.txt -t <target-ip>

# EXPN - reveal the actual email address
smtp-user-enum -M EXPN -u <username> -t <target-ip>
smtp-user-enum -M EXPN -D <hostname> -U usernames.txt -t <target-ip>

STARTTLS

Connect

Commands

Commands are not case sensitive.

HELO - Identify SMTP Server

EHLO - List all supported enhanced functions

  • 8BITMIME - allow to send 8-bit data

  • AUTH - authentication for the SMTP connection

  • CHUNKING - transfer chunks of data

  • DSN (Delivery Status Notifications) - notify delivery status

  • ENHANCEDSTATUSCODES - allow to show more details of the status

  • ETRN - process remote queue

  • EXPN - expand mailing list

  • HELP - help about commands

  • PIPELINING - allow the multiple commands

  • SIZE - maximum message size that can be received

  • SMTPUTF8 -

  • STARTTLS - communicate with TLS

  • SEND - send message to terminal

  • TURN - swap client and server

  • VRFY - check if the user exists in the SMTP server

Auth Login

The AUTH LOGIN command allows us to login. We need to input username/password in Base64. Here is the example:

Messages

Others

Send Mails from External

swaksarrow-up-right is a swiss army knife for SMTP.

Start SMTP Server

Last updated