Enter your email address to be notified of new blog entries:

01/15/2006 - 1:54am

How to Stop SPAM


I think I've figured out how to stop spam and junk mail. First, it must be understood that legislation absolutely will not work, and for a variety of reasons. One, because the internet is global, and laws in one country don't govern the actions of people in another. Two, laws rarely prevent "bad" things from happening, they merely assign consequences to those things by labelling the doers as criminals. Someone intent on doing something will do so whether or not it is legal.

Second, it must be understood that the reason spam exists is because it's profitable. The only reason a spammer would send out thousands or millions of emails is because he makes more money by doing so than it costs to actually send the emails. So the solution is to make it unprofitable.

There are various spam filters on the market, and even free solutions. Personally, I like SpamAssassin, and it works well for me. The problem, however, is that spammers (like virus writers) are always one step ahead. They'll figure out how the spam filtering programs work, and reformat their emails so they don't appear to the filters as spam. But these filters do play a vital role.

There are really two kinds of spammers, the novice and the advanced. The novice will send emails out through his own ISP, and promptly be disconnected by his ISP for doing so. They aren't really a threat.

The advanced spammer will compromise an innocent bystander's server and bounce email off of it, as it doesn't get tracked back to him. The innocent bystander will eventually be shut down or blocked, and the spammer will move on to another.

Standard blacklists don't work because they have to be human-edited. I used to block a server by its IP address whenever I received spam from that server. That seriously reduced my spam rate, but it also blocked a lot of legitimate email, as I had inadvertantly blocked large ISPs like Earthlink and Cox. Bayesian filtering doesn't work, because spammers adapt too quickly. This is the same reason rule-based filtering doesn't work either.

But these legacy filters, as previously mentioned, play an important role in this system. Each time a filter, (like SpamAssassin) scans an email, it can determine whether or not it believes the email to be spam or ham (not spam). If it's spam, it sends an email to the server's administrator notifying them (as much spam comes from compromised systems, the administrator may be happy to know about it). It then reports this information to a central database.

Once a certain number of emails have come through, the filtering of this database kicks in. The number of spam emails received from a particular source is divided by the total number of emails from that source to yield a percentage of spam that a server sends. If that percentage is beyond a specified threshold, then the server is blacklisted. This happens only after a specified number of emails have been collected.

Here is the thought. A server that sends 100% spam is probably a server setup to send spam, and should be blocked. A server sending 20%-99% spam is a legitimate server that's been compromised. The emails previously sent to the administrator should alert him in time to repair the damage before the threshold is reached that would cause the database to filter emails coming from this server. If the administrator does nothing to fix the problem in spite of being informed of it, then the server will be (and should be) blocked. A server sending a much lower percentage is probably a normal mail server with a rogue user that may or may not be caught.

But what has happened here is that the majority of spam is now blocked, meaning that the cost per email to a spammer has gone up 5 or 10 fold; perhaps making it cost-prohibitive to send spam. And this is the goal, as its the only way to stop it.

Add Comment

Posted by: radloffe
08/13/2006 12:03pm

The only system that works currently is whitelist-only setup. You record specific list of users (or domains) who are allowed to send email to you and block everything else. If someone wants to send email to you, they have to request access from you via a non-email means so you can add them to the email list. Yes that sucks, but right now it's the only thing that actually works. And it's actually less time consuming to maintain the white list than it is to sort through the spam.

Posted by: Nick Coons
08/22/2006 10:43pm

Since I originally wrote this article several months ago, I've made some modifications to my current setup that have worked well. I utilize SpamAssassin on my mail server and it's always worked fairly well (about 80% spam blocked, 0 false positives). Since I receive 600 a day, this was a "better than nothing" solution.

I agree that whitelisting works well, and it's good for a home-user email situation. But the high risk of a sender being annoyed at having to have pre-approval makes this option unviable in a business environment.

I still use SpamAssassin, but with some simple configuration changes, I've been able to make it much more effective. Of the 600 or so spam emails per day that come in to my system, about five of them actually make it to the Inbox, making this filtering better than 99% effective. I receive so many spam emails per day because I've had my email addresses for so long, so others are not as likely to have this much junk coming through. The few that do make it through (while still maintaining a zero-positive rating) are much more preferred over a whitelist situation where a potential client gives up before being able to contact you.

For those interested, here is my /etc/mail/spamassassin/local.cf file:

required_hits 5.0
rewrite_header Subject [*****SPAM*****]
report_safe 1
use_bayes 1
bayes_auto_learn 1
bayes_file_mode 0666
skip_rbl_checks 0
use_razor2 1
use_dcc 1
use_pyzor 0
dns_available yes
ok_languages en
score DCC_CHECK 4.000
score SPF_FAIL 10.000
score SPF_HELO_FAIL 10.000
score RAZOR2_CHECK 2.500
score BAYES_99 4.300
score BAYES_90 3.500
score BAYES_80 3.000

Add Comment

Copyright 2004-2017 Arizona Paths

Arizona Paths Weather Button