5 min read

Top 20 Best Practices to Protect your Magento Store from Cyber Attacks

Protect Magento

Magento powers millions of online stores worldwide. However, with its popularity comes the increased risk of cyberattacks. Securing your ecommerce store is crucial to protecting your customers' data and ensuring your business's reputation and success. Here are some best practices to ensure a secure ecommerce website:


1. Use the Latest Version

Often, people choose to deploy the “latest – 1“of the Adobe Commerce version. While the most common argument is the stability of the release, it should be noted that the latest version contains security fixes that plug known vulnerabilities. Of late Adobe has been providing security releases in addition to feature releases. This helps customers who would like to address security releases and skip any feature updates.

2. Use Two-Factor Authentication (2FA)

Magento 2 platform offers Two-Factor Authentication (2FA), which provides a layer of security. This is the default feature which allows trusted users to access the Magento 2 backend. We can use Google Authenticator, Authy, Duo, and U2F keys. By using your smartphone's password and a security code, admin login security is enhanced.

3. Set the Content Security Policy

A Content Security Policy (CSP) provides an extra layer of defense for Adobe Commerce and Magento Open-Source installations by helping to detect and mitigate Cross-Site Scripting (XSS) and related data injection attacks. CSP offers a standardized set of instructions for browsers to determine trusted and blocked content resources. With well-defined policies, CSP can restrict browser content to display only whitelisted resources.

4. Update the Admin URL

The admin uses the "Admin URL" to access the backend of a store. Using a “custom” Admin URL helps you avoid determined attackers and reduce exposure to scripts attempting to break into your site. It prevents hackers from getting to your admin login page even if they somehow get hold of your password.

5. “Security Key” to Admin Panel

Adding a secret key to URLs is effortless in the Magento 2 ecommerce platform. The key safeguards the admin panel by granting access exclusively to authorized users. In addition, you can strengthen Magento 2 security by including keyboard inactivity time as a precautionary measure. This action will end the session and grant the admin access to the admin panel once more.

6. IPs Restriction

Restrict the IPs from where the Magento Admin is accessible. This way, requests from unauthorized IPs for access to “admin” are denied.

7. Action Log

Activities of each admin will be recorded and saved to logs, such as login, save, delete, flush, etc. This feature helps in tracking the admin actions of the team carefully.

8. Failed Logins Restriction

If a person attempts to log into an account multiple times but has not succeeded because of entering the wrong passwords/usernames, it may not be a simple mistake. These login attempts aren’t perceived to come from store admins and are harmful to the store.

To prevent this issue, a warning system should be applied. First, the system will count the number of failed logins, if this number reaches the maximum, a warning letter will be sent to store owners/admins every 5 minutes until no failed break-in attempts are found.

9. Encrypted Connections (SSL/HTTPS)

There are risks of data interception when transmitting information, like login details, over an unencrypted connection. Your credentials can be compromised through this interception. A secure connection is necessary to address these issues.

To obtain a secure HTTPS/SSL URL in Magento, simply enable "Use Secure URLs" in the system configuration menu. It plays a critical role in both PCI compliance and securing online transactions on your ecommerce website.

10. Use Secure FTP

One of the primary techniques for hacking a site is by guessing or intercepting FTP passwords. Protect yourself by using secure passwords and utilizing SFTP, which employs a private key file for decryption or user authentication. We must avoid using 3rd party tools but rely on console logins.

11. Elevated Privileges

When setting up Magento on Linux, care should be taken that the users do not grant themselves elevated privileges. Adobe recommends permission schema for running Magento.

12. Admin User Permissions

Be judicious about granting Magento Admin panel access to all users. Based on the role and need to access data, admin user permissions can be set. It provides an extensive permission scheme that can be leveraged for the same.

13. Use Captcha

Most ecommerce websites use forms to submit data. It is highly recommended that Captcha be used before submitting the form. We can use Captcha for Admin tool.

14. Secure Uploads

Based on business, customers need to upload files of various types. We should restrict the type and size of files. The destination of these uploads should not be a “pub” folder. We recommend that it be a different folder but sym-linked as per architecture.

15. Strong Password

People often use their full names, birth dates, company names, or simple number sequences for passwords. And such passwords can invite brute attacks. Your store's access is protected by a password. A strong password policy is needed when deciding on a password. At the least, the password should have a mix of upper- and lower-case alphabets, numbers, and special characters such as ?, >, etc. (If you struggle to remember a difficult password, try using a password management service). Also, refrain from using your passwords for any other website login. To make it harder for hackers, it's best to keep your password separate from other applications.

16. Disable Directory Indexing

Another method to enhance the security of your ecommerce store is by disabling directory indexing. Disabling directory indexing allows you to hide storage paths for your domain files.

It keeps cyber criminals from getting into the core files of your website. Access to your data is still possible if they know the full path.

17. Forgot Password Loopholes

Through the pre-configured email address, users have access to an excellent password recovery option. The vulnerability of your entire store increases if that email ID is compromised. Make sure your email address is private and secured with two-factor authentication.

18. Hosting

Shared hosting is not recommended for ecommerce businesses. While shared hosting may appear attractive for startups, it sacrifices store security.

Dedicated hosting can be an alternative, but it might not be enough if you're restricted to just one server. Limited resources can lead to website crashes when there is a sudden increase in ecommerce store traffic. However, a managed cloud provider can be the ideal choice for hosting Magento, ensuring strong security through regular server-level patches.

19. WAFs

Use Web Application Firewalls, which can curate the requests before they hit the server. There are many in the market that can leverage AI so that any zero-day exploits are also addressed.

20. Security Reviews

As stated earlier, Magento developers are not necessarily security experts. The intricacies of site security are known by a select few. Once or twice a year, it's crucial to assess your website for any visible loopholes and security weaknesses.

The process entails performing a comprehensive security scan of the site, plugins, and installed extensions in Magento 2. If any loopholes, bugs, or security flaws arise, obtain security patches from reliable security firms. When done correctly, these reviews contribute to strengthening your store security.

By implementing these best practices and maintaining vigilance, you can significantly enhance the security of your ecommerce website and protect your business from cyberattacks.


Secure Your Magento Store with Kensium

Performing a comprehensive security audit for a Magento ecommerce website is crucial to identifying and addressing vulnerabilities that could potentially lead to security breaches. Kensium builds multi-channel commerce experiences with Magento, now Adobe Commerce. With training provided by Kensium experts, you can cut down on training time and encourage employees to adopt the new systems.

We offer a comprehensive security audit service that will take the security of your ecommerce website to the next level. We'll explore ecommerce security threats and provide cyber resilience strategies to safeguard your Magento store. Our end-to-end Magento website security includes identification, protection, detection, recovery, and response services that will instantly establish trust and elevate your shopping experience. Contact us today to speak with our helpful team members!

Mastering Inventory Management in Ecommerce with Acumatica

Effective inventory management is the backbone of a successful ecommerce business. Without it, retailers face challenges like stockouts, backorders,...

Managing Multi-Channel Inventory with Ease on Shopify


Navigating the complexities of inventory management is a critical challenge for multi-channel sellers. With the rise of ecommerce,...

Upgrading to Magento 2.4.7 and PHP 8.3


In the ever-evolving world of ecommerce, staying ahead of technological advancements is crucial for success. Magento, a leading...