stillorigin / blog

wp-login.php brute force from hundreds of IPs: stopping it before PHP runs

When every address makes only a guess or two, nothing looks wrong per IP, yet PHP and the database are busy all night. The fix is to stop the request before WordPress loads.

the stillorigin team 5 minute read WordPress and website security

stillorigin blog hero: a flood of requests aimed at a WordPress login form is stopped at the sentry line, while one allowed request passes through to the origin server.

Here is a night most hosts know. One WordPress site is slow, PHP-FPM is busy, and the access log is full of POST /wp-login.php. You count the addresses: hundreds, each with one or two attempts. fail2ban never triggers. Per-IP limits look fine. The login page is still being hammered.

That is a distributed brute force. Each address makes a guess or two, then a different one takes over, so the per-address numbers stay low. Meanwhile every attempt does real work. WordPress loads, PHP runs, the database is queried and a password hash is checked, only to say no. Multiply that by a few thousand attempts and a shared server notices.

What per-IP limits can and can't do

By default, a WordPress domain on stillorigin with Website protection on has a limit on the login page: about 4 requests a minute per IP address for wp-login.php, with a small burst allowance. Go over it and you get HTTP 429. Separately, /xmlrpc.php is blocked outright on WordPress domains, which we covered in How to stop xmlrpc.php attacks on WordPress.

That limit is useful against one noisy source. It does nothing against hundreds of addresses that each stay under it, and we won't pretend otherwise. By default the login page and admin area are open to everyone, the same as they are without stillorigin. To stop the spread-out version, you need a control that doesn't depend on one address misbehaving.

Option 1: lock the login to addresses you choose

The admin login lock is optional and off by default. When it is on, only the addresses you list can open wp-login.php or anything under /wp-admin/. Everyone else gets a 403 from the sentry. You can list up to 50 IPv4 or IPv6 addresses or ranges for each domain, and it blocks even while the domain is in log mode.

A few things to know:

  • /wp-admin/admin-ajax.php stays open, because themes and plugins call it from public pages, such as contact forms and carts.
  • Add your own address first, then your customer's. If an address isn't on the list, that person is locked out, including you.
  • It suits sites run by a small team from known places. It is a poor fit for a site where many people log in from changing mobile addresses, or for a shop where customers sign in through wp-login.php.
  • If you use domain owner access, you can let owners set their own lock. That permission is off by default, and a lock you set stays yours.

Option 2: check visitors on the login page

When the site has lots of legitimate visitors who need to log in, use Captcha Protection instead. Under Chosen pages you list the paths that should be checked, and the WordPress button adds /wp-login.php and /xmlrpc.php for you. A visitor's browser does a small piece of work in the background, then the page opens. There is no puzzle for a person to solve. Scripts that can't run the check are stopped, and a visitor who passes isn't checked again until they go 30 minutes without opening a page.

Be clear about what this is. It raises the cost of each guess and stops simple scripts. It is not a promise to stop every bot, because a bot that drives a real browser can pass a check like this. It is also not applied to verified search engines or payment providers, which are never checked.

One catch for new domains: Website protection starts in log mode, and while a domain is in log mode the automatic checks, including Chosen pages, only record who would have been checked. Look at the Blocks tab, then switch the domain to blocking when you are happy.

Option 3: count whole networks, not single addresses

Attackers rotating through addresses often stay inside the same few networks. Two controls count by network instead:

  • Per-network limits add up the requests from every address in a /24 (IPv4) or /48 (IPv6) network.
  • A URL rule for /wp-login.php can rate limit per network, at 6, 30 or 60 a minute or 2 or 5 a second. New rules start in log mode, so you can see what they would catch before you enforce them.

In both cases, visitors over the limit get a Captcha Protection check, or a "too many requests" page when Captcha Protection isn't available.

What to turn on, in order

  1. Turn on Website protection, and HTTPS inspection for HTTPS visits. Set the domain's Type to WordPress for the login limit, the xmlrpc.php block and the admin login lock. Captcha Protection does not need the WordPress type, but it does need Website protection and HTTPS inspection.
  2. If the people who log in are few and known, turn on the admin login lock.
  3. Otherwise, add /wp-login.php to Captcha Protection's Chosen pages, and add a URL rule for it in log mode first.
  4. Watch Logs and the domain's Blocks tab. Reasons such as wp-admin-lock and http-429 tell you which control caught what.
  5. Keep strong passwords and two-factor login on the accounts themselves.

Once a domain is in blocking mode, requests the sentry refuses (a 403, a 429, or a failed browser check) are answered at the sentry and never reach the origin, so WordPress and PHP never run for them. In log mode, the WAF and automatic Captcha checks (including Chosen pages) only record what they would block and still pass the request to WordPress. The xmlrpc.php block, the wp-login.php limit and the admin login lock still block in log mode. That is the point of doing this at the edge instead of in a plugin.

If you want this on your own servers, you can start a 30-day free trial. Pricing is on the pricing page. For more on floods that don't come from one noisy address, see Distributed scrapers: why per-IP limits miss them, and how to keep sites up anyway.

brute forceCaptcha ProtectionWordPresswp-login.php

Questions hosts ask

Why doesn't fail2ban stop a brute force from hundreds of IPs?
fail2ban counts failures per address. If each address makes only one or two attempts, none of them reaches the threshold, so nothing is banned while the site still gets hundreds of login attempts. It is still worth running. It just cannot see a pattern that is spread across addresses.
What is the default wp-login.php limit in stillorigin?
On a WordPress domain with Website protection on, each IP address is limited to about 4 requests a minute for wp-login.php, with a small burst allowance. Going over gets HTTP 429. That catches one noisy source. It does not catch a distributed attack where each address stays under the limit.
Will the admin login lock lock out my customer?
It can, if their address is not on the list. Anyone not on the list gets a 403 on the login page and admin area, including you. Home and mobile addresses change, so the lock suits sites where staff log in from known places. An account owner can turn it off in the portal at any time.
Does the browser check make real users solve a puzzle?
No. Their browser does a small piece of work in the background and the page opens by itself, usually in a few seconds. Someone who has passed is not checked again until they go 30 minutes without opening a page.
Do I still need strong passwords and two-factor login?
Yes. stillorigin reduces how many guesses reach WordPress. It does not make a weak password safe. Two-factor login and unique passwords are still the best protection for the accounts themselves.

Try stillorigin for 30 days.

Put a sentry in front of a server and see what it takes off the origin. The trial includes one sentry, and you can cancel at any time.