WordPress Security Issues & Tips

WordPress security issues & tipsWordPress security has, especially in the past couple of years, become a serious issue. Never before have I seen so many determined and sophisticated hacking attempts directed against the sites I provide WordPress support for. These run the whole gamut of attack variations;

  • Blackhole Exploit Kit attacks
  • SQL Injection attempts
  • Brute Force Login & Password access efforts
  • Link Injection & Phishing attacks, where links to bank fraud efforts are made

Attacks are primarily initiated in Eastern Bloc countries such as Ukraine, Russia & Poland, along with Germany, India, Turkey and China etc. The firewall software I use also identifies hosts being blocked from Australia, random European countries, plus sources that are unidentifiable due to IP address concealment etc.

Through much of August 2014, frequency of attacks across all WordPress sites running Wordfence security was 35,000 attacks per minute! Source: www.Wordfence.com

Generally speaking, its easy to minimise the potential threat by a few minutes of preemptive efforts. In other words, an ounce of prevention is better than a pound of cure!

If you are in dire need of a fast solution to a hacking, we are available (at least) 12 hours a day…

 

How to Check Website Security

Here are some basic requirements you should have in place – if any are missing, your website is at risk;

  1. You don’t use “admin” as your administrator login
  2. Your administrator password is at least 12 characters and comprised of mixed case alphanumeric and special characters
  3. You’ve got a reputable security plugin installed and configured correctly
  4. You are blocking access to the backend of your site from known hacking troublespots like Ukraine etc
  5. You take regular backups of your site and store them safely
  6. You regularly check for WordPress and plugin updates and upgrade then promtly

 

Hardening & Securing WordPress

There are several basic elements that need to be addressed as part of any recommendations on WordPress security.

Secure WordPress User ID

The default WordPress User ID is “Admin” and you should NOT use that on your site. Doing so immediately means half of the “site access equation” is known, and all that’s required is the password! That’s pretty reckless in this day and age… A secure User ID ought to be a minimum of 10 characters containing a mix of upper and lower case and including numeric and/or special character variations e.g.; $The#1Boss In addition, you should then assign a User Account “nickname” so that there is no clue as to the Admin identity if you inadvertently use the account to publish any pages or posts! Ideally, you should publish the pages and posts from a “Editor” level account…

Secure Passwords

Most people foolishly use a password related to their life in some easily-remembered format. Phone numbers, wife’s name, child’s name, dog’s name etc… A little bit of research, a bit of trial and error on the part of a smart hacker or competitor and your site is wide-open! There are several websites specialising in secure password generation…

  • www.pctools.com/guides/password/
  • www.strongpasswordgenerator.com/
  • www.onlinepasswordgenerator.com/password.php

USE one of them!

Remove Theme & Plugin Edit Options

By default, WordPress allows the Administrator to edit theme and plugin files from within the admin console. That also means that should your Admin user ID and password be compromised, the attacker can make significant modifications at will!

This can be averted by by inserting the following code into the /wp-config.php file;

#DISABLE EDITING IN ADMINISTRATION PANEL
define(‘DISALLOW_FILE_EDIT’, true);

Comment Spam & Bad Links

These contribute negatively to your website’s online profile. Eliminate the majority of potential issues by using the inbuilt automation options;

  • Don’t allow registration unless it is absolutely necessary!
  • Don’t allow comments OR track-backs on pages
  • Close comments on posts after 2 – 4 weeks
  • Don’t allow track-backs on posts

Installing and configuring Akismet is not at all difficult and it effectively screens out the worst of the remaining garbage!

Maintaining WordPress & Plugins

It is extremely important to diligently maintain WordPress and any plugin applications. When a security breach or flaw occurs, fixes are put in place, but word of the potential exploit quickly circulates amongst the hacking community. Hackers immediately start looking for sites that are at risk, and target them! A ‘once a week’ login to your WordPress Admin should be a standard task, in order to check if there are upgrades available. Install any upgrades immediately! Having a plugin like Wordfence installed ensures you are notified immediately WordPress, a plugin or them have upgrades available. If you are not confident to do this yourself, a professional WordPress consultant is always available…

WordPress Security Plugins

