XML-RPC: come proteggersi

Piccola premessa, che è presente anche negli articoli letti e che includerò in questo post. Proteggere queste API significa non volerle utilizzare per i vari pingback; o perlomeno si è sicuri che se ne può fare a meno.

In alternativa si possono sempre abilitare anche filtrando su base IP, se necessario.

Gli articoli che andrò a includere in questo post sono due.

Nel primo si parla in maniera più estesa dei pericoli a cui andiamo incontro nel momento in cui lasciamo aperta questa opzione, fra cui:

  • Intel gathering — attacker may probe for specific ports in the target’s internal network
  • Port scanning — attacker may port-scan hosts in the internal network
  • DoS attacks — attacker may pingback via large number of sites for DoS attack
  • Router hacking — attacker may reconfigure an internal router on the network

e delle relativa possibilità di chiusura.

Il link è il seguente:

Protection for WordPress Pingback Vulnerability

Nel secondo invece si parla di un modulo di Metasploit utile per un port scanning all’interno della rete ospitante il blog wordpress preso di mira.

Il link è il seguente:

WordPress Pingback Portscanner – Metasploit Module

Lato mio per ora la soluzione adottata è stata quella di inserire una redirection nel file .htaccess, come riportato negli esempi di perishablepress.com, ovvero:

# protect xmlrpc
<IfModule mod_alias.c>
Redirect 301 /xmlrpc.php http://www.gabcicala.it
</IfModule>

Testando via shell ovviamente vediamo il 301.

ciccipolenti@ciccio:/tmp$ curl –data @hello.txt http://www.gabcicala.it/xmlrpc.php
<!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”>
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href=”http://www.gabcicala.it”>here</a>.</p>
</body></html>
ciccipolenti@ciccio:/tmp$

Ho testato anche il plugin consigliato da Zeknox ma con scarso successo, per cui ho optato per l’aggiunta nel file .htaccess.

Integrazione al 10 Dicembre 2014.

Ho testato un’altra modalità di blocco delle richieste utilizzando un Forbidden

<IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} /xmlrpc.php [NC]
    RewriteRule .* – [F,L]
</IfModule>

In questo caso vengono fermate le POST.

Per testare la regola vi sono due strade.

  1. Utilizzando il sito web www.hurl.it
  2. Oppure utilizzando una wget via shell wget –post-data=”cicciopuliccio” http://www.gabcicala.it/xmlrpc.php

About the Author: glycerin