3 Must Apply Security Tips for WordPress


background image

Today I was reading through my RSS feeds and I came across a very interesting post from Matt Cutts. Basically he was describing 3 (plus a bonus) tips to secure your WordPress install. I was already using two of them, but the first one was new to me, and looks like it is the most effective one as well.

1. Secure the /wp-admin/ directory

You probably know that most of your WordPress sensitive information is stored in the /wp-admin/ folder. Right out of the box, WordPress leaves that folder open, so people can access these files if they know what they are doing.

Matt suggests to place a .htaccess file inside the /wp-admin/ folder to block the access to all IP addresses, except yours. Here is the code you need to put in the .htaccess file:

AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName "Example Access Control"
AuthType Basic
order deny,allow
deny from all
allow from xx.xx.xx.xx
allow from xx.xx.xxx.xx

2. Hide your plugins

Many WordPress plugins come with bugs and vulnerabilities that can be exploited to damage your website. The last thing you want, therefore, is other people being able to know what plugins you are using.

If you visit the folder /wp-content/plugins/ on most blogs, however, you will be able to see all the plugins that are being used. In order to hide that list you just need to create an empty index.html file and drop it there.

3. Keep up with patches and updates

Most bloggers probably carry out this tip already. Just keep your WordPress updated and you should be fine. Matt suggests subscribing to the WordPress Development Blog.

The final bonus tip was just to delete the meta tag that reveals your WordPress version on the header of your site.

Do you know any other security tips that WordPress users should apply?

Update: Browsing on the Internet I also came across a WordPress plugin called Login LockDown. Basically it will track down login attempts to your site, and if there are too many of them coming from the same IP address on a short period of time the plugin will disable the login function for that IP range. Useful to avoid people trying to brute force your password.

Browse all articles on the WordPress category

49 Responses to “3 Must Apply Security Tips for WordPress”

  • brent berrett

    Can the files can be accessed directly even with a blank index.html file?

  • LoLo

    “Do you know any other security tips that WordPress users should apply?”

    1. Change the default DB prefix (wp_).
    2. Hide your entire install.
    3. Matt’s bonus tip was a bit off. You can still get his version info. Just edit your wp-includes/version.php to hide it correctly.

    Info on how to hide your install and all the rest of this can be found here.

  • Daniel

    If you have a dynamic IP just go with a password protected .htaccess file as described by James W.

  • Nick – road2blogging

    thanks for the tips. Hard to implement #1, but just done the other two.

  • Ruchir

    “Matt suggests to place a .htaccess file inside the /wp-admin/ folder to block the access to all IP addresses, except yours.”

    What if I have a dynamic IP?

    And what if I access my admin through 2 different PCs with 2 different internet connections…

  • Bong (JB)

    I haven’t worried about security stuff before but I’m going to implement this. Better safe than sorry. Thanks.

  • James W

    Regarding .htaccess and IP Blocking: An alternative method is to use htaccess password – that way you can access it anywhere and not have it restricted to an IP. It pops up with a login box when you try to access the folder.

    There even a wordpress plugin to do it (I havent tested it)

  • dennis

    @Mikhail: Its nearly impossible to plug all of the holes all of the time. Just depends on how paranoid you are. 🙂

  • dennis

    If you have control over your site’s httpd.conf, it is probably a good idea to deny index listing by default. Under your DocumentRoot directive, change your ‘Options’ to include ‘-Indexes’ (exactly as others have specified for .htaccess above).

    Example (angle brackets changed so they don’t mess up this comment):

    [Directory “/var/www/html/yoursite”]
    Options -Indexes

  • Ash Haque

    Kind of defeats the whole point of being able to post to your site from anywhere (tip #1)

  • David Zemens – 1955 Design

    @Mikhail: There is always a way around a security measure. They are just designed to thwart a percentage of the hackers. Thanks for the tip, though. I placed that index.php file in all the subfolders of the plugin directory. At least for the moment I am not exposed in the Akismet directory.

  • Jonas

    Thanks for the tips! There are good reasons for hardening your WordPress install. WordPress stores passwords in the database as hash made from the password. A common Unix practice is to add random seed to the hash but WordPress does not do this. Should the password hash be revealed it could even be revealed by googling the hash!

  • Jaan Kanellis

    No problem!

  • Chris Jacobson

    Great tips.

    Thanks for the .htaccess trick, Jaan.

  • Zac Davis

    Wow, thanks for these tips. I’ll be sure to implement them.

  • Mikhail

    @ David Zemens 1955 Design

    don’t be so excited, bro, by posting your “informational message”


    you are still exposed

  • Michael Aulia

    WOW..thanks so much..especially for Tip #2

  • Daniel

    Thanks Jaan, yeah it is the same trick Shoemoney recommended sometime ago.

  • Jaan Kanellis

    Just add the line:

    Options -indexes

    to your htaccess file

  • Daniel

    @David Zemens, nice warning message you put there :).

  • Daniel

    That works then! Can you share the code you used in the .htaccess file? Either here or on your blog and I will link to it.

  • Napster

    Great security tips!

  • Daniel

    Right, but when the user clicks on the image he would be directed to the wp-content folder on your blog. If you block that he would see a 404 page, won’t he?

  • Jaan Kanellis

    Daniel that should not be a problem at all. Google doesnt find the images by browsing through folder access they find them through links on the pages themselves which would still work fine.

  • Daniel

    I wonder if you can specify IP ranges for tip number 1. This would solve the problem for people with dynamic IP addresses.

    Well, you would still be vulnerable to people close to your IP class, but that reduces the risk greatly already.

  • Daniel

    Jaan, yeah that is another option. I wonder if this would mess up people visiting single images via Google Image search though.

  • Jaan Kanellis

    Browsing access that is.

  • Jaan Kanellis

    For #2 you should be blocking the content access in all folders through your htaccess file.

  • David Zemens – 1955 Design

    Great tips. Without a static IP address tip #1 is difficult to implement. I already made the change you suggested in tip #2, but added a bit of an informational message to the index.php file that I dropped into the plugin folder.

  • Colourblogger

    Good point! I never understand whay bloggers talk so freely about they installed plugins.

Comments are closed.