For WordPress brute force protection, set a failed login limit that locks out the IP, enable two-factor authentication (2FA) for every administrator and use administrator usernames and emails that cannot be guessed. The Konet server already stops a large part of the attacks with Imunify360. The measures inside WordPress close what gets through, and Konet recommends doing them with Wordfence.
What is a brute force attack on the WordPress login
A brute force attack is automated trying of username and password combinations until one works. On WordPress, bots mainly hit two places:
- The
wp-login.phplogin form, where/wp-adminalso leads. xmlrpc.php, which accepts logins from applications and can try many passwords in one request.
Signs that your site is under such an attack: alerts about many failed logins or lockouts, unknown usernames in the login attempts, and a wp-admin that slows down at certain times.
What the Konet server already does
On Konet servers, Imunify360 monitors logins and applies rate limiting. When an IP makes many failed attempts or many requests in a short time, it is blocked or asked to pass a CAPTCHA check. The same applies to cPanel, email and FTP. We describe the server protection layers in Wordfence and Imunify360.
The server, however, does not know who your administrators are. An attack from thousands of different IPs, with a few attempts each, may never reach the server limit. That is why measures inside WordPress are needed too. Konet's Terms of Use require every site to limit login attempts and to use 2FA where available.
Step 1: failed login limit (limit login attempts)
With Wordfence, open Wordfence > All Options and find the Brute Force Protection section:
- Leave brute force protection enabled.
- In Lock out after how many login failures, set how many wrong attempts are allowed.
- In Amount of time a user is locked out, set how long the IP stays locked out.
- Enable Immediately lock out invalid usernames, so anyone trying a username that doesn't exist is locked out immediately.
- Save the changes.
As an example, a site under persistent attack was set up like this: 5 failures lock out the IP for 15 minutes, and if the same IP is locked out again within 24 hours, the lockout becomes 24 hours. For most sites the Wordfence defaults are enough. Don't make the limit so strict that your own collaborators get locked out after one mistake.
Step 2: two-factor authentication with Wordfence Login Security
With 2FA, a stolen or guessed password is not enough. The code produced by the authenticator app on the phone is also needed.
- Open Wordfence > Login Security.
- Scan the QR code with an authenticator app and type the six-digit code.
- Download or copy the recovery codes and keep them off the computer.
- In the Login Security settings, make 2FA mandatory for the Administrator role, and for Shop Manager if you have WooCommerce.
- If you want, also enable CAPTCHA on the login form, so bots are stopped before they try a password.
The same logic applies to cPanel, with cPanel two-factor authentication.
Step 3: administrator emails and usernames that don't attract attacks
- Never an administrator with an info@ or sales@ email. Generic addresses are visible on the site and are the first thing bots try on the login form, because WordPress accepts an email instead of a username. Give every administrator a personal address.
- No admin username, and not the domain or company name either.
- One account per person. Don't share the same administrator with collaborators. Create their own user and delete it when the work is done.
- Few administrators. Someone who only writes posts needs the Editor or Author role, not Administrator.
Step 4: log in with username and password, not social login
Administrators always log in with username, password and 2FA, not with a "Sign in with Google" button or other social login. If an administrator's personal Google or Facebook account is compromised, the attacker gets into the site too. Social login can stay for e-shop customers, not for administrators.
Step 5: new passwords when the site goes live
During development, passwords travel through emails, messages and many hands. When the site opens to the public:
- Change the passwords of all administrators, cPanel and the FTP accounts. What changes where is in hosting access passwords.
- Delete or downgrade the accounts created for the build.
- In each administrator's profile, in the Application Passwords section, revoke the ones that are not in use.
Step 6: close xmlrpc.php if you don't need it
If you don't use the WordPress mobile app or a service that connects via XML-RPC, disable logins through it. In Wordfence this is done in the Login Security settings, with the option that disables XML-RPC authentication. If one of your services stops connecting, enable it again and keep 2FA.
Changing the login path and a shorter session, pros and cons
Two extra measures that are often discussed. They help, but they don't replace steps 1 and 2.
| Measure | Pros | Cons |
|---|---|---|
Moving wp-login.php and /wp-admin to another path (change wp-admin url) |
Fewer automated requests to the login form | If you forget the path you are locked out. It can conflict with plugins, cache or e-shop login forms, and can be lost during a migration or when the plugin is disabled. It doesn't stop an attack that already knows the path |
| Shorter session | A stolen login cookie or a forgotten open computer stays valid for less time | Administrators log in more often |
WordPress keeps you logged in for 2 days, or for 14 if you tick Remember Me. If you want a shorter period, don't tick Remember Me on shared computers, or set a shorter duration with a plugin.
If you change the login path, note it somewhere safe and tell whoever maintains the site.
Frequently Asked Questions
Which plugin does Konet recommend for brute force protection?
Wordfence. The free version has a failed login limit, 2FA and CAPTCHA. How to configure it so it doesn't slow the site down is in Wordfence and Imunify360.
Isn't the server's Imunify360 enough?
It stops most mass attacks, but it doesn't know your WordPress users. The login limit and 2FA inside the site close the attacks that come from many IPs with a few attempts each.
I got locked out of wp-admin after wrong passwords, what do I do?
Wait for the lockout to expire or try from another network. If you forgot the password, see how to get back into wp-admin. If the site or cPanel doesn't open at all from your network, see how to unblock your IP.
I lost the phone with the 2FA app, how do I log in?
With one of the recovery codes. If you don't have them, another administrator can remove 2FA from your account in Wordfence > Login Security.
I see thousands of failed logins, has the site been compromised?
Not necessarily. Failed logins mean the attack did not succeed. Worry if you see a successful login you didn't make or an unknown administrator, and then follow WordPress hack recovery.
Is it worth changing /wp-admin to another address?
It can reduce automated requests, but it doesn't replace the login limit and 2FA, and it has the risks in the table above.