How To Stop Brute Force Attacks in Magento 1, 2


Brute-force attacks are becoming very common these days. Most websites are vulnerable to such attacks. If you use Magento, there are located at /admin and /downloader by default and can be abused in several ways. Hackers can easily find them and launch a brute-force attack. In such an attack, random passwords are tried automatically, until one succeeds.

A brute-force attack is one of the simplest methods to gain access to a website because other than patience it does not require any additional skills or resources. Brute-force attacks are simply trial and errors. During an attack, certain permutations and combinations of usernames and passwords are used by hackers to attempt to break into an account.

What should I do?

We recommend the following best practices

To Stop Brute Force Attacks in Magento 1, 2:

  • Customize the admin path.

  • Secure your Magento admin account.

  • Protect /downloader folder.

  • Secure .git folder.

  • Keep your store up-to-date.

  • Enable HTTPs for the admin panel.

Customize admin path

The default Magento 1 backend url is Because the default Magento backend URL is the common knowledge in brute-force suites, you can easily get some advantages by cutting the low-hanging fruit.

Customize your current admin path as the following:

Edit file /app/etc/local.xml XML Path: admin -> routers -> adminhml -> args -> frontName

You can see <![CDATA[admin]]>, now change it to your own admin url, e.g: secret or mybackend

Now flush Magento cache to take effect: System -> Cache Management -> Flush Magento Cache

Magento 2: Not required.

Secure your Magento admin account

Don’t use the admin account

People usally use admin as first admin account. This is security issue for your Magento store because hackers can guest it easily. We recommend that you should change the admin account name to your own account name, nickname or your email address.

Keep your password strong

The best way to protect your Magento store against a brute-force attack is to – and advise other administrators to – use a strong password. An adequate password should:

  • Contains more than 8 characters
  • Includes numbers
  • Includes chracters (Using both lowercase and uppercase characters is highly recommended)
  • Includes symbols: optional

Protect /downloader folder

In Magento 1, it uses /downloader called Magento Connect Manager folder to install extensions from Magento Connect. This is the default path, it is easy for hackers to attack your Magento website. You can rename it but there is an effective way to protect the downloader folder, it is IP whitelist


Edit the file downloader/.htaccess and add the folowing lines to the end:

order deny,allow
deny from all
allow from x.x.x.x

x.x.x.x is your whitelist IP v4 address.


Open configuration file of your Magento website. E.g: /etc/nginx/conf/mywebsite.conf

Add the following block of lines:

location /downloader/ {
  allow x.x.x.x;
  deny all;

  location ~ \.php$ {
    echo_exec @phpfpm;

Cpanel or DA hosting

You can ask for support from your hosting providers.

Tips: Choose a great hosting for your Magento 2 store.

Protect local.xml file

local.xml file is very sensitive data that contains database information, admin path or crypt key. If this information is leak to public, you will run into serious problems.

Check it now, navigate your browser to If it cannot access to the data, your website is safe. Otherwise, you can follow the Protect /downloader folder to disable that.

Secure .git folder

Git is now popular, every store is using Git as control version of its store. Git folder contains many important information such as repo url, code files …

You can follow the Protect /downloader folder to disable that.

Is your store up-to-date?

  • Apply security paches. There are some security patches that Magento has released recently, you can download it (here)[]
  • Install the Magento latest version. Updating to latest version will keep your store stay healthy.

Enable HTTPS for admin panel

Since Magento is used for e-commerce transactions, the data is often very sensitive. This is why it is recommended that all of your login details should pass through a secure connection.

Go to System > Configuration > Website

How To Stop Brute Force Attacks in Magento 2 Enable SSl

It comes to the end of tutorial: How To Stop Brute Force Attacks in Magento 1, 2.

Please leave comments if you have any questions, feedbacks.

Comments for How To Stop Brute Force Attacks in Magento 1, 2

You also may like these Magento 2 Extensions

One Step Checkout

54 reviews

Layered Navigation

26 reviews


24 reviews

People also searched for:

  • Stop Brute Force Attacks in Magento 2