Recently a friend ask me how does he knows if his mail server is vulnerable to impersonation or relay attacks. (SPAM, Phishing, etc)
First we have to think why these attacks happen. For one thing there is no authentication/authorization on the SMTP connections between servers and mostly misconfiguration. Sometime we think we did all there is to do when configuring our serves an sometime we trust what vendors say (are we suppose to?), but that the way to tragedy in security.
First how do I test if my SMTP server is vulnerable? Just try this:
- telnet [mail_server] 25
- mail from: email@example.com
- rcpt to: firstname.lastname@example.org
- This is a test from my self
Also to see if your server rejects invalid data/messages you can set up an stmp server that is vulnerable to these attacks and SPAM/Phish yourself. Windows Server and Linux both come with built-in SMTP server you can setup. Also you can download a tool like FreeSMTP (http://www.softstack.com/freesmtp.html) and avoid tha hasle of setting up mail services on a server.
PLEASE! be good to others don’t spam/phish anyone.
How do you defend your self from this?
- Authenticate user SMTP connections to your servers: This will stop an anonymous user to connect to the server if it doesn’t have an account and validates/authenticates with the server.
- Use SSL : This will give some protection by encrypting the connection and preventing MITM or sniffing of data. Remember to use valid certificates and to educate your users. If the attacker has privilege access to your network or the users end connection you are screwed anyway.
- Only relay messages for your domains.
- Add an SPF record in the DNS. (TXT record with SFP info) http://en.wikipedia.org/wiki/Sender_Policy_Framework
- Use domain keys on your DNS records a.k.a DKIM: https://en.wikipedia.org/wiki/DKIM
- Finally there is a standard that sorts of combines SFP and DKIM thats called DMARC that’s still in development give it a look http://dmarc.org/
Hope this helps,