Dev.to Security ๐Ÿ” Cybersecurity ๐Ÿ‘ 0 ๐Ÿ“– 7 min read

How to protect WordPress xmlrpc.php and wp-login at the edge

Bots go straight for /xmlrpc.php and /wp-login.php on every WordPress site they find. Each request wakes PHP and touches your database, even when the guess is wrong. The cheapest defence is to refuse them before they rea

How to protect WordPress xmlrpc.php and wp-login at the edge

Security & Protection Studio on Hubfly space: rate limiting on at 10 requests a second with a burst of 20, request filters active, and "Firewall rules saved"

Bots go straight for /xmlrpc.php and /wp-login.php on every WordPress site they find. Each request wakes PHP and touches your database, even when the guess is wrong. The cheapest defence is to refuse them before they reach WordPress. This guide shows you how to protect WordPress xmlrpc.php and the login page with three edge rules on Hubfly space: block the files WordPress never needs to serve, rate-limit each IP, and keep unfinished or staging sites behind a login. It takes about 15 minutes once the site is running.

Try it on Hubfly space

Versions used: WordPress 6.9.4 (PHP 8.3, Apache) and MariaDB 11, from the dashboard's WordPress template.

Why protect xmlrpc.php and wp-login at the edge, not in a plugin

A security plugin runs inside WordPress, so PHP has already started by the time it says no. An edge rule answers before the request reaches your container. On Hubfly space, every project has a Security & Protection Studio between the internet and your containers, and a blocked request is answered there in under a millisecond.

xmlrpc.php deserves special attention: its system.multicall method lets one request try many passwords. Most sites don't use it at all.

Step 1: Deploy WordPress and check the price first

In your project, click Create โ†’ Compose Stack, search the Presets tab for "wordpress" and click WordPress. It loads two services, wordpress (wordpress:6.9.4-php8.3-apache) and db (mariadb:11), plus two 10 GB volumes, wp-data and db-data.

The WordPress template in Stack Composer with a $9.10/month estimate

Both services default to the Dedicated tier (1 vCPU, 1 GB RAM, 5 GB disk each), so read the estimate before you click Deploy Stack. Why: a dedicated container runs all month, and you pay for it all month.

Item Math (730 h) Per month
CPU 2 ร— 1 vCPU ร— $0.004 ร— 730 $5.84
RAM 2 ร— 1 GB ร— $0.002 ร— 730 $2.92
Container disks 10 GB ร— $0.00001536 ร— 730 $0.11
Volumes (Balanced, 1.5ร—) 20 GB ร— $0.00001536 ร— 1.5 ร— 730 $0.34
Total $9.21

The composer shows $9.10 because it prices the volumes at the Standard rate. Once deployed, the volumes are created as Balanced storage, and the project summary shows $9.21/mo projected. Set a monthly budget cap when you create the project (Advanced Options โ†’ Monthly Budget Limit). At 100% of the cap, running workloads are stopped and new deploys are blocked, so you can't overspend by accident.

Click Deploy Stack. The database deploys first, WordPress waits for it, and the whole stack finishes in about a minute and a half. Check that both containers say Running on the canvas, not just that the deploy log says "finished".

Step 2: Add a domain, then lock it before anyone else finds it

Open the wordpress container, go to Network โ†’ Add Domain โ†’ Auto Endpoint, keep port 80 and click Create Subdomain. You get an HTTPS address like your-site.g.hubfly.app with TLS and Force HTTPS on.

Here's the trap most guides skip: a fresh WordPress container redirects every WordPress page, including the login and xmlrpc.php, to /wp-admin/install.php, and that installer is public. Whoever opens it first creates the admin account. Lock the site before you install it:

  1. Click the Firewall box on the project canvas to open Security & Protection Studio, and pick your domain at the top.
  2. Open the Identity Access Control tab.
  3. Turn on Policy Enforcement State and choose Login Required.
  4. Click Save Policy Settings. The status changes from Permissive to Enforced.

Now a request without a Hubfly space session never reaches PHP. A script gets 401, a browser is sent to the sign-in page, and you get through as normal when you're signed in to the dashboard. Finish the WordPress installer in your own browser.

For a staging copy or an internal site, simply leave this on. For a public blog, turn it off once WordPress is installed and use the next two rules instead.

Step 3: Block the files WordPress never needs to serve

In the WAF Firewall & Logs tab, click Edit Request Filters. Under Blocked Request Paths (Regex / Substring), add these one at a time (press Enter after each):

/xmlrpc.php
/\.env
/.git
/wp-config.php
/readme.html

The blocked request paths in the request filter dialog

Click Done, then Save WAF Config at the top right. Nothing is live until you save. Why each one: xmlrpc.php is the brute-force amplifier, .env and .git are the first things scanners probe for, wp-config.php holds your database password, and readme.html announces your WordPress version.

