Web security

XML-RPC: definition

Definition

XML-RPC is a protocol for calling functions remotely through XML messages. In WordPress, the xmlrpc.php file lets you publish from an external application and receive pingbacks; enabled by default, it is also a frequent target of password-guessing attempts and pingback abuse.

XML-RPC, Web security

XML-RPC started out as a generic protocol: a program sends an XML request naming a method and its parameters, and the server runs it and replies in XML. In WordPress, it takes the form of the xmlrpc.php file at the root of the site. It dates from a time when people wrote their posts in desktop software, and it implements the old Blogger, metaWeblog and Movable Type APIs in addition to WordPress's own wp.* methods.

What XML-RPC is used for today

  • Remote publishing from an app or external tool that authenticates with a username and password.
  • Receiving pingbacks, the notifications sent by another blog that links to you (the pingback.ping method).
  • Running certain services, including Jetpack, whose connection to WordPress.com goes through xmlrpc.php.

Since the REST API arrived in core, most of these needs have a more modern solution. Many sites no longer use XML-RPC at all, yet it remains enabled by default.

The risks

The official WordPress documentation names xmlrpc.php as a frequent brute-force target: every publishing call accepts a username and password, with no page to load and no cookie. In October 2015, Sucuri described attacks that used the system.multicall method to test hundreds of passwords in a single HTTP request. WordPress 4.4 limited this amplification: after one authentication failure, the following calls in the same request fail too. The method nevertheless remains a source of load and a common reason for blocking at the firewall level.

Pingbacks raise another problem. To verify a pingback, WordPress fetches the page that claims to link to it, at an address supplied by the sender. Thousands of sites can thus be used as relays in a DDoS attack against a single victim, without having been hacked.

Three-column table: legitimate uses of xmlrpc.php (publishing from an app, Jetpack, pingbacks, older management tools), common abuse (password guessing, system.multicall, abused pingbacks, server load) and defenses (blocking the file, removing pingback.ping, application passwords and 2FA, server or CDN rule)

For WordPress: shutting down or limiting XML-RPC

An often misunderstood point: the xmlrpc_enabled filter doesn't disable XML-RPC. Its documentation states that it only turns off methods that require authentication, not pingbacks. Depending on your use:

  • No use at all: block xmlrpc.php at the server or CDN level (a <Files "xmlrpc.php"> block on Apache, location = /xmlrpc.php { deny all; } on Nginx). It is the only method that also spares PHP the load.
  • Jetpack: the same block, with an exception for the IP addresses published by Jetpack.
  • Remote publishing: keep the file, remove pingback.ping with the xmlrpc_methods filter, and use application passwords, which can be revoked one by one.

After the change, open /xmlrpc.php in a private window: the response should be 403 or 404. Our article XML-RPC on WordPress: risks, uses and disabling it compares the methods in detail. If you keep XML-RPC, two-factor authentication on publishing accounts makes stolen passwords far less useful.

WP Feint's Hardening module handles XML-RPC in the free version: a first level removes the pingback methods, the next makes xmlrpc.php return a 404 error, with a warning that Jetpack and some apps will stop working. Since the blocking is done by WordPress, PHP still runs: a server or CDN rule removes that load as well. Requests to the closed URL are counted as a bot trap.

Further reading

  • Article How to disable XML-RPC on WordPress: risks, uses and the right method
  • Page WordPress hardening

Sources

  1. WordPress Developer Resources: filtre xmlrpc_enabled (external link, opens in a new tab)
  2. WordPress Developer Resources: Brute Force Attacks (external link, opens in a new tab)
  3. Sucuri: Brute Force Amplification Attacks Against WordPress XMLRPC (octobre 2015) (external link, opens in a new tab)
  4. WordPress Developer Resources: XML-RPC WordPress API (external link, opens in a new tab)

All definitions

Start free, go Pro when you’re ready

The free version already hides WordPress and moves the login page. Pro adds aliases, two-factor authentication and monitoring.