SMTP Open Relay Testing
An open relay accepts mail from any sender to any recipient without authentication — including external domains. This allows an attacker to send email through the target's mail server, which is trusted by spam filters, SPF checks, and recipient mail systems. Open relays are a direct path to phishing delivery and spam abuse through a trusted IP. Confirmed open relay moves to relay exploitation.
Automated Relay Check with nmap
The smtp-open-relay NSE script tests multiple relay bypass combinations automatically:
| smtp-open-relay: Server is an open relay (16/16 tests) |_ MAIL FROM:<> -> RCPT TO:<[email protected]>
16/16 tests passing confirms a fully open relay. Even partial results like 4/16 indicate some relay bypass conditions exist and warrant manual verification.
Manual Relay Confirmation
Connect and attempt to route a message from an external sender to an external recipient. Both addresses must be outside the target domain:
220 mail.company.com ESMTP
EHLO attacker.com
MAIL FROM:<attacker@@attacker.com>
RCPT TO:<target@@external-domain.com>
DATA
Subject: relay-test
relay-test-body
.
QUIT
250 2.0.0 Ok: queued as A1B2C3D4E5
A queued response without authentication confirms open relay. The server accepted a message with an external sender to an external recipient and queued it for delivery. Some servers accept RCPT but reject at the DATA or queue stage — test with a controlled inbox you own to confirm actual delivery if your engagement rules permit.
Relay Bypass Variants
Some servers block obvious relay attempts but miss certain bypass patterns. Test these when a direct relay attempt is rejected:
Check SPF Record
Confirm whether the target domain has an SPF record that would limit relay impact. If SPF is absent or has a soft fail (~all), relay abuse is harder to detect and filter by recipients:
"v=spf1 include:mailgun.org ~all"
~all is a soft fail — most mail will still be delivered even if it fails SPF. -all is a hard fail. No SPF record means any server can claim to send mail from this domain. Combine open relay with absent or weak SPF to assess the full phishing risk.
References
-
nmap — smtp-open-relay NSEnmap.org/nsedoc/scripts/smtp-open-relay.html (opens in new tab)
Automated open relay bypass testing with 16 test combinations
Was this helpful?
Your feedback helps improve this page.