Each entry is matched anywhere in the path as a regular expression, which has useful side effects:

  • /wp-config.php also blocks leftovers such as /wp-config.php.bak.
  • A query string (/xmlrpc.php?x=1), URL encoding (/xmlrpc%2Ephp) and ../ tricks are still blocked.
  • /\.env (with the backslash) blocks /.env but not an innocent path like /xenv.
  • Matching is case-sensitive, so /XMLRPC.php isn't matched. That's harmless here, because Linux file names are case-sensitive too and that path never runs xmlrpc.php.

Blocked requests get 403 and a "403 Access blocked" page from the edge.

Don't add /wp-admin or /wp-login.php, even though the docs use /wp-admin as an example. Because the match is a substring, /wp-admin also blocks /wp-admin/admin-ajax.php, which many themes and plugins call for logged-out visitors, and it locks you out of your own dashboard.

Don't rely on the CMS Shield template (under Apply Template) on its own. After applying it, open Edit Request Filters and check that the paths are listed. If the list is empty, add the five entries above by hand.

Step 4: Rate-limit each IP

In the same tab, switch on 2. Rate Limiting. The dialog proposes 10 requests/sec with a burst of 20, using a leaky bucket per client IP (the docs suggest 20 r/s and a burst of 50 as a starting point). Click Apply Settings, then Save WAF Config.

With 10 r/s and a burst of 20, a client that fires 60 requests at once gets about 21 answers and 429 Too Many Requests for the rest, and it's served again a few seconds later. That stops floods and noisy scanners.

Rate limiting on at 10 r/s with a burst of 20, and the saved firewall

Be clear about what it doesn't do. At 10 r/s, one IP can still send 36,000 requests an hour. A patient password guesser stays under any sane limit, so keep a login-limiting plugin such as Limit Login Attempts Reloaded for /wp-login.php.

Step 5: Check it works

From your laptop, run:

curl -s -o /dev/null -w "%{http_code}\n" https://your-site.g.hubfly.app/xmlrpc.php
curl -s -o /dev/null -w "%{http_code}\n" https://your-site.g.hubfly.app/.env
curl -s -o /dev/null -w "%{http_code}\n" https://your-site.g.hubfly.app/

You want 403, 403, and 200 (or 302 if WordPress isn't installed yet). If Login Required is still on, / returns 401 instead (blocked paths still return 403). That's expected for a staging site. Then scroll down to Security request logs in the studio. Every blocked request is listed there with its status (403, 429 or 401), method, path and client IP.

What can go wrong

  1. Nothing is blocked. You closed the dialog without clicking Save WAF Config. Rules apply only after you save and see the "Firewall rules saved" message.
  2. You're locked out of wp-admin, or AJAX features break. You blocked /wp-admin or /wp-login.php. Remove it and rely on the rate limit plus a login plugin.
  3. Jetpack or a mobile publishing app stops working. It may still use xmlrpc.php. Remove that one entry, and keep the rate limit.
  4. Every visitor looks like the same IP to WordPress. Behind a reverse proxy, PHP can see the proxy's address unless your login plugin reads the forwarded-for header. Set its trusted proxy header, or one lockout can block everyone.
  5. A bypass path opens more than you meant. In Identity Access, a bypass entry like /health is a raw prefix that also opens /healthz and /health-admin. Use a folder form like /public/*. Also, don't trust X-Hubfly-User-* headers on bypassed paths, because clients can send their own.

Who this is not for

  • You already run Cloudflare or another WAF in front of the site. Two edges doing the same job just double the debugging.
  • You want managed WordPress with automatic core updates and backups. This is a container platform: you update WordPress and plugins and back up wp-data and db-data yourself.

FAQ

Is it safe to block xmlrpc.php?

For most sites, yes. The block editor, the REST API and normal logins don't use it. Jetpack and some older publishing apps have relied on it, so check yours first.

Does blocking xmlrpc.php stop wp-login brute force?

No. It closes the amplified route, but /wp-login.php stays open. Add the per-IP rate limit and a login-limiting plugin.

What status code does a blocked request get?

403 with an "Access blocked" page for blocked paths, 429 when an IP exceeds the rate limit, and 401 for scripts without a session when Login Required is on.

Do the firewall and Identity Access cost extra?

No, they're free. You pay only for containers and storage. Creating resources needs a one-time $5 deposit, which stays in your account as credit.

Can I run WordPress on the free tier?

You can switch both services to Shared in the composer. Shared containers sleep after 15 minutes without traffic. The 360 free hours a month cover one container that's often asleep, not two that are always on (2 ร— 730 = 1,460 hours). For a real site, budget for Dedicated.

Go further on Hubfly space

  • Use your own domain. Point www or your root domain at the container: custom domains docs.
  • Block or allow whole networks. Use Manage IP Rules to deny an abusive CIDR range or allow only your office: Firewall docs.
  • Protect an API with keys instead of logins. Identity Access also has an API Key Only mode: Identity Access docs.

Related: 502 Bad Gateway in Docker? Bind to 0.0.0.0 ยท Canary releases with a weighted load balancer

Start free, 360 hours included. Deploy WordPress, lock the installer, and add the three rules above. Try it on Hubfly space

By Octave ยท drafted with AI, tested on Hubfly ยท Last updated 19 November 2026

๐Ÿ“ฐ Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.