Skip to content

Blocking xmlrpc.php at Cloudflare without breaking Jetpack

xmlrpc.php is the most-abused file on a WordPress site, but Jetpack and the mobile apps still need it. The WAF custom rule that blocks everyone except Automattic, and how to test it before Jetpack notices.

xmlrpc.php earns more attack traffic per byte than anything else on a WordPress site: one system.multicall request can carry hundreds of password guesses, and the pingback method turns your server into someone else’s DDoS cannon. The catch is that Jetpack — and anything riding its connection, like Jetpack Backup — talks to your site through this exact file. The clean setup is a Cloudflare WAF custom rule that blocks xmlrpc.php for the world and exempts Automattic’s published network, so Jetpack keeps working while everyone else hits a wall at the edge.

What’s happening

Cloudflare evaluates each request through its edge layers in order: DDoS mitigation, IP Access rules, WAF custom rules, rate limiting, then managed rulesets, with bot products (Bot Fight Mode on Free, Super Bot Fight Mode on Pro and Business) adding their own verdicts. A custom rule is the right layer for this job because it can combine a path match with a source exception in one expression, and every plan — including Free with its five custom rules — can express it.

The reason you cannot simply block the path: Jetpack’s connection to WordPress.com is XML-RPC. Automattic’s servers call https://yoursite.com/xmlrpc.php for stats, backups, Publicize, and the monitor feature, and those calls come from Automattic’s published range 192.0.64.0/18 (its network is AS2635). The WordPress mobile apps also use XML-RPC when a self-hosted site is not connected through Jetpack, and a few site-management dashboards still drive sites over it. Also worth knowing: everything modern that is not Jetpack has moved to the REST API, so for most sites the legitimate XML-RPC audience is exactly one network. One more machine-behaviour fact drives the design: every legitimate consumer of this file is a bot of the good kind, so a challenge action is never appropriate here — machines cannot solve challenges. It is allow or block, nothing in between.

What to check first

  • Whether anything actually uses xmlrpc.php. Check your origin access logs for a week of POST /xmlrpc.php entries and note the source IPs and user agents before deciding on the exception list.
  • Whether Jetpack is installed and connected. No Jetpack, no Automattic exception needed — block the path outright and this article gets shorter.
  • Whether the mobile apps are in use. Team members publishing from the WordPress app on a site not connected through Jetpack will lose access when you block; connecting the site to Jetpack routes them through Automattic instead.
  • What already fires on the path. Managed rulesets and rate limiting may already act on xmlrpc.php; know the current behaviour before layering.

How to verify

Before the rule, confirm the endpoint answers; after the rule, confirm who it answers to:

# A harmless XML-RPC call - listMethods
curl -s -D - -o /tmp/xmlrpc-body.txt -X POST "https://www.example.com/xmlrpc.php" \
  -H "Content-Type: text/xml" \
  --data '<?xml version="1.0"?><methodCall><methodName>system.listMethods</methodName></methodCall>'

# Before: HTTP/2 200 with an XML method list
# After the rule: HTTP/2 403, server: cloudflare, block page in the body
grep -oE "Cloudflare Ray ID: [a-f0-9]+" /tmp/xmlrpc-body.txt

Watch the rule work in the dashboard:

Security > Events
  Filter: Path equals /xmlrpc.php
  Read:   Action taken = Block for the world,
          no events (or Skip events) for Automattic sources in 192.0.64.0/18

Then confirm Jetpack’s side from a clean vantage point: in wp-admin, open Jetpack’s connection status and run a stats refresh; from a second network (mobile hotspot), repeat the curl to confirm strangers still get the 403.

The fix

  1. Create the exception-plus-block as one rule. Security > WAF > Custom rules > Create rule, name it xmlrpc-lockdown, action Block:

    (http.request.uri.path eq "/xmlrpc.php" and not ip.src in {192.0.64.0/18})

    One rule, one slot, no ordering trap between a separate skip and a separate block.

  2. Prefer the IP range over the ASN, but either works. not ip.src.asnum eq 2635 (Automattic’s AS) is broader and survives range additions; 192.0.64.0/18 is what Automattic documents for Jetpack. Pick one and write it in the rule description with a date.

  3. Add other legitimate callers explicitly. If your log review found a management dashboard or the mobile apps hitting the file directly, add their IPs to the exception — or better, put them in a custom IP list and use ip.src in $xmlrpc_allowed, the pattern from WAF custom rules: block, challenge, log, skip.

  4. Roll out via Log if the site is high-stakes. Set the action to Log for 48 hours, then read Security > Events for matches you did not predict. Flip to Block when the only matched traffic is traffic you are happy to lose.

  5. Mirror the block at the origin. Edge rules do not protect a server that attackers can reach directly. Deny xmlrpc.php in the vhost with the same Automattic exception, and keep the origin firewalled to Cloudflare’s ranges — patterns covered in Cloudflare WAF rule patterns for WordPress.

  6. Disable pingbacks in WordPress regardless. The XML-RPC pingback surface should be off at the application level too; the edge rule is your first gate, not your only one.

When this fix is wrong

If nothing on the site uses XML-RPC, do not maintain an exception you do not need — block the path unconditionally and revisit only if something breaks. And if your real problem is login brute force arriving over wp-login.php as well, this rule solves half of it; the login half is a rate limiting and challenge problem, as laid out in rate limiting wp-login, xmlrpc and REST.

Common mistakes

  • Using Managed Challenge on xmlrpc.php — every legitimate client is a machine, so a challenge equals a block for Jetpack and an open door for nothing.
  • Blocking with a WordPress plugin only, which still lets the request burn PHP workers; the point of the edge block is that the origin never spends a cycle on it.
  • Writing the exception as a separate skip rule placed below the block rule, where it never runs.
  • Copying an Automattic IP list from an old forum post instead of the documented 192.0.64.0/18.
  • Forgetting the file exists at every alias of the site (staging subdomain, bare domain) that shares the zone but not the rule’s hostname condition, if you added one.

Prevention

Re-run the log review twice a year: Jetpack’s ranges are stable, but your own legitimate callers change as plugins come and go. Keep the rule description current, and alert on any spike of 403 events on the path — a surge means someone new is grinding the endpoint, which is exactly the signal working as intended. The custom rules reference is at developers.cloudflare.com/waf/.

Tuning edge security so it blocks attacks without blocking customers is ongoing work — Stack Harbor watches those events around the clock under 24/7 Monitoring & Response; book a monitoring and response review.