We recently ran a passive, read-only check across 95 live WordPress and WooCommerce agency websites (standard HTTP probes only — no authentication, no brute-forcing, no fuzzing, and zero domains named here).
These are sites built and maintained by teams that manage WordPress for clients every day. Still, 55 out of 95 (57.9%) exposed at least one classic WordPress attack surface on their own production domain:
| Finding | Count (n = 95) | Share | Why bots care |
|---|---|---|---|
Public /readme.html
|
41 | 43.2% | Exposes WordPress core version strings for instant CVE matching |
Unauthenticated /wp-json/wp/v2/users
|
22 | 23.2% | Lists valid WordPress author login slugs without a session |
Live /xmlrpc.php
|
19 | 20.0% | Enables system.multicall password amplification and pingback abuse |
Public /wp-content/debug.log
|
3 | 3.2% | Leaks PHP warnings, absolute server paths, plugin versions, and stack traces |
The 3 publicly readable debug.log files are the scariest pattern: someone enables WP_DEBUG_LOG to troubleshoot a checkout or theme issue, forgets to turn it off (or forgets to delete the file after disabling debug mode), and Nginx/Apache happily serves /wp-content/debug.log with HTTP 200 to the entire internet.
Here is the exact hardening checklist and copy-paste rules to close all four in under five minutes.
1. Check your own sites passively first
Before touching production configs, verify what is actually exposed from the outside — caching layers, reverse proxies, and CDN rules often override what you think .htaccess is doing.
You can check with curl:
curl -sI https://example.com/wp-content/debug.log | head -n 1
curl -sI https://example.com/readme.html | head -n 1
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/wp-json/wp/v2/users
curl -s -X POST -d "<methodCall><methodName>system.listMethods</methodName></methodCall>" \
-o /dev/null -w "%{http_code}\n" https://example.com/xmlrpc.php
Or if you want to check a client domain from a browser (along with security headers and core version leaks, with no login and no storage), we built a free passive WordPress Security & Exposure Checker that runs all of these checks in one pass.
2. Nginx hardening rules
Add these inside your server { ... } block and reload Nginx (nginx -t && systemctl reload nginx):
# Block xmlrpc.php completely (skip only if you actively rely on Jetpack XML-RPC)
location = /xmlrpc.php {
deny all;
access_log off;
log_not_found off;
}
# Never serve debug logs or WordPress readme/license files publicly
location ~* /(?:wp-content/debug\.log|readme\.html|license\.txt)$ {
deny all;
access_log off;
log_not_found off;
}
# Optional: block unauthenticated REST user enumeration at the edge
location ~* ^/wp-json/wp/v2/users {
if ($http_cookie !~* "wordpress_logged_in_") {
return 403;
}
try_files $uri $uri/ /index.php?$args;
}
3. Apache .htaccess hardening rules
If you are on Apache / LiteSpeed, place these above the # BEGIN WordPress block so WordPress updates do not overwrite them:
<Files xmlrpc.php>
Require all denied
</Files>
<FilesMatch "^(debug\.log|readme\.html|license\.txt)$">
Require all denied
</FilesMatch>
Note: On managed hosts where
.htaccessis ignored (or Nginx sits in front of Apache), verify withcurlafter deploying — never assume.htaccesstook effect.
4. Cloudflare WAF Custom Rule (best for agencies managing many sites)
If your client sites sit behind Cloudflare, one custom WAF rule stops automated probes before they ever burn PHP-FPM workers on your origin:
(http.request.uri.path eq "/xmlrpc.php")
or (http.request.uri.path eq "/wp-content/debug.log")
or (http.request.uri.path eq "/readme.html")
or (
starts_with(http.request.uri.path, "/wp-json/wp/v2/users")
and not http.cookie contains "wordpress_logged_in_"
)
Set the action to Block (or Managed Challenge if you want to test cautiously first).
5. WordPress MU-plugin / functions.php fallback
Even when blocked at Nginx or Cloudflare, adding an MU-plugin (wp-content/mu-plugins/hardening.php) keeps WordPress clean if a site migrates hosts later:
<?php
// 1. Disable XML-RPC
add_filter('xmlrpc_enabled', '__return_false');
// 2. Remove generator meta tag
remove_action('wp_head', 'wp_generator');
// 3. Restrict REST /wp/v2/users to authenticated users
add_filter('rest_endpoints', function ($endpoints) {
if (!is_user_logged_in()) {
unset($endpoints['/wp/v2/users']);
unset($endpoints['/wp/v2/users/(?P<id>[\d]+)']);
}
return $endpoints;
});
And if you ever need WP_DEBUG_LOG in production, point it outside the webroot in wp-config.php:
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', '/var/log/wordpress/site-debug.log');
Why continuous external verification matters
The most common failure mode we saw wasn't teams ignoring security — it was config drift:
- A WordPress core update restores
/readme.htmlthat someone deleted manually six months ago. - A staging-to-production push accidentally carries
WP_DEBUG_LOGor drops a.htaccessrule. - A host migration switches from Apache to Nginx, silently invalidating
.htaccessdenies.
Pair your server-side firewall/plugin setup with external monitoring that verifies uptime, SSL certificates, DNS changes, security headers, and unintended search/indexing changes from outside the server.
Further reading & free tools
- Full hardening walkthrough (canonical guide): WordPress Security Hardening Checklist
- Free browser-based passive check (no signup): WordPress Security Checker
- Comparing monitoring + security stacks across client fleets: Agency Monitoring Cost Calculator & Beamfar vs Wordfence
(Disclosure: I work on Beamfar. If you manage multiple client sites and are evaluating external monitoring alongside your WordPress security stack, we also have a Black Friday lifetime offer live on AppSumo through December 1 at noon CT.)
What WordPress misconfiguration or leftover debug artifact has bitten you hardest in production? Drop it in the comments — always curious what other teams add to their post-deploy checklist.
Top comments (6)
The config-drift point is the real takeaway. Almost nobody turns these on deliberately; a core update or a host move quietly undoes the fix.
One related trap from the migration side: when we move a client's marketing site off WordPress to a static build, the old
/xmlrpc.php,/wp-login.phpand/wp-json/*paths sometimes get caught by a "redirect everything to the homepage" rule. Those paths then answer with a 200, so scanners (and checks like yours) flag a WordPress surface that no longer exists. Returning a plain 404 or 410 for them keeps the results honest and stops bots retrying.That catch-all homepage redirect trap after a WordPress-to-static migration is such a sharp point — and it happens constantly.
In our passive checker we guard against soft-200 homepages on
/xmlrpc.php(requiring theXML-RPC server accepts POSTpayload),/wp-json/wp/v2/users(requiring a valid JSON author array), and/wp-content/debug.log(rejecting HTML and matching real PHP error/timestamp lines) — and your comment just prompted us to tighten/readme.htmltoo so a catch-all redirect back to/can never trigger a false positive.Returning a clean
404or410on retired/wp-*paths is definitely the cleanest way to stop bot noise and keep audits honest. Thanks for sharing that from real migrations!The drift point is what makes this a process problem, not a one-time fix. I now run those curl checks as a post-deploy step, since a core update can quietly bring readme.html back. Moving WP_DEBUG_LOG outside the webroot is the one change I would never skip.
Running those curl checks right in the post-deploy pipeline is honestly the smartest way to turn hardening from a one-off checklist into a repeatable guardrail — especially since WordPress core updates silently restore
readme.htmlandlicense.txtevery single time.And 100% agreed on moving
WP_DEBUG_LOGoutside the webroot: even if someone later enables debug logging in a rush during a checkout incident, Nginx/Apache physically can't serve a path under/var/log/.Appreciate you sharing how you wired it into your deploy flow!
Exactly — the /var/log/ point is what sold me on it too, since it removes the human-error part entirely. The readme.html restore after core updates still catches people off guard. Thanks for the write-up, the drift framing really landed.
the cobbler's kids thing is so real. agency sites get built once and then never touched because client work always wins. we run WordPress care plans at Wbcom Designs and i'd tell any agency to put its own site on the same monthly check as the client sites.