Categories: discovery, intrusive, external
Attempts to relay mail by issuing a predefined combination of SMTP commands. The goal of this script is to tell if a SMTP server is vulnerable to mail relaying.
An SMTP server that works as an open relay, is a email server that does not verify if the user is authorised to send email from the specified email address. Therefore, users would be able to send email originating from any third-party email address that they want.
The checks are done based in combinations of MAIL FROM and RCPT TO commands. The list is hardcoded in the source file. The script will output all the working combinations that the server allows if nmap is in verbose mode otherwise the script will print the number of successful tests. The script will not output if the server requires authentication.
If debug is enabled and an error occurs while testing the target host, the error will be printed with the list of any combinations that were found prior to the error.
Use this to change the IP address to be used (default is the target IP address)
Define the destination email address to be used (without the domain, default is relaytest)
or smtp-open-relay.domain Define the domain to be used in the anti-spam tests and EHLO command (default is nmap.scanme.org)
Define the source email address to be used (without the domain, default is antispam)
smbdomain, smbhash, smbnoguest, smbpassword, smbtype, smbusernameSee the documentation for the smbauth library.
nmap --script smtp-open-relay.nse [--script-args smtp-open-relay.domain=<domain>,smtp-open-relay.ip=<address>,...] -p 25,465,587 <host>
Host script results: | smtp-open-relay: Server is an open relay (1/16 tests) |_MAIL FROM:<firstname.lastname@example.org> -> RCPT TO:<email@example.com>
License: Same as Nmap--See https://nmap.org/book/man-legal.html