Spam Deterrence

April 1st, 2008

I’ve always been bugged about how much spam the server has processed. Even though only a few of our domains have email set up, we were processing several thousand spam messages a month. Stealing away cycles and clogging inboxes.

Looking at our mail server config, I realized that we were accepting mail for users that didn’t exist and sending them along to a catch-all account. For no good reason! So it was a rather simple fix to deny all mail destined for unknown users, and it appears that it’s paying off… bigtime.

Check out the reduced load on the mail server here, and the reduced CPU usage here. You’ll need to use your server name and password to view these stats.

The end result is that for those of you using the email server on FreeSTD.net, you should be seeing a lot less spam. Enjoy!

Recent wonkiness

May 20th, 2007

I feel like I should write something here about recent mail issues. Due to an unforeseen injection problem on the contact page Eric and I had written for my father’s plant nursery, a large number of bots from zombie computers were injecting extra email headers. The net effect of this was a huge spike in mail traffic, up to, I believe, somewhere around >8k msgs/min at one point in the past week.

I have fixed the problem, but I’d like to bring what caused it to light so anyone implementing similar functionality on a site hosted here can handle it appropriately. The first problem is php’s mail() function. Here is how I have it used, directly from contact.php:


mail("$to", "$subject", "$message", "From: $name<$email>“);

The problem here is that this function does no sanity checks on these variables at all. It’s a simple wrapper to a system call for emailing a message. As such, if invalid data is entered into one of these variables, it will get passed directly to the OS. In our situation, the attacker was entering tons of extra headers into the $name field on the page. Most of these headers were bcc:. When passed to the OS, these extra headers get interpreted instead of the simple From: header I have here.

A mediocre solution to this is to limit field size. I’ve implemented some field length restrictions, but a better solution is to include a Captcha into the code. I’ve implemented a simple one that is visible to everyone in rabbitridgenursery’s web directory anyone on the server can view. However, after including a captcha image on the submit form, my father was still receiving spam from it! This brings us to problem number 2:

The way the captcha works is:
1. A user visits contact.php
2. contact.php makes a request to php_captcha.php for an image.
3. php_captcha.php creates the image and sets a session variable containing the actual value embedded in the captcha image.
4. The user POSTs the form, whereupon the entered code is compared against the one in the session variable.
5. If the two variables are equal, the email gets sent.

This intended operation was obviously not working though, as the spam was still coming. A closer inspection gave the reason: The bot was not making any GET requests to contact.php, and thus no requests to php_captcha.php. It was simply POSTing to the page, without the captcha variable set. So without the request to the captcha page, the session variable never gets set, and the final comparison for validation is done between two empty variables. Obviously this was making a successful comparison, and the mail was still getting sent.

The final solution includes field length limits (why would you ever need > 100 characters for your email or name?) and a check for the captcha session variable being empty. This appears to have captured all the spam attempts, which I’ve been logging since I edited the code. This log can be seen by anyone at http://mytor.net/log. As you can see, the ‘attack’ has still been going on for quite a while. I’m going to set up a script later today to parse this file and add appropriate (ie, non-’mistake’ failed captchas) IPs to our global deny list.

In all actuality most users probably never noticed the issue except my father. If anyone wants any more details, email me at loren@mytor.net.

newest domain

November 25th, 2006

A FreeSTD welcome to mikenovido.com!

More new domains

October 12th, 2006

We’re growing! Welcome aboard to:

New Domains

August 28th, 2006

Welcome to our newest domains: lindsayadam.com and nateerlin.com. Glad to have you here!

Server dues now online

August 11th, 2006

You can find a text file with who’s paid what here. Email Eric with any questions you may have. Thanks!

Help and administration wikis added

June 4th, 2006

Under the links to the right side of this page, we’ve added a “help” and “administration” wiki. The help wiki is for all users and will include topics like setting up new domains, getting started with email, passwords, etc. The administration wiki is intended for the wheel group only and contains system configuration information.

Welcome to FreeSTD!

May 31st, 2006

FreeSTD.net went online today after Pat stopped by the data center and gave them our baby. This domain (freestd.net) will serve as our “primary” domain. Bookmark this page, as we’ll be updating it with information on how to use the server’s many wonderful features.