Are you working on an online store on Magento? There is a 63% chance it is infected with at least one security issue.
Magento is free and open source, and that means, it is a very attractive platform for intruders, fraud and malware. It is second most attacked e-commerce platform, and that means, unless you have customers who trust you their payment information, your store is in danger. Any piece of personal information is a clue to stealing from you or your customers.
But there is also good news for you: even if your business is not making a fortune, you can afford a secure Magento. Below you will find obvious and not so obvious security measures, accessible for both Magento 1 and Magento 2.
Know your security patches
This tip is not a top secret. If you are using Magento of any version, update it as soon as you can. Updates are there for a reason, they cover last discovered compatibility and security issues for your Magento version. No software or extension can replace regular updates and original security patches. Speaking of which, there are two patches that are must-haves for functioning online stores:
- SUPEE-9767. This patch adds an important setting to the Magento, which helps new customers register at the checkout. The setting is located at System > Configuration > Admin > Security.
- SUPEE-6788 is a major patch in providing the security of the online store backend. Without this patch, there is a breach that allows anyone to access admin login page just by a direct link to the installed extension. Installing this patch cuts off any unauthorized users from your store admin area.
The patches above are the top priority ones for Magento 1, but with any new vulnerability, there comes a new patch, special for every version.
Get updates for PHP and Apache
This might be yesterday news, but PHP version older than 5.6 and Apache versions lower than 2.2 are not only a bad decision in terms of functionality, but also a dangerous practice for online business. There are no active support and updates for the older versions, and that means, you are left one on one with unexplored vulnerabilities, which will never be covered. But if you are to used to it, what are the dangers of not shifting to a newer version? Well, in 2016 alone there were more than 100 PHP-related issues reported, including XSS, malicious code execution, and DDoS attacks.
Find your way around admin settings
Everything you need to make sure only real administrators have instant access to the admin area is located under System > Configuration > Admin > Security in the admin panel. The settings you need to double check are:
- Add Secret Key to URLs. enabling the setting closes your website from possible forgery attacks and commands from unauthorized users.
- Login is Case Sensitive. A simple feature to provide better security at admin login by requiring complex usernames with letters and numbers.
- Session Lifetime (seconds). By constraining time for sessions you make your admin team confirm their identity once in a period of time to continue working. Works best if set on minimum value.
There are a few more tabs with settings that can contribute to the store security. You should pay attention and fill in:
- Admin User Emails. If it happens that an admin forgets the password, the recovery link is highly confidential information. To protect it, you can restrict the time it works.
- Admin Base URL. by default, all Magento stores have the same path to the admin area. For intruders, It doesn’t take much to guess the link for your store and exploit it with script attacks. Changing the link to a custom one is not a 100% hack proof solution, but works great.
Extra tip: you can change the URL in app/etc/local.xml file. A new link should be placed in the brackets instead of ‘admin’.
- CAPTCHA. It is an old but golden rule for a secure login, available both for Magento 1 and Magento 2 at System > Coрnfiguration > Advanced > CAPTCHA. You can adjust the requirements to your liking.
Take security measures on a server level
Magento security doesn’t end on Magento settings. Among the measures for your server side you can find useful the following ones:
- You can’t overestimate a secure login. Enabling two-factor authentication via SMS for admin users is the fastest way to verify someone’s identity.
- Keep the systems you are working with, like development, staging and testing away from public access. You can manage access by configuring IP whitelisting and .htaccess password protection.
- Set appropriate and secure permissions according to this guide.
- Make sure script launching is forbidden.
- Schedule antivirus scanning once in a while. There are tools compatible with Magento like ClamAV and Magento-malware-scanner.
- For an extra layer of security, the default session_id can be changed to custom. It prevents cookie stuffing.
- The parameters listed below should be set to low values.
- app/etc/local.xml
- dev/tests/functional/etc/config.xml
- skin/error.php
- dev/tests/functional/composer.json
- var/resource_config.json
- includes/magmi
- Block access to the .xml and json files, including:
- php_value memory_limit
- php_value max_execution_time
- php_value max_input_vars
- php_value suhosin.post.max_vars
- php_value suhosin.request.max_vars
- php_value upload_max_filesize
- php_value post_max_size
- php_value allow_url_fopen
As you can see, Magento settings can be interpreted very vastly. But do not fall for the comfort of usage when there is no restrictions for the admin users. If you spend a few more seconds at the login page, it won’t harm you or your data.
What else can I do to protect my site?
- Bewareadd-onsdons, themes and third-party extensions you install. Double-check the source of any software before using it. Torrents and third-party websites are a no go, but you can trust to Magento Marketplace extensions and certified developers.
- Backup all of your data automatically on a schedule. Make sure the location you back up to is closed for any outside access, and safe for keeping sensitive information.
- Come up with a recovery plan that can be applied in the emergency situations.
With everything mentioned above, you can consider your Magento store safe for shopping and operating. But the techniques intruders are using are improving every year, and unfortunately, there is no guarantee one day there won’t be a breach you couldn’t foresee. For such cases, you can find all-in-one security kits among existing extensions. You can collect security features separately or try products like Security Suite for Magento.
Author’s Bio: Oksana Mikhalchuk is Content Manager at NEKLO, a software engineering company with a primary focus on ecommerce development for Magento. Oksana is dedicated to writing about marketing, web design and, of course, everything Magento-related.