Port 25 / TCP
SMTP
Port 25 – SMTP Protocol Specification
Technical analysis, security advisories, vulnerability mitigation, and firewall syntax for TCP/UDP port 25 (SMTP).
Port Number
25
Transport Protocol
TCP
Port Range Type
Well-Known (0-1023)
Default Status
Restricted / LAN
Service Description & Architectural Context
Simple Mail Transfer Protocol used for MTA email relay.
IANA / RFC Designation:
Port 25 is assigned to SMTP under the Internet Assigned Numbers Authority (IANA) service name registry. In enterprise infrastructure and homelab setups, services listening on this port must follow the principle of least privilege.
Security Analysis & Attack Surface Assessment
Prevent open relay. Require STARTTLS and implement SPF, DKIM, and DMARC.
Hardening Recommendations:
- Do not expose port 25 to public WAN interfaces unless authenticated TLS or VPN wrapping is strictly enforced.
- Enforce rate-limiting using Fail2ban, CrowdSec, or cloud edge DDoS protection.
- Audit active listening sockets locally:
ss -tulpn | grep :25ornetstat -ano | findstr :25.
Firewall Rule Snippets for Port 25
UFW (Ubuntu / Debian Linux)
sudo ufw allow 25/tcp
iptables (Standard Linux Kernel)
sudo iptables -A INPUT -p tcp --dport 25 -j ACCEPT
Windows PowerShell (Defender Advanced Firewall)
New-NetFirewallRule -DisplayName "Allow Port 25" -Direction Inbound -LocalPort 25 -Protocol TCP -Action Allow