Brute-force attempts against /wp-login.php are continuous on any reachable WordPress site. They’re noise, not signal — until one succeeds. The defenses against them are not exotic. The trick is layering them so each one catches what the previous one missed, and putting the cheapest defenses outermost.
What’s happening
A brute-force run sends thousands of POST requests to wp-login.php with credential guesses. Each one hits the WordPress stack, instantiates the user query, checks the password, and returns. Even a “wrong password” response involves a full PHP-FPM worker, a database lookup, and bcrypt verification. At scale, brute-force runs can saturate the server before they actually succeed. Defense is partly about credentials and partly about not paying the cost of processing every guess.
How to verify
Find the current load on the login endpoint:
grep 'POST /wp-login.php' ~/public_html/access-logs/example.com | wc -l
grep 'POST /wp-login.php' ~/public_html/access-logs/example.com | \
awk '{print $1}' | sort | uniq -c | sort -rn | head -10
If the per-IP count for the top sources is in the thousands, you’re under active brute-force. If it’s a few hundred per day, that’s background noise that needs at least light defense.
The fix
The layered approach, outermost first:
-
WAF or CDN rate limit. If the site is behind Cloudflare or another CDN, configure a rate-limit rule: more than 5 POST requests to
/wp-login.phpfrom the same IP per minute → challenge or block. This stops the attack at the edge before it touches your server. Cloudflare has a “WordPress Login Protection” template that does this with one click. -
Server-level rate limit. On cPanel with ModSecurity, the OWASP CRS includes login-related rules. Confirm they’re enabled in WHM > ModSecurity Tools. Add a custom rule for stricter rate limiting at the server level:
SecRule REQUEST_URI "@beginsWith /wp-login.php" \ "id:9000,phase:1,t:none,initcol:ip=%{REMOTE_ADDR},setvar:ip.login=+1,expirevar:ip.login=60,chain" SecRule IP:LOGIN "@gt 10" \ "deny,status:429,log,msg:'Login rate limit exceeded'" -
IP allowlist for login. If only known IPs need access to wp-login.php (covered separately), restrict at
.htaccessor Cloudflare WAF. Most powerful single defense, but trades convenience. -
fail2ban. If the cPanel host runs fail2ban (or you can install it), a WordPress filter catches repeated failed logins and adds the source IP to
iptablesfor a configurable window. Recipe:- Configure WordPress to log failed logins to a file (a plugin like “WP Fail2Ban” handles this).
- Configure fail2ban with a filter matching that log format.
- Action:
iptables -I INPUT -s <ip> -j DROPfor 1 hour after 5 failures in 10 minutes.
-
Limit Login Attempts at the application layer. Plugins like “Limit Login Attempts Reloaded” or “Wordfence” handle this. They lock out a username (or an IP) after N failures. Useful as a last line, but cheaper to stop the request earlier.
-
Disable XML-RPC.
wp-login.phpis the visible target;xmlrpc.phpis the often-forgotten one. It accepts authentication and can be used for brute-force with one POST containing many guesses. Either disable it entirely (add_filter('xmlrpc_enabled', '__return_false');) or block at.htaccess:<Files xmlrpc.php> Require all denied </Files>Only un-block if you confirm something legitimate needs it (Jetpack, some legacy mobile apps).
-
Strong unique passwords plus MFA. All of the above slows attackers down. None of it prevents a real credential from working. Force MFA for administrators. Force-rotate passwords on takeover.
-
Log and monitor. A spike in brute-force activity is usually a precursor to something more interesting. Stack Harbor monitors WordPress login activity as part of managed enterprise WordPress hosting ongoing ops.