Problem solve Get help with specific problems with your technologies, process and projects.

Eliminating the threat of spam email attacks

Spam emails cluttering your inbox aren't just a minor inconvenience; these annoying messages can infect your systems with harmful code, viruses and Trojans. Contributor Scott Sidel examines SpamAssassin, an open source software tool designed to keep these malicious messages at bay.

Spam isn't just about deposed Nigerian dictators who want to send you millions of dollars. Spam emails often contain malicious code, viruses, phishing attacks, and drive-by Trojans -- not to mention some inappropriate content. One of the best weapons available to defend your systems against spam is the open source software SpamAssassin.

SpamAssassin interacts with the mail server and analyses each email message using multiple methods of detection. Integrity analysis examines mail message headers and bodies to identify the common characteristics of spam. Heuristic rules detect spam messages by testing all content and producing scores for spam and non-spam criteria. The more spam-like elements the system detects, the higher the score, indicating the message is likely spam and should be handled as such.

For more information:

In this Q&A, application security pro Michael Cobb examines if blacklists and whitelists stop spam.

Security expert Mike Rothman examines how the emergence of reputation-based systems is simplifying the battle against spam.

In this tip, security expert Joel Dubin examines if the CAN-SPAM Act has effectively cracked down on spamming activities.

U.K. security expert Michael Cobb discusses how to stop spam email related to news events in this tip. 


SpamAssassin consists of two main components: A message filter and a rules engine. The message filter incorporates backend code and the user interface, and performs several tasks -- including reading in messages, parsing into an internal format and rewriting messages. The rules engine handles the processing of hundreds of rules over the message content. The engine determines the final message score, and whether or not the message should be auto-learned via the Bayesian system and the other rules utilized. Despite the parsing and processing -- using a weighting system to intelligently determine if a message should be considered spam -- SpamAssassin is amazingly fast, handling thousands of messages with ease.

SpamAssassin also uses internally generated blacklists and whitelists from external sources, providing for known bad and good mail handling. The "AutoWhiteList" feature adds intelligence by dynamically adjusting the whitelist based on history. For instance, if a sender typically sends non-spam emails, and then happens to send a message that looks like spam, SpamAssassin uses it's history report to move the message score back toward a non-spam average -- adjusting the overall spam rating to compensate for the message being sent by a known sender.

Content filtering identifies key words or phrases, including purposefully trans-coded and obfuscated URLs. DNS block-lists, which are available on the Internet, allow SpamAssassin to block known spam senders. SpamAssassin also makes use of third-party plug-ins. For example, in a prior article I noted that Clam AntiVirus can provide SpamAssassin input if a message contains a virus, adding to SpamAssassin's weighted spam score.

SpamAssassin is available for Linux, Windows and Mac OS X platforms. If you run a mail server, you shouldn't do it without SpamAssassin.

About the author:
Scott Sidel is an Information Systems Security Officer (ISSO) at Lockheed Martin

This was last published in June 2007

Dig Deeper on Open source security tools and software

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.