For the first time in seven years, one my Websites was hacked last week.
I imagine that there are many ways that hackers go about this, but to the extent that there might be commonalities for EE sites, thought I’d lay out how I recovered from the hack in hopes it might save some time for others.
First, I was getting downtime reports from the Pingdom and a note from the client that the site was down (clients always seem to be on their sites when they go down!). Downtime happens sometimes of course, so I dropped a ticket with the host (Rackspace Cloudsites) because I didn’t see downtime on their system status blog. I didn’t really think it was anything other than routine at this point.
The host responded back to my ticket saying that my site was compromised. They recommended I look at my cgi-bin directory and check out their support page on the issue:
http://cloudsites.rackspacecloud.com/index.php/Recovering_from_and_Dealing_with_a_Site_Compromise
(it’s a helpful page no matter what host/cms you’re using).
Sure enough, there were a bunch of evil files in my cgi-bin directory, which is normally empty. I emptied it.
I also backed up all the files on my system and my database, which is always backed up anyway, but at this point I had no way of knowing the extent of the attack.
I think emptying the cgi-bin directory essentially stopped the hackers, but my site was not coming up. I was getting white screens.
After some trial and error, I found that the index.php file had been changed to redirect users. It wasn’t apparent at first because most of the file looked the same (I missed it the first time around) on visual inspection.
I downloaded a current version of the index.php file from the EE Website (my install was at the latest version anyway) and uploaded that to my server. That solved the problem. It seems so easy now, but then it didn’t.
I changed all the passwords on my account to secure passwords (they were secure before, but go figure), including the FTP password, the database password and my account password. I use OnePassword which generates passwords using various criteria.
Takeaways: use Pingdom or some other monitoring service on all your sites so you are aware of your sites’ activity. Use super secure passwords and SFTP if possible (my host allows SFTP but I didn’t know before this incident, I know that Engine Hosting uses it too).
Now that I’m using EE2.0 more, I’m making my installs above root (not sure why I wasn’t doing this before 2.0 but it seemed like a pain then), which I think should help too.
Hope that helps someone at least save some time and headache.