Sunday, October 6, 2019

Enumerating SMTP Servers with Metasploit

Grabbing SMTP Banners

Metasploit peforms simple banner grabbing with its smtp_version module. The only option you need to set to get going is the RHOSTS option.

msf5 > use auxiliary/scanner/smtp/smtp_version
msf5 auxiliary(scanner/smtp/smtp_version) > set RHOSTS 192.168.0.38
RHOSTS => 192.168.0.38
msf5 auxiliary(scanner/smtp/smtp_version) > run

[+] 192.168.0.38:25       - 192.168.0.38:25 SMTP 220 asus ESMTP Postfix (Ubuntu)\x0d\x0a
[*] 192.168.0.38:25       - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf5 auxiliary(scanner/smtp/smtp_version) > 

Check for open SMTP relays

You can check for open relays with metasploit using the smtp_relay module.

msf5 > use auxiliary/scanner/smtp/smtp_relay
msf5 auxiliary(scanner/smtp/smtp_relay) > set RHOSTS 192.168.0.38
RHOSTS => 192.168.0.38
msf5 auxiliary(scanner/smtp/smtp_relay) > run

[+] 192.168.0.38:25       - SMTP 220 asus ESMTP Postfix (Ubuntu)\x0d\x0a
[*] 192.168.0.38:25       - No relay detected
[*] 192.168.0.38:25       - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf5 auxiliary(scanner/smtp/smtp_relay) >

Enumerate SMTP Users

Here metasploit will attempt to uncover possible users on the system using SMTP to verify is the user exists on the system or not. By default metasploit uses the 'unix-users.txt' wordlist from its data directory. You can set your own user file by specifying the 'USER_FILE' option.

msf5 > use auxiliary/scanner/smtp/smtp_enum
msf5 auxiliary(scanner/smtp/smtp_enum) > set RHOSTS 192.168.56.102
RHOSTS => 192.168.56.102
msf5 auxiliary(scanner/smtp/smtp_enum) > run

[*] 192.168.56.102:25     - 192.168.56.102:25 Banner: 220 metasploitable.localdomain ESMTP Postfix (Ubuntu)
[+] 192.168.56.102:25     - 192.168.56.102:25 Users found: , backup, bin, daemon, distccd, ftp, games, gnats, irc, libuuid, list, lp, mail, man, news, 
nobody, postgres, postmaster, proxy, service, sshd, sync, sys, syslog, user, uucp, www-data
[*] 192.168.56.102:25     - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf5 auxiliary(scanner/smtp/smtp_enum) > 

No comments:

Post a Comment

Exploiting Weak WEBDAV Configurations

The server we are going to audit has the following fingerprint. 80/tcp open http Apache httpd 2.2.8 ((Ubuntu) DAV/2) Next we need t...