SMTP Enumeration (Ports 25, 465, 587)
Enumerate SMTP servers to identify mail providers, valid users, and potential open relay misconfigurations.
SMTP user enumeration can provide valid usernames for password spraying attacks against mail services.
Quick Reference
# Banner grabbing |
SMTP Ports
- Port 25: SMTP (unencrypted)
- Port 465: SMTPS (SMTP over SSL)
- Port 587: SMTP with STARTTLS
Identify Mail Provider
# Check MX records |
Banner Grabbing
# Using netcat |
User Enumeration
Manual Enumeration
# Connect with telnet |
Automated Enumeration
# smtp-user-enum with VRFY |
Nmap NSE Scripts
# SMTP enumeration |
Password Spraying
# Hydra against SMTP |
Office 365 Enumeration
# Validate domain uses O365 |
Open Relay Testing
# Check with Nmap |
Common Workflow
# Step 1: Identify mail provider |
Notes
SMTP Commands:
- HELO/EHLO: Identify client to server
- MAIL FROM: Specify sender
- RCPT TO: Specify recipient
- DATA: Begin message content
- VRFY: Verify user exists
- EXPN: Expand mailing list
- HELP: Show available commands
- QUIT: Close connection
User Enumeration Methods:
VRFY: Verifies if email address exists
- Response 250: User exists
- Response 550: User doesn’t exist
EXPN: Expands mailing list/alias
- Returns all members of a group
RCPT TO: Identifies valid recipients
- Response 250: Valid recipient
- Response 550: Invalid recipient
Mail Provider Identification:
Cloud providers:
aspmx.l.google.com- Google Workspace*.mail.protection.outlook.com- Microsoft 365mx.zoho.com- Zoho Mail
On-premise indicators:
- MX record points to company domain
- Custom mail server hostname
Open Relay:
An SMTP server that allows anyone to send email through it without authentication. Can be abused for:
- Phishing campaigns
- Spam distribution
- Email spoofing
Common Misconfigurations:
- VRFY/EXPN/RCPT TO commands enabled
- No authentication required
- Open relay configuration
- Verbose error messages
- Default credentials
Office 365 Specific:
O365 uses modern authentication but older protocols (SMTP, POP3, IMAP) may still be enabled:
- Username format:
user@domain.com - Password spraying detection is in place
- Use
--count 1 --lockout 1to avoid lockouts
Best Practices:
- Always check MX records first
- Enumerate users before password spraying
- Use small user lists to avoid detection
- Respect lockout policies
- Test for open relay (high-value finding)
- Check both encrypted and unencrypted ports
- Look for NTLM information disclosure
Related Services:
- POP3 (110, 995): Mail retrieval
- IMAP (143, 993): Mail retrieval with folder support
- Often use same credentials as SMTP