05 Jan 2023
Email requires protocol pair, SMTP and POP/IMAP. SMTP server performs three basic functions:
Deeper breakdowns into sub protocols and such: https://computer.howstuffworks.com/e-mail-messaging/email3.htm
https://www.afternerd.com/blog/smtp/
SMTP server software available on Windows server and Linux.
Poorly configured or vulnerable mail servers can provide an initial foothold to a network, but you need to fingerprint the server for precise targeting. This task uses āsmtp_versionā module of metasploit. Scans IP Address range and determines the version of any mail servers encountered.
SMTP service has internal commands that help enumerate users:
Non-metasploit tools include āsmtp-user-enumā, which works better for enumerating OS-level accounts on Solaris via SMTP. Works by inspecting responses to VRFY, EXPN, and RCPT TO commands. Could be adapted to other vulnerable SMTP dameons. (Alternative worth keeping in mind if trying to distance self from Metasploit, e.g. in ppreparation for OSCP).
Enumerate the task SMTP VM.
Start with nmap scan nmap -v -A -p-
Start Metasploit with msfconsole
Search for known named module with search fullname:smtp_version
Select modules from list with use <#>
Show options to fill in with options
Set options
Run module with run
Switch to āsmtp_enumā module
Set user_list (wordlist) and rhosts options
Run module
All info grabbed. Had multiple usernames but was only looking for one, and had to guess.