This is the first line of defence – a properly implemented WordPress security plugin will thwart the majority of hacking efforts – particularly the script-based automated ones! Where a human-driven attack is initiated, you can easily make it extremely difficult to see the internals of your website. The more difficult it is, the greater the likelihood of the attacker giving up and seeking out a softer, easier target. Even in the hacking world, time is money… As well as a raft of SEO  WordPress plugins, there are also multiple WordPress security plugin applications available, each with its own methodology or variation on a theme. Selection of one over the other will often be based on the server environment – some simply won’t install if the right PHP elements or server settings are not enabled. Those that I have direct and extensive personal experience with are;

  1. Wordfence Security – robust and reliable
  2. Block Bad Queries firewall – install and forget
  3. WP Ninja Firewall – comprehensive
  4. Sucuri Security – hardening options are good

Each has its peculiarities, peccadilloes and quirks! Each works…

Wordfence

I prefer to use a single WordPress security plugin across all sites I manage, and I personally use Wordfence Security. It has a relatively simple interface. It is very robust, and the settings are easy to configure. Basically, I recommend simply selecting the following setting; “Level 4: Lockdown. Protect the site against an attack in progress at the cost of inconveniencing some users” That’s going to defeat the most determined of automated hacking efforts without impacting on the site’s usability! Wordfence can be configured to provide email warning of a variety of threats, including;

  • Alert on critical problems
  • Alert on warnings
  • Alert when an IP address is blocked
  • Alert when someone is locked out from login
  • Alert when the “lost password” form is used for a valid user
  • Alert me when someone with administrator access signs in
  • Alert me when a non-admin user signs in

Other important security aspects include;

  • Enable automatic scheduled scans
  • Scan core files against repository versions for changes
  • Scan for signatures of known malicious files
  • Scan file contents for back doors, trojans and suspicious code
  • Scan posts for known dangerous URLs and suspicious content
  • Scan comments for known dangerous URLs and suspicious content
  • Scan for out of date plugins, themes and WordPress versions
  • Check the strength of passwords
  • Monitor disk space
  • Scan for unauthorized DNS changes
  • Scan files outside your WordPress installation

The fast alerts on the slightest hint of a problem are comforting. I especially like the “Scan core files against repository” function!!! If a file changes, or an extra one appears, the alarm bells start ringing!

 

WordPress Security Plugins Summary

One or other of these four plugins are sure to solve the particular security issues on your WordPress website. They provide a known base from which to start your countermeasures. There are several others that can be trialed. My pick of the litter is Wordfence – that’s because its reliable, has that core code verification feature and notifies you immediately of any plugin upgrades!

 

WordPress Hacking Recovery

Usually, the fastest way to deal with a known breach of WordPress is to;

  • Use the 1-click update in WordPress Dashboard / Updates to overwrite all core files that may have been compromised
  • Where a plugin is implicated. delete the plugin directory, and then upload a new copy
  • Where a Theme is implicated, copy your old files across to replace the compromised files

Follow that up by viewing the sites files in your Control Panel file manager or an FTP application such as Smart FTP, and look for;

  • Files and directories that were altered or uploaded and don’t belong.
  • Inappropriate file permissions – e.g. directories should usually NEVER be set to 777 permissions, as this gives access to anyone to do anything… The correct directory permissions for most hosting accounts is 755.
  • Unexpected items in /uploads/ or /backups/ directories.
  • File Modified dates that don’t match up with any edits, uploads or changes you’ve made

If you are using any of the WordPress Security plugins, do a Scan from within the site. Use more than one online scanning service to examine your website. These all have strengths in different areas, and one may identify issues that another might not spot. Try VirusTotal – scan the Home page URL and get a quick report from multiple sources The overriding goal is:

  • deleting the compromised files and replacing them with the correct versions
  • ensuring secure permissions across directories and files
  • implementing a security plugin

That must be followed by immediately by:

  • changing the WordPress admin password
  • changing the Cpanel / Plesk / Hsphere admin password
  • changing the FTP access password
  • deleting any “extra” User or FTP accounts that may have been added to provide easy future access for the hackers

Core File Compromises

If the /wp-config.php has been altered in any way, it is wise to reset the WordPress Database User Account password, and add the new password into the /wp-config.php file. This can be done through the Admin Control Panel access to MySQL Database management. In the case of Cpanel its very easy to change the MySQL password.

Backups

Having an automated monthly backup process scheduled, with off-server storage, makes sound business risk management sense.

WordPress Security Conclusions

  • Avoiding the problem is not particularly difficult.
  • Eliminating the problem is usually straightforward.

We also provide a comprehensive Annual WordPress Maintenance Service plan that addresses all of the issues covered in this article, for a very modest annual cost.