I have been revisiting the various security settings of my WordPress blog after the sudden database table corruption of this blog for unknown reason last week. In this post I have highlighted some of the security tips that can help protect your blog from possible outside attacks.
A lot of the security tips covered in this article is offered as a feature in our WordPress Security Plugin
Also, checkout the following two WordPress security articles that we published:
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.
Add a CAPTCHA on your WordPress Login page
Adding a simple captcha to your WordPress login page is another great way to minimize the chance of a bot/script gaining access to your site via a brute force attack. Read the adding captcha to login page tutorial to learn how to enable it on your site.
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). The WordPress htaccess tips post has more htaccess related tips and tricks. Below is an example .htaccess file that can be used for this purpose (replace ‘x’ and ‘y’ with your IP address)
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName “Access Controlâ€
AuthType Basic
order deny,allow
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. In that case you could use the AskApache Password Protect WordPress plugin. That plugin adds good password protection to your WordPress Blog. Use the Login Lockdown feature of the All in One WP Security 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 blank index.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. Read my what would you do if you lost all your blog’s content article to find out how backups can help you sleep better at night 🙂
Be careful when you upload something to your site
When you upload a script (example: a plugin, a theme or just a normal script) to your site you need to be extra careful as it can harm your site if it was designed to do so. Only upload authentic content to your site. Never download a plugin or a theme from a warez or torrent or file sharing sites. The content on these sites can be disguised as a plugin or a theme but it will harm your site when uploaded to your server. You can read more on these types of attack from the free premium plugin and theme downloaders beware article.
Checkout the advanced WordPress security tips article for more tips.
Feel free to share your thoughts and wordpress security tips in the comment area below.
Back up data! Key point. Speaking from the painful and time consuming experience of my computer crashing and losing all my data and blog entries. And update to the latest version of WordPress…good tips to cover, thank you much for sharing them.
Thanks man!! this really helped.. Just Secured our plugin directory!
Thanks for the info. Had a guy take down a site belonging to one of my clients. Want to do everything I can to protect his new site.
Thanks for all the tips, very good advice and I will put into practices straight away.
I think it is important that you follow those tips. For myself, I also have one measure to help protect my site. Instead of using normal FTP application to connect to the site, I use Secure FTP application to upload my stuff. This way, it prevents hackers from listening in to the connection and finding out what my passwords are. This should be particularly useful for web design companies.
After an exploit attack I decided follow this steps and never more I had an atack. The issues are reliable. Thanks a lot for these valuable information!
You can simply add the following line of code in your theme’s functions.php file and it will do the job:
remove_action('wp_head', 'wp_generator');
I use login lockdown to protect my blog, how do I hide the WP version from my blog?
For those of us that rely on our sites to drive business, it’s imperative to both backup and protect our information and the database too.
some things never change, like doing regulary backups and updates.
We are using now WordPress 3.3, but your article from March 2009 still is up to date 😉
these tips aren’t just applicable to wordpress, alot of them can apply to joomla or other cms platforms
Excellent tips mate,
I always found it hard to administrate my wordpress site
so your tips are a godsend 😉
Go with WordPress 🙂
Is WordPress the best software to use for blogging? I’m looking to add a blog to my website but am not sure which type of blog software i should go for. Any tips?
The problem with some of my .htaccess file contents disappearing occured when updating permalinks. It appears that was because my custom entries were inserted between the # BEGIN WordPress and # END WordPress comments. Moving my entries outside the WordPress BEGIN END solved my problem.
Thank you for this wordpress tips. Strong password is a good start and then learn to use the htaccess file to secure your website. its a jungle out there!!!
Ha! I wish I’d read this last week. thanks for the tips
I’m just looking into setting up a wordpress site, so thanks very much for the great information. Book marking this now to keep returning back as I configure mine.
Thanks
I have started my blog and have been looking for tips….wordpress or blogger?
If you are on a shared server then it is hard for you to do anything on your end if the server gets hacked (if the root account gets hacked then there is nothing you can do). Just make sure to take regular backups so you can restore from a know point.
Great tips, although is there any way to protect WordPress from other websites on a shared server getting attacked (i.e. to limit potential damage)?
Nice technique as I ever seen.
Whoa, very cool WordPress security tips… thank you for share
I stick to a policy of using 6 letters and 6 numbers. This is the case for all of my passwords, not just my wordpress and blogspot ones.
I have had my blogs hacked a few times. It is not fun to have to fix it. Since this has happened I have taken measures to keep it from happening again. This article adds insight and has given me some new ways to ensure that I don’t get HACKED again!
! I’ve been searching for some decent stuff on the subject and haven’t had any luck up until this point, You just got a new biggest fan!
Many Thanks, i atleast can walk away knowing i’m a bit more secure without calling security LOL..
Wow great article very interesting
OMG Useful tips 🙂
Thanks you
Wow this is incredibly helpful. I’m fortunate enough to never have had any security troubles but I know a guy who got his blog hacked into and it cost him thousands. Thanks so much for this article
Use the “Akismet” plugin.
I know this post is predominately about preventing your blog from being hacked however, how do you prevent the endless amount of spam comments that a blog receives. Admittedly i turn comment moderation on so i can delete them before they are added to the blog but it is laborious to keep deleting spam comments. Is there somewhere within the settings of WordPress, or indeed a plugin i could use to stop these comments?
It looks like that picture is covering a solid paragraph of your post. As for people hacking into wordpress accounts, wow. I’ve never been that unlucky, or known anyone that unlucky. I have to give it up to the hackers that have though.
Very useful tips, especially the .htaccess part. Thanks a lot!
I recently made a wordpress based hotsite to my company. After reading this post I decided add all protections listed above.
Recently I’ve received a lot of spams through contact form. I’ll try add the suggested protections. Thanks for the tips.
THANK YOU for your great and useful article!
I would also suggest to rename the famous “admin” default username by something totally different.
To rename the admin or any other username you can try WP Optimize (http://wordpress.org/extend/plugins/wp-optimize/) , it does the job in 1 second…
Thanks again for sharing!
Paul
Hi, Thumbs up tips!
I’m wondering if there any way that may help change or just rename wp-admin URL to something else!
for example instead of wp-admin/profile.php i suppose it shoud be example.com/[UserName]/profile.php or example.com/[RandomNumbers]/profile.php
Thanks in advance
Nice tips… There are also a few useful security plugins in the wordpress plugins repository
* WordPress Firewall – Identify and stop most obvious attacks (sql injects).
* Security Scan – Scans your WordPress installation for security vulnerabilities and suggests corrective actions.
* CopyrightPro – Disable right click on your WordPress, disable selection of text,
and protects from iframes.
Ya nice tips. We should back up our data because hackers can do anything at any time. So backup your data to protect the data base.
Nowhere did I see FTP as a concern. I think it should be, as the security is pretty basic and not as good as SSH.
You could also try the “better-protected-pages” plugin available from http://www.wordpress.org/extend which allows your users to “re-lock” a password protected page when they have finished reading it. We found this to be a major problem on public computers because the password protected page remains “unlocked” even when you log out or close the browser … the plugin fixed this issue.
Hi RaiulBaztepo, You are most welcome. Who said your English is bad? 😛
Hello!
Very Interesting post! Thank you for such interesting resource!
PS: Sorry for my bad english, I’v just started to learn this language 😉
See you!
Your, Raiul Baztepo