In one of previous guest post, Sarah Rexman mentioned some tips about securing WordPress and in this post I'm gonna share my own experience. While working as freelancer on oDesk, Elance and Freelancer; clients always have issues about securing their sites from hackers and ask about how to prevent from future attacks. So consider these points to secure your WordPress site for now and future:
- Keep your WordPress up to date. Latest stable version is 4.7.2 released on 26th January, 2017.
- Keep your all plugins, themes up to date.
- Always keep backup of your database, files and make it update after some interval.
- If site has been compromised, then you must change your salt keys from your wp-config.php file under root directory. You can generate new keys from here. It will force all users to have to log in again.
- Change your all passwords associated with site at regular interval.
- Use strong passwords for all logins. Include the mixture of atleast one uppercase letter, lowercase letter, special character, number.
- Change your WP-Admin username from admin to some other name.
- Change database prefix from wp_ to some other complicated characters to avoid zero-day SQL injection attacks.
- Remove timthumb script if your site running it as its no longer supported or maintained.
- Use plugins after testing it properly. Going through plugin review, Google search will let you know about the reputation of the plugin.
- Keep track of latest visitors through log files for tracking site users. If you find any suspicious activity at any particular time, then logs files might help you to know a bit about the attacker.
- Change permissions for .htaccess, wp-config.php, themes main files to 444.
- Proper file permissions for other files and folders. Best practice is to use 644 for files and 755 for folders.
- Keep your own system virus free.
- Always try accessing the site credentials from your own system only.
- Validate all user inputs like URL, image uploads etc.
- Keep track of WP-Admin, FTP accounts user section for any unauthorized user.
- You can also use Wordfence plugin to monitor from malicious scripts.
- Put some security to the server on which your site is hosted, either it hosted on dedicated or a shared server.
- Keep updated with latest vulnerabilities.
Is your own site get infected with malware/virus, contact me through contact form to get rid of malware with future security implementation. In some cases, site might be hit by pharma hack, you can check it either through site content or by searching your site on Google with query "site:example.com pharma"
Having any further issue? Please comment down!