A simple way to protect your Wordpress site from being hacked

33 replies
I'm a long-time Web application developer. My development platform of choice is ColdFusion and has been since it was originally published by Allaire back in 1995.

Wow, has it been almost 15 years now?

Anyhow, despite the fact that CF is a great language and a very rapid development platform, these days I've converted over to using self-hosted Wordpress for many of my sites, especially new ones, because it is such a great CMS and a fantastic way to get sites up and tested and performing very, very quickly. I still use CF for all the heavy lifting, but for many sites Wordpress is the ticket for me.

So that led me to think about the security aspect of WP sites. You guys who are using WP know that by default the way to log into your WP admininstration panel is like this:

Code:
http://www.whateveryoursitenameis.com/wp-admin
Well, if you left it that way then it's only a matter of a hacker executing a brute force attack against your administration login page. In other words, the only thing standing between your WP administration system and some guy who wants to take over your site is a username and a password.

This problem is worsened if you've used a relatively non-complex user name and password. If your site is "Joe's Site" and the admin username is "adminjoe" and the password is "joe123" then it shouldn't take too much time for a hacker to brute force his way in.

So here's a simple way for any non-programmer-types to protect your WP administration system from such an attack: using FTP to log in to your site, rename the "wp-admin" subdirectory to something else, like "wp-admin-x43q178e". Then, any attempts to login to the WP control panel like this:

Code:
http://www.whateveryoursitenameis.com/wp-admin
Will throw a 404 error. Even login attempts like this:

Code:
http://www.whateveryoursitenameis.com/wp-admin-x43q178e
would fail because, by default, WP is looking for components in the "wp-admin" directory (which no longer exists).

Then, when you need to login to your WP administrator, simply FTP in first and rename the directory back to "wp-admin". Then you can login as normal. The best part of this simple technique is that you don't have to remember the new, more complex name of the wp-admin directory, since you only need to FTP in, find the renamed directory and change it back to "wp-admin" in order to administer Wordpress. When you're finished, change it something else more complex again.

Leaving your admin directory named "wp-admin" means that anyone running a discovery script against a list of domains looking for backdoor access will discover that your site is running on WP and that your admin directory is visible to the world. After that, a brute force script may be all that's necessary to take over your WP site.

Is this a foolproof method? No, of course it isn't. But at least it adds another simple layer of security which slows down a hacker enough that he may move on to another, more easy to enter site. Does it add another step to your administration? Yes, it does. However you may feel that the protection you gain is worth the extra 15-30 seconds you need to expend in order to obscure your WP administration panel from the world.

