I have been revisiting the various security settings of my WordPress blog after the sudden database table corruption of this blog forÂ unknownreason last week. In this post I have highlighted some of the security tips that can help protect your blog from possible outside attacks.
Use Strong Passwords for all Entry Points
I was surprised to find out how many of my friends use the WordPress admin password generated by WordPress during install time and thinks that their blog is protected from attacks as they are using a strong password! The WordPress admin password generated during install time is normally pretty strong (consists lowercase and uppercase letters with numbers and symbols) so there is nothing wrong with that. I was mainly shocked to find out that their ftp/cPanel password for that domain is not that strong. It gets even betterâ€¦ one of them were using his partners name as the password (Did I mention that his partnerâ€™s name was mentioned on his blogâ€™s â€˜Aboutâ€™ page?)! The ftp/cPanel password for your domain is equally important. If someone can access your cPanel then that person can delete your WordPress database from the cPanel->Databases->MySQL Databases. Anyway, the bottom line is to use strong passwords for all entry points not just one.
Protect the â€˜wp-adminâ€™ Directory
Use a .htaccess file in the â€˜wp-adminâ€™ directory to limit access to only certain IP addresses (your home, work etc). Â Below is an example .htaccess file that can be used for this purpose (replace â€˜xâ€™ and â€˜yâ€™ with your IP address)
AuthName â€œAccess Controlâ€
deny from all
# whitelist home IP address
allow from xxx.xxx.xxx.xxx
# whitelist work IP address
allow from yy.yyy.yyy.yyy
If you donâ€™t have static IP addresses then the above method can be a bit hard to implement.The â€˜AskApache Password Protectâ€™ plugin adds some serious password protection to your WordPress Blog. Not only does it protect your â€˜wp-adminâ€™ directory, but also your wp-includes, wp-content, plugins, etc. Use theÂ Login LockdownÂ Plugin to protect your blog against brute force attack (a brute force attack is a method of defeating a cryptographic scheme by systematically trying a large number of possibilities)
Deny access to your Plugins and other directories
A lot of bloggers donâ€™t protect access to their WordPress plugins directory. What I mean by this is that if you go to the www.your-domain.com/wp-content/plugins/ from a browser it shows all the plugins that you are using. Many wordpress plugins can have vulnerabilities which the attacker can use to harm your blog. So, its a good idea to block access to these directories. You can use a .htaccess file or just upload a blank â€˜index.htmlâ€™ file to that directory to block access to these directories. (download a blankindex.html)
Update WordPress to the Latest Release
As new WrodPress versions are released the security bugs for previous release becomes public information. WordPress could have vulnerabilities as a result of how the program is written that allow an attacker to pass HTTP arguments, bad URI strings, form input, etc, that could cause Bad Things to happen. So always upate your WordPress to the latest version to make sure that you are protected against any known security bugs.
Donâ€™t Show WordPress Version on Your Blog
You should not make the WordPress version that you are using visible to others for the same reason explained above. The specific WordPress version that you are using can give the attacker an upper hand in finding a way to break in.
Backup Your Data
I canâ€™t stress this enoughâ€¦ always keep backups of all the important files. I always backup my WordPress Database and WordPress files in case of emergency