SMTP 25,465,587
SMTP Scanning and Enumeration - Ports 25, 465, 587
SMTP (Simple Mail Transfer Protocol) is the standard protocol for sending emails across the Internet. Below are the methods for scanning and enumerating SMTP services across different ports.
SMTP Overview:
Default Ports:
Port 25: Used for unencrypted email transmission (deprecated for sending email).
Port 465: Used for SMTP over SSL (deprecated).
Port 587: Used for SMTP with STARTTLS, the recommended port for email submission.
Protocol: SMTP is used for the transfer of email messages between servers. It does not handle the retrieval of emails but only the sending part.
Enumeration Techniques:
Banner Grabbing:
Use
nc
ornmap
to grab the SMTP banner and get the version information.Example:
nc -vn <IP> 25 nc -vn <IP> 465 nc -vn <IP> 587
Unauthenticated Enumeration with Nmap:
Use
nmap
to detect SMTP service version and perform general enumeration.sudo nmap -sV -p25,465,587 -sC -A <IP>
SMTP Commands for Enumeration:
Use basic SMTP commands to communicate with the server and retrieve information. Example:
telnet <IP> 25 EHLO <domain> # Get supported features HELP # List supported SMTP commands
Check for Open Relay:
Test if the SMTP server is configured as an open relay, which could allow anyone to send emails through the server. Example:
telnet <IP> 25 HELO <domain> MAIL FROM:<sender@domain.com> RCPT TO:<recipient@domain.com> DATA Subject: Test This is a test email. .
SMTP Brute Force with Hydra:
Use Hydra to brute-force SMTP login attempts with a wordlist. Example:
hydra -t 1 -l <username> -P <password_list> -vV <IP> smtp
Automated Checks with Nmap Scripts:
Use
nmap
scripts to check for known vulnerabilities and misconfigurations in SMTP services. Example:nmap --script=smtp-* -p 25,465,587 <IP>
SMTP with STARTTLS (Port 587):
Use
openssl
ornmap
to check for the presence of STARTTLS support. Example:openssl s_client -connect <IP>:587 -starttls smtp nmap -p 587 --script=starttls <IP>
SSL/TLS Version Enumeration (Port 465):
Use
openssl
to test SSL/TLS versions for SMTP over SSL on port 465. Example:openssl s_client -connect <IP>:465
SMTP Authentication Check:
Check if SMTP authentication is enabled and test for weak credentials. Example:
telnet <IP> 25 EHLO <domain> AUTH LOGIN # If supported, try base64 encoding credentials
Check for SMTP Server Version:
Enumerate SMTP version to check for known vulnerabilities in the server version. Example:
telnet <IP> 25 EHLO <domain>
Useful Tools for Scanning:
Nmap: For version detection, script scanning, and vulnerability checks.
Hydra: For brute-forcing SMTP credentials.
Telnet: For basic manual enumeration of the SMTP server.
openssl: For checking SSL/TLS support on SMTP servers.
smtp-user-enum: For enumerating valid email addresses or usernames.
Last updated