WordPress is continuously growing and has become a very popular CMS. As it became popular, hackers also took a keen interest in breaking its security, which is the most sensitive and essential issue in WordPress.
Website owners do their best to make their sites successful. They work hard to protect their site from hackers. Undoubtedly, having your site attacked is the most disappointing thing that can happen to an entrepreneur. In such an instance, you look for host support. But they are not always readily available.
To make it not get attacked, you must provide security to your site because it is always better safe than sorry.
Providing security to your site means reducing the chances of being attacked. It is a continuous process that you should manage. It’s all about utilizing the proper security controls that best help address the dangers and dangers as they relate to your site.
Security mainly involves three factors: people, processes, and technology. Each element works in synchronous harmony with the other. Without people and their operations, technology itself would be useless.
This guide will provide essential security concepts to help you harden WordPress security.
Web Hosting:
You need to own a self-web-host with many options to drive any website. Choosing web hosting comes in varieties- managed hosting, shared hosting, VPS hosting, etc. Each host handles security disparately.
Some of them provide:
- DDoS protection
- Anti-virus scanning of all files in your hosting account.
- A firewall.
- Virus scanning of requests or files as they arrive at your website.
- Here is the list of best-managed WordPress hosting.
The site owner is also responsible for securing the areas they want to control and for changes made to the hosting option.
Security Concepts:
Harden WordPress security is an important step for keeping your digital empire safe. The main aim of this guide is to provide some basic security concepts you shouldn’t skip. Here are some security concepts that you should know:
- Working Environment
- Deep Defence
- Least Privilege Principle
- Web Server Security
- Database Security
- FTP or SFTP
- Other Security Controls
Working Environment:
Any business should never take workplace safety lightly. Due to the sensitivity and regulations associated with our data, it is essential to protect it and reduce security incidents.
While securing the Working Environment, keep these factors in mind:
- Use an updated version of your local computer, browser, and routers.
- Always use anti-virus to protect from spyware, malware, and virus infections.
- Use a VPN while moving in public places and using public hotspots to encrypt your online communications.
Deep Defence:
This concept promotes the use of every security approach on every layer. It involves using a firewall at the very basic level to avoid external attacks, a security scanner to find threats in events, and authentication control to prevent unauthorized access. Remember that every security aspect is designed to fix bugs, warnings, and attacks directly.
Least Privilege Principle:
If you allow multiple editors and authors to access the site, make sure you enable them with only essential and limited resources.
The principle is based on the idea that all user accounts should run with as few privileges as possible. It’s all about giving limited access to users who require it.
It provides:
- Better System Stability
- Better security
- Ease of deployment
- Protection of data and functionality from faults and malicious behavior
Web Server Security:
Web server configuration plays a critical role in your Web application’s security. A slight mistake can cause many problems. The term involves protecting information assets that can be accessed from a Web server.
Sometimes, a web server and its software contain vulnerabilities. When managing your host, always install security updates for the operating system, web server, PHP, and applications.
Generally, the Secure Sockets Layer (SSL) certificate is used to secure web servers. If your website doesn’t have an SSL certificate installed, you can set up Cloudflare flexible SSL.
Database Security:
The database is the backbone of any site or blog. It holds the website’s overall data. Databases are complex, and an administrator does not always know the implications of not ensuring database security.
Not ensuring database security may invite hackers to get in and out of a database with a goldmine of data. The risks involved with databases vary depending on the type of information and its importance.
So, staying secure is essential to prevent embarrassing and costly incidents. Database security involves using the terms that protect databases against confidentiality, integrity, and availability compromises.
It involves encryption during data transmission, defining user access control systems, etc.
Providing Database Security:
- Use parameterized queries to keep malicious requests from your database and prevent SQL injections.
- Keep only features and services that are essential.
- Keep your databases up to date. Remove unknown components and enforce the most minor privilege parameters to ensure your databases’ confidentiality, integrity, and availability.
- Use UPS to make sure any forced shutdown doesn’t cause data loss.
- Keep your database clean. Use an Advanced database cleaner to clean and optimize the database.
FTP or SFTP:
FTP is an abbreviation for File transfer protocol. The protocol is being used to transfer files between computers on a network. FTP is a popular method of transferring data between two remote systems.
Many experts suggest that instead of using FTP, you must use SFTP. SFTP stands for SSH File Transfer Protocol or Secure File Transfer Protocol. Initially, it is a separate protocol packaged with SSH that works similarly over a secure connection.
SFTP is preferable to FTP because of its underlying security features and ability to piggyback on an SSH connection. It also involves many graphical tools.
Other Security Controls:
Consistently growing hacking attacks are a severe concern for bloggers. So, staying alert and maintaining security helps you protect your reputation and offer the best service to visitors.
Create a Unique Username and long-tail passwords:
WordPress gives a common username, ‘admin,’ during installation; you can either create a new account with administrative access and delete the old account or change the username from the database.
WordPress’s current admin URL is ‘wp-admin,’ which hackers can easily find. However, for security concerns, you can change this URL or password-protect the admin directory.
By doing this, hackers won’t get the login URL. It reduces the chances of being attacked.
Similarly, short and simple passwords are easy to remember. Using solid and long-tail passwords can slow or often defeat various attack methods.
Protect WordPress Configuration wp-config.php File:
Wp-config.php is the most critical file located in your WordPress root directory. It comprises crucial information like database names and passwords. Thus, it is essential to protect this file to provide tight security to your WordPress blog/site.
Read the process of securing a wp-config.php file.
Always stay up-to-date:
Hackers can quickly identify an old version, and they don’t lose this golden opportunity. Keeping everything up-to-date ensures that your WordPress sites are secure against potential attacks.
It also involves updating the latest version of themes, plugins, web applications, etc.
Maintain Regular Backups:
Proper backup is essential for driving a blog or site with restored data. To ease this task, WordPress provides free plugins that will quickly backup and restore your entire website in case of any problem.
Use Security Plugins:
Protecting your site from attacks or vulnerabilities keeps it in a better position on the search engine. WordPress provides security plugins and other plugins in its plugin store. These popular plugins help you reduce threats or vulnerabilities and secure your site.
Two-Factor Authentication:
Two-factor authentication is a two-step verification process. It provides an extra security layer and prevents hackers from accessing the user’s account.
The most common type of attack is the brute-force attack. In this attack, hackers try many combinations of usernames and passwords multiple times until it gets in.
Two-factor authentication secures your website by requiring a login password and a unique code sent to your mobile.
WordPress provides two-factor authentication plugins.
If you are using JetPack, I recommend using the Single Sign-On feature. It handles WordPress’s authentication.
Files and Directory Permissions:
WordPress may need access to write files in your WP-content directory to enable certain functions. You must specify files and directories with who and what can read, write, modify, and access them.
Permissions change from host to host. These variations include changing them to be more restrictive.
The default permission scheme should be:
Folders – 755
Files – 644
For security concerns, avoid having any file or directory set to 777.
If you want to change the permissions, you need to give the following commands:
For files:
find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} \;
For Directories:
find /path/to/your/wordpress/install/ -type d -exec chmod 755 {} \;
I recommend using FTP/SFTP to do this.
Disable File Editing:
WordPress primarily recommends disabling file editing within the WordPress dashboard. Do this by adding the following lines of code in wp-config.php
:
// Disable File Editing in WordPress Dashboard
define('DISALLOW_FILE_EDIT', true);
WP-Includes:
If you don’t want any scripts to be accessed by any user, you can block them by using mod_rewrite
in the .htaccess
file.
Add the following code outside the # BEGIN WordPress and # END WordPress tags in the .htaccess
file.
# Block the include-only files
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
# BEGIN WordPress
Wp-Content/Upload:
It is the directory where all files are uploaded separately. Thus, it is a must to avoid PHP execution here. To do so, add the following lines of code in .htaccess
at the root of /UPLOADS.
# Kill PHP Execution Apache 2.2
<Files *.php>
deny from all
</Files>
# Kill PHP Execution Apache 2.4
<FilesMatch ".+\.php$">
Require all denied
</FilesMatch>
Check indexing status and optimize visibility:
You can check your site status using free services like Google Search Console and the Bing webmaster tool, which includes indexing and optimization.
These tools are also known as reputation monitor tools.
So, these are some essential security fundamentals tips that will help you harden WordPress security and what action you should take next. Did I miss something? Let me know in the comments.