What a Malicious Server Scan Looks Like

Like most sites on the Web, Perishable Press is scanned constantly by malicious scripts looking for vulnerabilities and exploit opportunities. There is no end to the type and variety of malicious URL requests. It all depends on the script, the target, and the goal of the attack. Malicious scripts generally seek one of two things:

  • A resource that can be used to gain access and/or compromise security
  • A process vulnerability triggered by malicious request and used to gain access

Here is an example of what I’m talking about, a series of requests from the ubiquitous “contac.php” scan:


Looking for my Contact Form? I don’t think so. The “contac” script requests series of URLs from the target site, apparently looking for some payload script named “contac.php”. Pretty sneaky naming of the file, which most likely “blends right in” with other similarly named PHP on the server. Fortunately the presence of countless, random requests for a misspelled file jump right out of the 404 error logs.

To stop this nonsense from chewing up your system resources, we lift a finger with the following HTAccess:

RedirectMatch 403 /contac\.php$

That slice simply returns a 403 Forbidden error to all requests for that stupid file. Will it ever interfere with normal URL requests? Only if you can’t spell “contact”.

Other examples of malicious server scans

Here is another example of a typical server scan, obviously looking for some process vulnerability, as the requested file is site-specific and changes form with each request (my domain changed to example.com):


If you’re seeing this type of 404 request pattern in your access/error logs, check/verify that the file exists or doesn’t exist. These types of malicious scans are some of the most difficult to prevent, largely due to the randomness of the “character scrambling” of the request, but also because of the generality of the pattern. You could reduce the number of these types of requests by matching against the “.html” extension, but only if you’re certain that they aren’t used on your site. A typical WordPress blog might be a good example.

In my experience, the more general the request pattern (scan), the lower the threat. The most this particular sad scan is going to get from most servers is a series of 404 errors, which are easier to get and hardly useful for well-configured machines. Moving on..

Endless malicious requests

If you’re staying vigilant with your admin duties, you don’t need me to explain what malicious requests look like. They happen all the time, wasting resources and slowing things down for legitimate visitors.

To demonstrate the monotony and perpetuity of malicious scanning, consider my old Angry-Birds site, which features a complete map of the entire Angry-Birds game, something like 100+ pages online. Awesome for AB fanz, but sadly also a huge target for teh evil scripts. To get an idea of the impact, consider the following log excerpts (note: Angry-Birds site now offline, so replaced domain name with example.com in the following log entries).


See the pattern? And it just goes on and on, without end. And this is just one of many different types of malicious scans. Fortunately you’ve got geeks like me who study this garbage and provide security tools like the 4G Blacklist to help protect your site. And speaking of the 4G..


I originally intended to post an .htaccess snippet along with this last example, but somehow managed to forget until now. Here is a simple line of .htaccess that will, remarkably, stop this type of relentless scan dead in its tracks:

 RedirectMatch 403 \)\.css\(

That simple rule will prevent malicious scans of the type described above, which is literally any request containing the character sequence “).css(” anywhere in the URL (excluding the query string).

The 5G Blacklist

After many months of careful analyses and testing, the 5G Blacklist is ready for beta testing. Leave a comment if you want to help out. I’m running the script now here at Perishable Press, which runs both older and current versions of WordPress, amongst other things. I have also had much success with the 5G at the Angry-Birds site, which runs quite a few popular WordPress plugins (including Simple Forum). So far so good, but it would be great to fine-tune even further before public release.