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

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

缺陷编号:wooyun-2015-0157844

漏洞标题:用友ICC系统GETSHELL漏洞(影响银行/保险/电信等行业)

相关厂商:用友软件

漏洞作者: applychen

提交时间:2015-12-03 00:31

修复时间:2015-12-17 14:48

公开时间:2015-12-17 14:48

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

危害等级:高

自评Rank:20

漏洞状态:已交由第三方合作机构(cncert国家互联网应急中心)处理

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-12-03: 细节已通知厂商并且等待厂商处理中
2015-12-04: 厂商已经确认,细节仅向厂商公开
2015-12-07: 细节向第三方安全合作伙伴开放(绿盟科技唐朝安全巡航
2016-01-28: 细节向核心白帽子及相关领域专家公开
2016-02-07: 细节向普通白帽子公开
2016-02-17: 细节向实习白帽子公开
2015-12-17: 细节向公众公开

简要描述:

给两个刀吧……

详细说明:

在struts.xml中定义了一个crud-default包:

<package name="crud-default" extends="convention-default">
<!-- 基于paramsPrepareParamsStack,
增加store interceptor保证actionMessage在redirect后不会丢失 -->
<interceptors>
<interceptor-stack name="crudStack">
<interceptor-ref name="store">
<param name="operationMode">AUTOMATIC</param>
</interceptor-ref>
<interceptor-ref name="paramsPrepareParamsStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="crudStack" />
<action name="showUpload">
<result>/common/testStrutsUpload.jsp</result>
</action>

<action name="doUpload" class="**.**.**.**mon.upload.StrutsFileUpload">
<param name="fileSavePath">/upload</param>
<result name="input">/common/testStrutsUpload.jsp</result>
<result>/common/testStrutsUploadSuccess.jsp</result>

</action>
</package>


其中的action doUpload用于上传文件,跟踪其class文件com/ufida/icc/common/upload/StrutsFileUpload.java:

public StrutsFileUpload()
{
ft = 0;
uploadPath = SystemProperties.instance().webUploadPath;//上传保存文件路径/opt/uficc/icc_data/upload/
allowTypes = SystemProperties.instance().webUploadAllowTypes;//上传检查白名单application/rtf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.wordprocessingml.template,application/msword,application/vnd.ms-excel,text/plain,application/vnd.ms-powerpoint,application/pdf,image/png,image/gif,image/jpeg,image/pjpeg,image/jpg,image/bmp,application/x-zip-compressed,.zip
}
private int checkTypes(String fileType)
{
int type = 0;
if (fileType == null) {
return 0;
}
String[] types = this.allowTypes.split(",");
for (int i = 0; i < types.length; i++) {
if (types[i].equals(fileType.toLowerCase())) {
type = 1;
break;
}
}
return type;
}

public String execute()
throws Exception
{
try
{
String targetDirectory = this.uploadPath;//保存路径
if (this.filename != null) {
this.uploadFileName = this.filename;//将filename赋值给uploadFileName
this.upload = this.file;
}
if (this.ft == 10) {//当ft=10时将上传对象传递给upload
this.upload = this.attach;
}

String extName = this.uploadFileName.substring(this.uploadFileName.lastIndexOf(".") + 1);//获取后缀
if (extName.equals(this.uploadFileName)) {//文件名中没有.时退出
this.successFlag = 3;
return "success";
}
if (checkTypes(this.uploadContentType) == 0) {//未通过checkTypes()白名单检查时则退出
if ((this.uploadContentType == null) && (this.uploadFileName != null))
{
if ((!extName.equals("jpg")) &&
(this.f != 1)) {
this.successFlag = 3;
return "success";
}
}
else
{
this.successFlag = 3;
return "success";
}
}
String targetFileName = "";
if (this.filename != null) {//filename不为空时再将filename取值回来传递给targetFileName
targetFileName = this.uploadFileName;
} else {
……
}
File target = new File(targetDirectory, targetFileName);//创建文件
FileUtils.copyFile(this.upload, target);//生成文件内容
……


通过上面代码不难看出在创建文件时文件名targetFileName直接由filename得到,而白名单检测的是通过uploadContentType,这里只要将uploadContentType设定为.zip即可通过checkTypes()检查。最终通过控制filename进行目录跳转将文件保存到web目录。
下面以联通为例进行测试:

http://**.**.**.**/web/icc/


构造一个上传页面:

1.png


直接上传jsp文件:

2.png


访问上传成功后的地址:

http://**.**.**.**/web/testabc.jsp


3.png


受影响的站点很多,列几个:

银联 https://**.**.**.**/web/testabc.jsp
人保财险 http://**.**.**.**/web/testabc.jsp
交行信用卡 http://**.**.**.**/web/abctest.jsp
猎豹 http://**.**.**.**/web/testabc.jsp
上海电信 http://**.**.**.**/web/testabc.jsp


上传包打了个码,相关HTML放到代码测试区了。

漏洞证明:

同上

修复方案:

1、过滤filename参数传递的../字符
2、过滤filename参数传递文件后缀

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


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:20

确认时间:2015-12-04 08:30

厂商回复:

非常感谢 applychen@乌云 对我们ICC在线客服产品安全的关注,经验证我们已经确认此问题的存在,目前我们已经修复了此漏洞,并通知所有受影响的用户及时更新,我们致力于为用户提供安全可靠的软件产品,并乐意接受所有关注我们产品的安全研究者的指正,努力提高软件产品安全性和产品质量。

最新状态:

暂无