Dev.to WebDev 🛠 Dev 👁 0 📖 4 min read

We Checked 95 WordPress Agencies for xmlrpc.php, REST Users & debug.log — 57.9% Had Live Exposures

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 s

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 .htaccess is ignored (or Nginx sits in front of Apache), verify with curl after deploying — never assume .htaccess took 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.html that someone deleted manually six months ago.
  • A staging-to-production push accidentally carries WP_DEBUG_LOG or drops a .htaccess rule.
  • A host migration switches from Apache to Nginx, silently invalidating .htaccess denies.

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

(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.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.