Work in progress

SMTP Introduction

ProtocolPortDescription
SMTP25
465
587
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

CommandDescriptionRFC
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

SMTP Penetration Testing

SMTP Tools

ToolDescriptionDownload
swaksSwiss Army Knife for SMTP
smtp-user-enum
nmapNetwork Scanner

Nmap

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>

Metasploit

SWAKS

swaks --to remote-user@example.com --from local-user@<local-ip> --server mail.example.com --body "hello"
sendEmail -t dept@victim.com -f support@rfs.com -s 192.168.8.131 -u Important Upgrade Instructions -a /tmp/BestComputers-UpgradeInstructions.pdf

SMTP Scanning

nmap –script smtp-enum-users.nse 172.180.22.16
nmap -p25 --script smtp-open-relay 172.180.22.16 -v
nmap -p25 --script smtp-commands 172.180.22.16

SMTP Enumeration

nc -vn 172.180.22.16 25

auxiliary/scanner/smtp/smtp_enum

SMTP Exploitation

SMTP Post Exploitation

sudo python -m smtpd -n -c DebuggingServer :25

SSH Penetration Testing

FTP penetration testing

RDP Penetration Testing

SMB Penetration Testing

PostgreSQL Penetration Testing