When we think about website security, the highly publicized breaches of major companies come to mind. Multimillion-dollar security leaks involving exposed credit card information, login credentials, and other valuable data are covered extensively by the media, leaving one to believe only large-scale businesses are susceptible to online security risks
Don’t be fooled. Security standards are vital to the well-being of any website, large or small. That’s why site owners are often bombarded by warnings of security risks in tandem with the sales pitches of many hosting providers. How do you separate the sales hype from the real risks?
Education is the first step to protecting your online brand. Here, I’ll cover some best practices to follow in your website management operations, as well as some key security features to look for in a prospective web hosting company.
Web Host Security Features to Look for
Most of us will use a hosting provider and select one of their plans. The services fall on a spectrum ranging from shared hosting to dedicated server hosting. The hosting provider will take care of many security measures, but, depending on the plan you select, you should ask questions to learn exactly which features the company provides and what you need to do.
1. Backups and Restore Points
People often overlook backups as an element of security. Backups both provide and require security. Backups must be kept in a secure location away from the main server, following the other security steps we will outline. A secure backup provides a trusted repository for the latest copies of the system and data that can be deployed to restore a known, clean system to operation.
It is important to ask about a hosting company’s backup schedule and restore policies. For example, how frequently are backups conducted — weekly, monthly, or daily? Will the support reps help you restore your site from backup files, or are the backups intended for their use only? Will the team find and restore lost or corrupted files or will they only do a complete replacement from a recent backup? Will the hosting service only use the most recent backup or can you request restores from further back in time, and if that’s the case, how far back in time can you go?
2. Network Monitoring
Does the host provider monitor the internal network for intrusions and unusual activity? Diligent monitoring can stop server-to-server spread of malware before it gets to the server hosting your site. Ask for some details on how the support team monitors the network, whether the staff is dedicated to this function, and what the engineers look for. SolarWinds’s guide to network monitoring best practices details several procedures and policies that any good network management team should follow.
3. SSL, Firewalls, and DDoS Prevention
Distributed-Denial-of-Service (DDoS) attacks happen when an overwhelming amount of traffic is sent to your site, rendering it useless to visitors. Prevention starts at the edge of the network with a good firewall. However, there are limits to how well a firewall stops DDoS attacks.
Can your provider give you some sense of what intrusions the company’s firewalls are likely to stop and what other measures the security team employs? If you have a plan in which you manage your own server, you will need to know how to augment what the hosting service provides. At what stage will the network monitoring folks inform plan owners of potential problems that might affect their site?
Does the provider make SSL certificates available? It will be your responsibility to implement SSL, but you can’t if it is not available. We’ll get back to this in section 12.
4. Antivirus and Malware Scanning and/or Removal
You should understand which protective actions your hosting provider will perform and what you must do on your own to protect your website. Does the support team run scans on the files in your account, and can you see the reports? If your account becomes infected, does the support plan include help in identifying and removing the malware? The server security steps we describe starting with step 6 will take you a long way toward keeping malware off your website.
5. High Availability and Disaster Recovery
Look for a hosting company that will keep your site running with 99.9% uptime or better. This goes beyond file-level backups. Is a bare-metal image available for your server? This is a complete copy of a clean, functioning server operating system for a speedy recovery from system failures.
The host’s network should have redundant hardware to guard against downtime caused by hardware failures. Firewalls can be configured to run in pairs, with each one ready to take over the full load in case the other one fails. The same concept extends to servers. Hardware failover is an important component of high-availability networks.
Load balancing is another high-availability feature. In this case, multiple servers are ready to handle server traffic. They all work with the same copy of your website data stored on a network shared drive and hand off traffic to each other so that no one server becomes overburdened.
Server Security Best Practices
If you have a plan that provides a server without management support, you may have to do some or all of this on your own. If your plan does include some degree of hardware and/or software management support, the following will give you an idea of which questions to ask or what the support people are talking about.
6. Access and User Permissions
At the host level, access means physical access to the machines, as well as the ability to log into the server. Physical access should be limited to trained technicians with security clearance.
You and your host company should use Secure Socket Shell (SSH), or equivalent, to log into the server to maintain the operating system (OS) or the website. For extra security, use RSA keys protected by a passphrase. Digital Ocean and Rackspace both have tutorials on how to do this.
Another good security step is to whitelist IPs that are allowed to access the server for maintenance. This can be done and modified through the hosting company’s control panel provided for your account. You should also disable logins from the user root. Malicious players will commonly attempt to exploit this access point because the root user has full administrative privileges. You can always give equivalent permission to authorized admin logins.
Files are protected by file permissions. Incorrect permissions cause time-consuming errors, and it is tempting to fix these errors by granting full permissions to all files. Don’t do this. It gives any criminal hacker full control of your system if they get in. Sucuri’s guide to website security includes a primer on correct file permissions.
7. File Management
All access to your server is remote. No one will go to the server to add, remove, or move website content files. You should use secure FTP (SFTP) with a secure and robust password for all file transfer and maintenance while also following other FTP and SFTP best practices.
8. Applications and Logins
The hosting company should have a strict password policy for employees with mandatory password changes at regular intervals as well as when equipment or personnel changes. You should have similar policies for your server access passwords. Establish and enforce policies for strong passwords. Those who want to can exploit weak passwords within hours.
Remove any unused, unmaintained apps on the server so no one can exploit unpatched vulnerabilities. Install — and maintain — utilities that monitor the server CPU, disk use, memory use, and application uptime.
The databases on your server are potentially vulnerable targets for online criminals. UC Berkeley provides a guide to hardening databases against attacks.
Coding and Website Security Best Practices
The security of your website software and data files is your responsibility, even with a managed hosting plan. As a webmaster, you are responsible for managing your content and your site’s functionality. The hosting company does not know what you want on the site or how you want it to function for your site visitors.
9. Passwords and User Access
At the website level, you will have passwords for people who administer the site, guest authors, and potentially website visitors, depending on the nature of the site. Establish and enforce password strength policies for everyone who has backend access.
Admin staff and guest authors will need a stronger password because their accounts have potentially greater impact on your site. Enforce changes after any suspected hacking attempt or when updating the content management system (CMS) or other software. The firstname.lastname@example.org address/username is commonly attacked and should not be used. Use secure password managers to generate unique complex passwords.
Each account holder should have the fewest privileges needed to do their job. For example, never give admin privileges to a guest author. Your CMS should have a level of privileges that allows them to upload and edit their post and nothing more. Each person should have his or her own login so they are held responsible for all changes made by that account. High-level admins can monitor the activity of all accounts.
Never allow unrestricted file uploads. Limit uploads to the types of files your users will really need to upload, and exclude scripts or other executable code. An uploaded executable file coupled with poor file access settings will give an intruder instant control of your website.
Your server config files include settings that restrict access to your files, such as browsing directories, and protect folders containing sensitive information. See the OS-specific section for more details.
10. Plugins, Software Updates, and Backups
Always keep your CMS and software updated. Latest versions are patched to fix all known security holes. Change any default settings, such as the admin login name, that individuals can find and use to break in.
When installing plugins and other software, consider the code’s age or the date of its last update, as well as the number of installs. These metrics give you an idea of the safety and reliability of the product. If it is inactive, it probably has not been vetted for security holes. Be wary of the source of the download for this software. Third-party sites may have added malware to the package.
Your website content is not secure until you have automatic, frequent, and redundant backups conducted. The backups should be stored apart from your main server. The idea is to protect your content against said server’s potential failure. A backup that is on the server will often fail along with the server, depending on the nature of the disaster. The backups should happen frequently enough to capture changing and new content, and they should happen without needing someone to remember to start them each time. Test the backups to be sure that the system is working. Check these critical website best practices for more ways to develop a sound backup strategy.
If you have custom themes, plugins, or similar software, it is a good idea to keep fresh copies of the install files. If they have malfunctioned or been compromised, that problem will be saved on the backup. The install files ensure you can get back to a pristine working copy.
Keep in mind that a backup gets your site back in a hurry, but it does not fix the underlying problem that crashed it. For example, if someone used an exploit to penetrate your site, that vulnerability still exists in the backup copy and needs to be fixed right away.
11. Code Reviews
A code review is an in-depth check of an application after development is complete and it is ready to be released. This is best done with a mix of automated tools and human inspection. The review is conducted in the full context of using the app — from login and authentication to data processing, encryption, and storage.
Be wary of SQL (Structured Query Language) deviously inserted into your website files by a third party. SQL injection is a method in which an attacker responds to an input request, such as username, with a valid SQL command. These commands can access data or delete it. Microsoft’s guide to SQL injection describes the attacks in detail and suggests ways to mitigate the risk such as with the use of session variables.
12. Encryption, Firewalls, and DDoS Protection
A web application firewall (WAF) monitors HTTP traffic to and from specific web applications. This provides more specific security than a network firewall, which does monitor HTTP, but does not understand the specific requirements of a web application. A WAF can be configured to prevent SQL injections as well as other techniques such as cross-site scripting and probing for vulnerabilities.
Although DDoS prevention should be enacted at the network level, attackers may use one or a combination of several methods to flood your servers, and site owners must respond and protect themselves accordingly. Several noteworthy security leaders, including Cloudflare and Incapsula, offer advanced mitigation and prevention tools and services that can be employed to help keep sites safe.
Finally, SSL (secure sockets layer) technology is required when sensitive data is transferred to and from the server. An SSL certificate does not secure your server from attacks or malware, but rather encrypts and secures communication between your server and the person using your site. By using SSL, you are securing your customer’s information and keeping their trust in your site.
Operating System Security Best Practices
Some of the measures that you take will depend on the operating system of your server. Web servers run either on Linux/Unix or on Windows. You usually choose this when you choose the hosting plan.
13. Linux and Unix-Based OS
The server config file on Linux servers is called .htaccess. You can set rules in this file that prevent directory browsing and other activities that could expose sensitive information or open the server to other vulnerabilities.
Although the PHP (hypertext preprocessor) language is more available and convenient, there are risks to using it on these servers. These OSes have a permission called executable, which means the file can execute code. It is important to limit executable commands when using PHP. This is where a code review is beneficial.
In general, Linux/Unix OSes have fewer known threats and a faster response. SELinux and AppARMOR are two security extensions that are used with these servers.
14. Windows OS
Windows servers have user privileges, such as executable, limited by default, and admins must enter passwords to gain high-level permissions. Security measures are guided by the Security Compliance Manager function on these servers. The config file where access restrictions are set is web.config. Microsoft provides a guide to security best practices. Although there are more known security holes with the Windows OS, trained Microsoft programmers patch flaws and release updates and are available to respond to incidents.