XML-RPC es una API del núcleo de WordPress que permite a los usuarios conectarse a su sitio web mediante aplicaciones, herramientas y servicios de terceros. Desafortunadamente, en el pasado, los hackers han encontrado maneras de explotar XML-RPC para obtener acceso a sitios web de WordPress.
En WPBeginner, hemos ayudado a miles de usuarios a asegurar su sitio WordPress y a desactivar XML-RPC. Hemos descubierto que hay diferentes maneras de hacerlo, dependiendo de tus conocimientos técnicos.
Por ejemplo, puedes desactivar XML-RPC accediendo al archivo .htaccess o añadiendo un fragmento de código. Mientras tanto, si usted es un principiante, entonces hay un plugin que desactiva el archivo de núcleo sin necesidad de editar código.
En este artículo, le mostraremos cómo desactivar fácilmente XML-RPC en WordPress utilizando diferentes métodos.
¿Qué es XML-RPC en WordPress?
XML-RPC es una API del núcleo de WordPress que ha estado activada por defecto desde que se lanzó WordPress 3.5 en 2012. Permite a los desarrolladores utilizar protocolos XML y HTTPS para conectarse e interactuar con su sitio web de WordPress.
En resumen, necesita XML-RPC activado para acceder a su blog y publicarlo de forma remota, como cuando desea utilizar una aplicación móvil para gestionar su sitio o establecer conexiones con servicios de automatización como Uncanny Automator o Zapier.
Sin embargo, si no estás usando aplicaciones móviles con tu sitio web, entonces algunos expertos en seguridad de WordPress pueden aconsejarte desactivar XML-RPC. Esto cierra una puerta que potencialmente puede ser explotada para hackear tu sitio web.
Dicho esto, veamos cómo desactivar fácilmente la API XML-RPC en WordPress. El método .htaccess
es el mejor porque es el que menos recursos consume, y los otros métodos son más fáciles para los principiantes.
Método 1: Desactivar XML-RPC de WordPress con .htaccess (Avanzado)
Este método es para usuarios avanzados porque requiere que edite el archivo .htaccess de su sitio. Recomendamos a los principiantes que utilicen los métodos 2 o 3.
Esta forma tiene varias ventajas, como la posibilidad de darte acceso remoto a ti y a tu equipo mientras restringes a todos los demás. Tampoco afectará negativamente al rendimiento de WordPress, ya que desactiva las peticiones XML-RPC antes de que pasen a WordPress.
Deberá añadir el siguiente código a su archivo .htaccess
. Puede hacerlo conectándose a su sitio mediante un cliente FTP o un gestor de archivos. Además, los usuarios de All in One SEO pueden utilizar la herramienta de edición integrada en el plugin para añadir el fragmento de código, como se puede ver en la siguiente captura de pantalla.
# Block WordPress xmlrpc.php requests
<Files xmlrpc.php>
order deny,allow
deny from all
allow from 123.123.123.123
</Files>
Si desea dar a un determinado usuario acceso remoto a su sitio, sólo tiene que sustituir ‘123.123.123.123’ en la línea 5 por su dirección IP. Puede añadir varias direcciones IP separándolas con espacios.
O, si desea desactivar XML-RPC por completo, borre la línea 5.
Nota: Si no puede localizar .htaccess, consulte nuestra guía sobre por qué no puede encontrar .htaccess en WordPress.
Método 2: Desactivar XML-RPC de WordPress con un fragmento de código (recomendado)
Este método requiere que añadas código a tu sitio web WordPress. Si no lo ha hecho antes, eche un vistazo a nuestra guía sobre cómo copiar y pegar fragmentos de código personalizados en WordPress.
WPCode es la forma más fácil y segura de añadir código a tu sitio WordPress. Te ayuda a gestionar tus fragmentos de código y evita que cualquier error rompa tu sitio.
En este método, utilizaremos uno de los fragmentos de código incorporados en WPCode para desactivar XML-RPC.
En primer lugar, debe instalar el plugin gratuito WPCode. Para obtener instrucciones paso a paso, marque / compruebe nuestra guía paso a paso sobre cómo instalar un plugin de WordPress.
Una vez activado, diríjase a Fragmentos de código ” Añadir fragmento. La biblioteca WPCode ya contiene un fragmento de código que desactiva XML-RPC. Puede encontrarlo buscando ‘xml’.
Una vez que lo encuentres, tienes que hacer clic en el botón “Usar fragmento de código”.
A continuación, debes poner el conmutador “Activo” en la posición “Activado”.
Por último, asegúrese de hacer clic en el botón “Actualizar” para activar el fragmento de código en su sitio y desactivar la API XML-RPC.
Método 3: Desactivar XML-RPC de WordPress con un plugin
Este es un método sencillo que se puede utilizar si no desea añadir otras personalizaciones a su sitio web con un plugin fragmento de código
Simplemente instala y activa el plugin Disable XML-RPC-API. Para más detalles, consulta nuestra guía paso a paso sobre cómo instalar un plugin de WordPress.
El plugin funciona de forma inmediata y desactiva XML-RPC.
Puede ir a Seguridad XML-RPC ” Ajustes XML-RPC para configurar el plugin. Por ejemplo, puede permitir que determinados usuarios accedan a XML-RPC poniendo sus direcciones IP en una lista blanca.
Prueba de que WordPress XML-RPC está desactivado
Ahora debe comprobar que ha desactivado correctamente la API XML-RPC en su sitio web WordPress.
También puede comprobar que XML-RPC está desactivado simplemente visitando la URL http://example.com/xmlrpc.php en su navegador.
Asegúrese de sustituir “ejemplo.com” por el nombre de dominio de su sitio web.
Si XML-RPC está desactivado, debería ver el mensaje de error: ‘Prohibido: No tiene permiso para acceder a este recurso’.
Esperamos que este artículo te haya ayudado a aprender cómo desactivar fácilmente XML-RPC en WordPress. Puede que también quieras ver nuestra guía sobre cómo añadir JavaScript fácilmente en WordPress y las mejores herramientas de desarrollo para WordPress.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Jiří Vaněk
Thank you for the snippet. In the end, I disabled XML-RPC using WPCode because it seemed like the easiest way, and I can also easily revert XML-RPC back. Great!
Pete Mason
in htaccess, the line:
allow from 123.123.123.123
Looks like it wants to be edited with my IP address. But this is not stated anywhere —?
Christine
Is there a difference between disabling and blocking?
WPBeginner Support
Blocking would attempt to limit access to the feature while disabling would turn it off completely. If you disable it you wouldn’t need to worry about someone accessing it through a different method.
Administrador
Rashmi K
The recomnended plugin Disable XML-RPC has not been updated since last 2 years. It says the plugin has not been tested with the last 3 releases of wordpress.
WPBeginner Support
For our stance on the not tested warning, you would want to take a look at our article below:
https://www.wpbeginner.com/opinion/should-you-install-plugins-not-tested-with-your-wordpress-version/
Administrador
Nikhil
Hi,
Will disabling the xmlrpc.php access also disable the access to wordpress apis used for android/ios app development?
WPBeginner Support
That would depend on the API being used by the apps themselves.
Administrador
Vyom
Found the solution:
Adding following information in nginx config:
# nginx block xmlrpc.php requests
location /xmlrpc.php {
deny all;
}
Vyom
I use nginx instead of Apache. Can I still use .htaccess on my site?
And do I need to store this file in public_html directory, or one level above it?
WPBeginner Support
If you’re using nginx then you would not be able to use htaccess
Administrador
Vyom
Thanks for the reply. So is there an alternative for nginx?
WPBeginner Support
You would add the site-specific plugin or the plugin from earlier in the article.
Chinecherem Somto
hi, is it on the .htaccess file on the website root that i will paste the code?
WPBeginner Support
Yes, the .htaccess in your site’s root folder is where you would add the .htaccess code
Administrador
Mojtaba Rezaeian
Thank you author.
WPBeginner Support
You are welcome Mojtaba
Administrador
Bapi
How to use multiple ip or a ip range like 123.123.123.1, 2, 3, …… 100,101
malcolm
why would we allow 123.123.123.123 ?
If we aren’t using the service at all, why not let “deny all” be absolute?
Edward
If i’m reading the code correctly;
order deny,allow – puts deny before allow, since deny is ‘all’ then allow isn’t processed
deny from all – does what it says
allow from 123.123.123.123 – is a place holder
I gather that if you have a fixed IP address you could change order to “allow,deny” and replace 123.123.123.123 with your IP address. That would allow your IP then deny all others.
David Hoy
Thanks WP-Beginner, I’m trying to be baddest WP boy in my neighbourhood and this is exactly why I keep coming back to you guys, each question I have you say; here is the easy way, and here is the RIGHT way
Me an my .htaccess are going to have a little chat about htpasswrd and this here XMLRPC thingy my clients will never need.
You all just made my corner of the net a little bit safer, as MailChimp would say: High Fives!
WPBeginner Support
Hey David,
Thanks for the kind words. We are glad you find WPBeginner helpful
Administrador
Cezar
Ok, i will use this code but i want IFTTT to have work on my website what i need to add?
# Block WordPress xmlrpc.php requests
order deny,allow
deny from all
allow from 123.123.123.123
PhilB
Hi,
I have followed the instructions to block the xmlrpc.php file using .htaccess but im not sure if it is working.
Im using wordfence security and in the live traffic view i can see the requests for the xmlrpc.php file have stopped, but if i check my access logs
tail -f /apache2/logs/access_log
I can still see the requests coming in, but the code at the end has changed from 500 to 403. Im concerned im getting a false report from my WordFence plugin and that im still being flooded with spam. Can anyone advise?
Thanks,
PhilB
David Hoy
Oh yeah! Thats working perfectly, your XMLRPC is FORBIDDEN!
HTTP Status Code 403: The server understood the request but refuses to authorize it.
Raymundo
I got a weird problem…
I’m using my wordpress blogs with IFTTT and all worked fine, until I integrated it with MaxCDN; IFTTT immediately stopped working. I did some research and the problem might be related to XML-RPC that was de-activated.
When I check my dashbord in “Settings” > “Writing” , I don’t see anything like XML-RPC, Remote Publishing, etc. I’ve checked database in options, also xml-rpc not available / missing.
I need to activate XML-RPC to keep my IFTTT working.
How do I re-activate XML-RPC; all I need is a script that I can add in .htaccess or functions.php to activate XML-RPC.
And why am I missing the XML-RPC funtionality in my dashboard.
Thank You!
Muhammad Ammar Ashfaq
I was searching for how to add this file xmlprc.php to my wordpress i am using 4.5.3 version and i came to this page. I need to add this php file because when i enable jetpack i got error of site_inaccessible. Please tell me hot to resolve this error my site is
WPBeginner Support
Connect to your WordPress site using FTP client or File Manager in cPanel. In your website’s root directory look for xmlrpc.php file. If it is there, then try step 2. If it isn’t then download a fresh copy of WordPress. Unzip and extract it and upload xmlrpc.php file back to your site’s root directory.
Step 2: Check your WordPress theme’s functions file for the code that disables XML-RPC.
Step 3: Check your .htaccess and wp-config files.
Administrador
omonaija
Please,what can i do to enable xmlrpc on my site?because i can’t login using wordpess mobile app on my smartphone..
WPBeginner Support
If you are using a security plugin on your WordPress site, then check its settings.
Administrador
Mook
Booyah! This WP filter fixed the script kiddie attack. I still firewalled the person, but I don’t have to watch the logs like a hawk to add more IPs to the firewall. THANK YOU.
WPBeginner Support
That’s why we use Sucuri.
Administrador
Alex
Is that because Sucuri acts like the Disable XMLRPC plugin?
If so I can remove my Disable XMLRPC plugin,
Thanks
Alex
WPBeginner Support
Sucuri acts like a firewall between your site and users. It blocks any suspicious activity before it could reach your website.
Chad
I’m totally onboard for disabling xmlrpc.php server wide in my /etc/httpd/conf/includes/pre_main_global.conf file. But I am left with this questions…is there a way to determine that a particular plugin “NEEDS” xmlrpc.php in order to work? I have concerns with blocking access to it and then having an issue 2 months down the road and not know that the issue is with the fact that I blocked xmlrpc.php previously.
Are there any common signs to look for in a log file or such which would point to a xmlrpc.php block as the cause?
Soumitra
Hi, I just installed the plugin , Disable XML-RPC
Lets see!
Phranq
Hey am using WordPress app to post with my android smartphone. Now I can’t login and my login credentials are correct. The response I got was ” we can’t log you in couldn’t connect to the WordPress site”.Could you help me fix this WordPress app login error.
WPBeginner Support
If you had disabled XML RPC then you may not be able to login using WordPress mobile app. Look in your theme’s functions.php file for this code
1-click Use in WordPress
If it is there, then you need to remove it. You can also try deactivating plugins and turning them on one by one until you find the plugin that is stopping you from login using WordPress mobile app.
Administrador
Josiah
It’s worth noting, that “allow from 123.123.123.123” is optional, and if used should be updated to include your IP, or the IP of the device that needs access to xmlrpc.php (it would be good to cite examples in this article).
Natalie
I am using GoodbyeCaptcha plugin to turn off the XML-RPC and works with no problem while Jetpack is activated.
Hope it helps
ATI
Sorry, I’ve tried this method many times. It didn’t work for me – in fact it brought the front end down (blocking visitors read access to the web page) after adding these codes to the .htaccess file.
Gretchen Louise
Does disabling it this way prevent this issue? http://theaffluentblogger.com/operating-a-website/wordpress-xmlrpc-php-vulnerability-affects-shared-hosting-sites/ I have a friend whose site is continually crashing because of her xmlrpc file being attacked.
Editorial Staff
Yes it will prevent the attack to an extent.
Administrador
Christopher Ross
Keith, there’s a trend in WordPress to move non-theme related functions out of the functions.php file and into a “site specific plugin”, basically a plugin that you only activate on one unique website and it stores the non-theme related functions for that site.
You can accomplish the same thing by placing the code in your functions.php file.
Keith Davis
Thanks Chris
Looks like you guys have already covered it.
https://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/
BTW – what’s happened to your comments system?
Was Livefyre then something related to twitter and facebook and now ?
Keith Davis
Hi Guys
Sorry to be a bit thick but could you expand on… “All you have to do is paste the following code in a site-specific plugin:”
Which plugins are site specific?