My WordPress Site Just Got Hacked

Probably a phrase that no one in the community ever wants to utter. I bet you’ll probably stop reading this post temporarily just to take a look at your website to ensure that it is still up and in-tact. Some of you may even clear your cache and refresh to be double sure. Does this type of thing happen often, yes! Does this happen to anyone or just you? If you’ve been hacked before it sure feels like it was just you out of the millions of active websites on the interwebs. You can’t feel too bad about it, it was probably bound to happen if you have never thought to make the necessary steps to keep your website secure.

So what do you do now that your staring at some ugly graphics and text that reconfirms the obvious that your website has been hacked? Check out this list of options below:

Contact Your Hosting Company

Inform them that your website has been compromised so that they may be able to take steps to isolate the problem to a specific server or files before it spills over into your neighbors yard. Most websites operate on shared servers. This means on any given server there could be multiple websites of all types sharing space. Kind of like the electrical box outside your house.

Protect Your Own Computer

Once you’ve learned that your website has in fact been hacked, trying to navigate around it may not be wise as files may be compromised. Clicking on links or images may unload spyware or malware to your local computer that may wreak havoc on your home/work network and systems.

Pull Up A Backup of Your Database or Website

This of course is considering you set a plan for backups to your website on some type of regular basis. We use a plugin called WordPress Database Backup from Austin Matzko, however that plugin hasn’t been updated in a while. So I’d suggest BackWPup by Inpsyde. There’s a host of options including backing up to your Dropbox account. You can also perform your own backups by heading over to the Tools section, then clicking on the Export option and saving that to your local computer. Now if you do have a backup, you’ll be using the same plugin for backing up (in some cases) and choosing the import feature, or using the native import feature through the Tools section in your WordPress dashboard.

Get A Fresh Copy of WordPress

Go to WordPress.org and get yourself a fresh copy of whatever current version is out at the moment. There are a few files however that you’re not going to want to alter as they will consist of vital data pertaining to your website.

  • wp-config.php (contains your database, host, password, and more)
  • wp-content (FOLDER) (this is where your themes and plugins are stored)

There are a few files that you should delete regardless if your site is new, hacked, or not:

  • wp-admin/install.php
  • wp-admin/install-helper.php
  • wp-admin/import.php
  • readme.html
  • wp-admin/upgrade.php
  • wp-admin/upgrade-functions.php

If you’re not sure, make a copy while your in your FTP to your server side and rename the parent folders to :whatevername.old” or “whateverfile.php.old”. This way when you upload new files you won’t overwrite the preserved ones and you’ll still have fresh files loaded where compromised ones may have been.

Change Your Database Password

This same password is listed in your WP-CONFIG.php file so you’ll need to go through your host control panel to edit your MySQL database to edit this. Once updated to something WAY more secure and different, edit the password in your wp-config.php file and re-upload that to your server. I shouldn’t stress that this shouldn’t be the same password as your Dashboard user login.

Speaking of users, be sure that you are NOT using the default “admin” account to login to your site. If so please create a new login with a better username like your nickname plus favorite 5 digit number, add in some spaces and a few capital letters while you’re at it. Brute force attacks on WordPress sites are common and over 90% of the time they are trying under the “admin” username.

Be sure you’re using the most udpated version of PHP. Could be 5.2 or 5.4. Check with your hosting company as well as your theme to be sure you’re where you need to be.

Login to WordPress and Check Around

See if there are any new users accounts (especially administrator ones) that you know shouldn’t be there. Update the passwords on the remaining ones you know are authorized. See if there are any new pages, posts, media files, etc that you know you didn’t load. Remove them too. If you did preserve some files or folders, you may have to reload your theme(s) and plugins. Not a big deal since you’ll easily be able to see them from your preserved files/folders.

Keep Up To Date

Be sure to keep in-step with security updates from WordPress. If you ever see a 3.x.x update, chances are is a vulnerability update and it will be an update to patch  something that someone from Automattic or the WordPress community has discovered. Also check in on your plugins and themes to see if they have updates. Most theme houses like Themeforest or WooThemes will contact you via email whenever there are updates pushed by the submitting developers. If not, take some steps to stay up to date on your own. Beware of some free themes you find on the net too. There usually is no accountability or liability should that theme go un-updated for months or years yet still be available as free. Or worse yet, repackaged and loaded on other sites as a free theme yet its now loaded with malware.

Install Preventative Security Plugins

While there are a host of plugins you can choose from, some free, some premium; GET SOME! I’m more of a fan of premium plugins from respectable developers versus free ones because truly, you get what you pay for. The level of responsibility from premium developers to ones just starting out is quite noticeable and to be respected. So what should you use? Here are some suggestions:

Better WP Security

WordFence Security (we also talked about this here)

BulletProof Security

XCloner – Backup and Restore

Have you had a site get hacked? Have more ways to prevent a site from getting hacked? Share in the comments below!

 

Some useful links and further tips:

Hardening WordPress