And... it's free.
#hacked #protect #simple #site #wordpress
  • Profile picture of the author jame58rown
    I think it would be just as easy to choose a proper password and an obscure user name. Isn't your FTP address, username and password just as vulnerable?
    {{ DiscussionBoard.errors[877995].message }}
    • Profile picture of the author Jesus Perez
      Coldfusion lover here, too! Such a simple language to learn. Regarding the post, unfortunately, most sites are hacked by insecure plugins. Sad but true. But this is a good tip for brute attacks.
      Signature

      {{ DiscussionBoard.errors[878014].message }}
      • Profile picture of the author Steven Carl Kelly
        Originally Posted by BlueSquares View Post

        Coldfusion lover here, too! Such a simple language to learn. Regarding the post, unfortunately, most sites are hacked by insecure plugins. Sad but true. But this is a good tip for brute attacks.
        Yeah, love me some CF.

        And you're right, insecure plugins are a problem. That's why WP users should be careful about which plugins and how many they use. But this was just a simple tip for the non-techy folks who want to make it a little more difficult to get in.
        Signature
        Read this SURPRISING REPORT Before You Buy ANY WSO! Click Here
        FREE REPORT: Split Test Your Landing Pages the Easy Way
        {{ DiscussionBoard.errors[878020].message }}
        • Profile picture of the author CMartin
          Or use a plugin like the "Login LockDown" pluggin. From their page:
          Login LockDown records the IP address and timestamp of every failed WordPress login attempt. If more than a certain number of attempts are detected within a short period of time from the same IP range, then the login function is disabled for all requests from that range. This helps to prevent brute force password discovery.
          An alternative way would be to password protect the directory, but then the user would need to use one more password.

          Carlos
          {{ DiscussionBoard.errors[878198].message }}
    • Profile picture of the author Steven Carl Kelly
      Originally Posted by jame58rown View Post

      I think it would be just as easy to choose a proper password and an obscure user name. Isn't your FTP address, username and password just as vulnerable?
      Yes and no, it depends on how your FTP access is set up. However, the above method has the added benefit of obscuring your WP site from discovery scripts. It's just an extra layer to make it more difficult for the casual hackers or script kiddies to stay out of your WP admin.
      Signature
      Read this SURPRISING REPORT Before You Buy ANY WSO! Click Here
      FREE REPORT: Split Test Your Landing Pages the Easy Way
      {{ DiscussionBoard.errors[878015].message }}
  • Profile picture of the author Steven Carl Kelly
    Yep! It pays to protect your sites.
    Signature
    Read this SURPRISING REPORT Before You Buy ANY WSO! Click Here
    FREE REPORT: Split Test Your Landing Pages the Easy Way
    {{ DiscussionBoard.errors[878206].message }}
  • Profile picture of the author joker_affiliate
    Some good advice. This would certainly stop the not so tech literate. Though I'm sure there are many other ways (like a secure password, or a plugin). All the same I'll definitely be taking this advice. You can never be too careful.
    {{ DiscussionBoard.errors[878235].message }}
  • Profile picture of the author Chris_Willow
    Or one could just rename the wp-admin and remember the name. So when logging in, just type whatever address without having to ftp and rename the directory each time. I think it should work too.

    Good idea thou

    Chris
    {{ DiscussionBoard.errors[878527].message }}
    • Profile picture of the author TheRichJerksNet
      Originally Posted by Chris_Willow View Post

      Or one could just rename the wp-admin and remember the name. So when logging in, just type whatever address without having to ftp and rename the directory each time. I think it should work too.

      Good idea thou

      Chris
      Chris,
      You can not just simply rename the admin folder, you also have to edit a bunch of files to change the name in the coding also..

      Security goes way beyond just renaming a folder, just ask anyone of my 300+ customers...

      James
      {{ DiscussionBoard.errors[879487].message }}
  • Profile picture of the author ih82lose
    Interesting tip.

    I do believe this is a nice, simple way to help secure your WP site.

    I think renaming your wp-admin directory is an easier, and equally effective method.

    But it is always good to have options.
    {{ DiscussionBoard.errors[878599].message }}
  • Too time consuming... but it's a nice idea.

    Here is a better and faster solution. Use RoboForm. Create an obscenely difficult password... Roboform will even generate it for you. Make it as long as you want. Then the possibility of the hacker ever guessing right is infinitesimally small. RoboForm is cheap and super fast way to long into multiple sites. Who has time to ftp and do all that every time they want to change their blog/site? Them multiply that by the number of sites you have.

    It's insane how long you can make a RoboForm password using their password generation feature... I have no idea how big a field the WordPress Password can take however. I'd think that 15 characters should suffice, and 10 is the default.

    And you don't have to use RoboForm you can create your own long and multi character multi case password. It's just the RoboForm makes it so easy to just get in and out. And of course back up. People who are using it understand this already.
    {{ DiscussionBoard.errors[878745].message }}
    • Profile picture of the author Steven Carl Kelly
      Originally Posted by InternetMarketingIQ View Post

      Here is a better and faster solution.
      Good suggestion, thanks. It still leaves the WP Admin page open to the world, however. So long as there are no exploits, a complex username-password combination will provide some protection. I prefer to make so they can't even try a username or password at all -- no matter how complex.
      Signature
      Read this SURPRISING REPORT Before You Buy ANY WSO! Click Here
      FREE REPORT: Split Test Your Landing Pages the Easy Way
      {{ DiscussionBoard.errors[878787].message }}
      • Profile picture of the author WritingMadwoman
        Interesting ideas folks, thanks! A question: if I were to change the wp-admin directory to a different name and leave it like that permanently, does it cause any problems for the operation of the blog? Do other functions need to access that directory and wouldn't be able to find it?

        Maybe a dumb question but certainly not the first one I've ever asked. (non-techie person here, please be patient with me)

        Wendy
        {{ DiscussionBoard.errors[878944].message }}
        • Profile picture of the author Steven Carl Kelly
          Originally Posted by WritingMadwoman View Post

          Interesting ideas folks, thanks! A question: if I were to change the wp-admin directory to a different name and leave it like that permanently, does it cause any problems for the operation of the blog? Do other functions need to access that directory and wouldn't be able to find it?
          I have not seen it have any impact on the operation of the blog.
          Signature
          Read this SURPRISING REPORT Before You Buy ANY WSO! Click Here
          FREE REPORT: Split Test Your Landing Pages the Easy Way
          {{ DiscussionBoard.errors[878946].message }}
        • Profile picture of the author CMartin
          Originally Posted by WritingMadwoman View Post

          A question: if I were to change the wp-admin directory to a different name and leave it like that permanently, does it cause any problems for the operation of the blog? Do other functions need to access that directory and wouldn't be able to find it?
          If you mean by "operation of the blog" also to login into the admin area via the new "admin" directory name, then Yes... it will cause problems.
          I checked the source code of WP 2.7.1 and WP 2.8 and both have hard-coded the "wp-admin" directory in many files.

          Maybe a dumb question but certainly not the first one I've ever asked. (non-techie person here, please be patient with me)
          Not a dumb question at all Wendy, because many scripts allows you to define the admin directory name - unfortunately WP does not have this option.

          Carlos
          {{ DiscussionBoard.errors[879244].message }}
          • Profile picture of the author Steven Carl Kelly
            Originally Posted by CMartin View Post

            If you mean by "operation of the blog" also to login into the admin area via the new "admin" directory name, then Yes... it will cause problems. I checked the source code of WP 2.7.1 and WP 2.8 and both have hard-coded the "wp-admin" directory in many files.
            To clarify what CMartin is saying: renaming the wp-admin directory doesn't affect the operation of the public-facing blog. You will not (of course) be able to login to the admin console without changing the name back to "wp-admin" (but of course, that's the whole point of doing it, isn't it?).
            Signature
            Read this SURPRISING REPORT Before You Buy ANY WSO! Click Here
            FREE REPORT: Split Test Your Landing Pages the Easy Way
            {{ DiscussionBoard.errors[879425].message }}
            • Profile picture of the author edhan
              Think most problem is caused by plugins. So one has to keep updating plugins to avoid being hack. Security is a must if you want to avoid situation like this. One should try to use numbers and characters for passwords to make it tougher to hack.
              Signature

              Be blessed with Thai Buddha Amulets & Tibetan dZi to accumulate wealth, health & good fortune
              Build your own community business
              Article Directory Source Code with blog & Classified Ads
              Understanding the cycle of Karma & Merits

              {{ DiscussionBoard.errors[879475].message }}
            • Profile picture of the author CMartin
              Originally Posted by Steven Carl Kelly View Post

              Originally Posted by CMartin View Post

              If you mean by "operation of the blog" also to login into the admin area via the new "admin" directory name, then Yes... it will cause problems. I checked the source code of WP 2.7.1 and WP 2.8 and both have hard-coded the "wp-admin" directory in many files.
              To clarify what CMartin is saying: renaming the wp-admin directory doesn't affect the operation of the public-facing blog. You will not (of course) be able to login to the admin console without changing the name back to "wp-admin" (but of course, that's the whole point of doing it, isn't it?).
              Thanks for clarifying my... clarification

              Carlos
              {{ DiscussionBoard.errors[879694].message }}
          • Profile picture of the author WritingMadwoman
            Originally Posted by CMartin View Post

            If you mean by "operation of the blog" also to login into the admin area via the new "admin" directory name, then Yes... it will cause problems.
            I checked the source code of WP 2.7.1 and WP 2.8 and both have hard-coded the "wp-admin" directory in many files.


            Not a dumb question at all Wendy, because many scripts allows you to define the admin directory name - unfortunately WP does not have this option.

            Carlos
            Thanks Carlos, that's exactly what I was worried about. What you said makes sense!

            Wendy
            {{ DiscussionBoard.errors[880231].message }}
        • Profile picture of the author bc3447
          Originally Posted by WritingMadwoman View Post

          Interesting ideas folks, thanks! A question: if I were to change the wp-admin directory to a different name and leave it like that permanently, does it cause any problems for the operation of the blog? Do other functions need to access that directory and wouldn't be able to find it?

          Maybe a dumb question but certainly not the first one I've ever asked. (non-techie person here, please be patient with me)

          Wendy
          If you are dealing with security issues you won't want to keep your login and password the same permanently. It is best to rotate them, to keep the hackers guessing. I love the Roboform idea, simple yet effective.
          {{ DiscussionBoard.errors[879491].message }}
          • Profile picture of the author WritingMadwoman
            Originally Posted by bc3447 View Post

            If you are dealing with security issues you won't want to keep your login and password the same permanently. It is best to rotate them, to keep the hackers guessing. I love the Roboform idea, simple yet effective.
            Thanks BC, I wasn't referring to passwords, just the name of the directory. I agree you should keep changing passwords.

            Wendy
            {{ DiscussionBoard.errors[880233].message }}
            • Profile picture of the author Zack Lim
              Hi Steven,

              Thank you for sharing this tip.

              It will be always better to take extra step to protect our website and blog.

              Anyway, the extra step will not take more than 5 mins and I feel it will be worth the effort to apply the tip

              Zack
              Signature

              FREE Affiliate Marketing Mini Course Reveals The Fastest And Honest Way To Make Your First $1000 Online

              Click Here To Get FREE Instant Access

              {{ DiscussionBoard.errors[880249].message }}
  • Profile picture of the author stevenh512
    Personally I just use .htaccess to secure my wp-admin and wp-login.php. I use HTTP authentication so a separate username/password are required just to see the Wordpress login page and I also use IP address restrictions so only my IP can get access to my Wordpress admin (yeah I know IPs can be spoofed, but the hacker would have to know my IP first). Since I'm on dialup and my IP changes constantly, I have a little script running on my laptop that logs into my server through SSH and updates the IP address in .htaccess every time my IP changes, but if you're on cable or DSL that probably wouldn't be necessary since your IP should rarely change. As one extra measure of security, I also have Login Lockdown so even if someone spoofs my IP and brute-forces the first username/password they only get two chances at my Wordpress login.
    Signature

    This signature intentionally left blank.

    {{ DiscussionBoard.errors[878971].message }}
  • Profile picture of the author wealthydon
    Hmm! Insecurity everywhere at all times!

    Even we are afraid and insecure to reveal
    our money making niches and profitable
    keywords and so on on the internet.

    We keep guns in case of invasion or attack.

    And now WP attack and defense!

    When will the enemies leave?
    {{ DiscussionBoard.errors[879633].message }}
  • Profile picture of the author TheRealDomainer
    This makes a technical sense in any case
    {{ DiscussionBoard.errors[880004].message }}
  • Profile picture of the author ken_p
    thank you for sharing this to us. i would have never thought of this on my own.
    {{ DiscussionBoard.errors[880263].message }}
  • Profile picture of the author Steve Peters Benn
    Hi Steven, that's a good idea. If I alter that directory name, will I need to alter any references to it elsewhere or is it self contained?
    {{ DiscussionBoard.errors[892083].message }}
    • Profile picture of the author htwfh
      Originally Posted by Steve Peters Benn View Post

      Hi Steven, that's a good idea. If I alter that directory name, will I need to alter any references to it elsewhere or is it self contained?
      You'd have to alter it all if you were to keep it at that new name. That's why Steven is recommending a temporary lock when the WP isn't in use.

      Personally I think that it's a good way to have additional security!

      Thanks, Steven!

      Brian

      -
      {{ DiscussionBoard.errors[892172].message }}
  • Profile picture of the author Steven Carl Kelly
    Brian answered the question best. And yes, there are much more sophisticated ways to protect your site (believe me, I earned a CCSE so I'm aware of that) but this was aimed at the folks who have no clue about htaccess or scripts or other such things, but they probably already know about FTP and renaming a directory.
    Signature
    Read this SURPRISING REPORT Before You Buy ANY WSO! Click Here
    FREE REPORT: Split Test Your Landing Pages the Easy Way
    {{ DiscussionBoard.errors[892245].message }}
  • Profile picture of the author takingaction
    With an FTP program like FileZilla, this is really just a 5-10 second procedure. Will give it a go.

    Thanks for sharing.
    {{ DiscussionBoard.errors[892294].message }}
    • Profile picture of the author Lawrh
      You don't really need to use FTP, you can have cPanel logged in in one tab and change the directory name in the cPanel file manager. Easy to switch tabs to change it back.
      Signature

      “Strategy without action is a day-dream; action without strategy is a nightmare.” – Old Japanese proverb -

      {{ DiscussionBoard.errors[893002].message }}

Trending Topics