### 简要描述: 万户ezOFFICE一处任意文件操作 ### 详细说明: 其实标题可以写“万户ezOFFICE又一处任意文件上传可getshell,无上传限制”,考虑到对厂商的影响,所以标题写的隐晦一点。 万户ezOFFICE又一处任意文件上传可getshell wooyun上面报了很多万户的文件漏洞,尤其是“北京方便面”和“瘦蛟舞”提交的较多。 今天审计的这个点,wooyun上现在还没人提交。 对应文件: \defaultroot\public\jsp\multiuploadfile.jsp 出现问题的代码如下: ``` String filePath="https://images.seebug.org/upload/"+path+"/";//上传文件存放的位置,path可自定义 if("add".equals(mode)){//上传标识 boolean tooBig=false; myUpload.initialize(pageContext); myUpload.upload(); for (int j=0;j<myUpload.getFiles().getCount();j++){ myRandom=new com.whir.common.util.Random().getRandom();//文件名是根据时间生产的一个序列,后面有说明 com.jspsmart.upload.File myFile = myUpload.getFiles().getFile(j); int size=myFile.getSize(); if(fileSize==0 || myFile.getSize()<fileSize){ if (!myFile.isMissing()) { saveName=myRandom+"."+myFile.getFileExt(); fileName=myFile.getFileName(); myFile.saveAs(filePath + saveName);//上传的文件直接保存到对应位置 } }else{ tooBig=true; } } if(tooBig){%> ``` 还有一些参数获取,这里指出两个重要参数: ``` String mode=(String)request.getParameter("mode");...
### 简要描述: 万户ezOFFICE一处任意文件操作 ### 详细说明: 其实标题可以写“万户ezOFFICE又一处任意文件上传可getshell,无上传限制”,考虑到对厂商的影响,所以标题写的隐晦一点。 万户ezOFFICE又一处任意文件上传可getshell wooyun上面报了很多万户的文件漏洞,尤其是“北京方便面”和“瘦蛟舞”提交的较多。 今天审计的这个点,wooyun上现在还没人提交。 对应文件: \defaultroot\public\jsp\multiuploadfile.jsp 出现问题的代码如下: ``` String filePath="https://images.seebug.org/upload/"+path+"/";//上传文件存放的位置,path可自定义 if("add".equals(mode)){//上传标识 boolean tooBig=false; myUpload.initialize(pageContext); myUpload.upload(); for (int j=0;j<myUpload.getFiles().getCount();j++){ myRandom=new com.whir.common.util.Random().getRandom();//文件名是根据时间生产的一个序列,后面有说明 com.jspsmart.upload.File myFile = myUpload.getFiles().getFile(j); int size=myFile.getSize(); if(fileSize==0 || myFile.getSize()<fileSize){ if (!myFile.isMissing()) { saveName=myRandom+"."+myFile.getFileExt(); fileName=myFile.getFileName(); myFile.saveAs(filePath + saveName);//上传的文件直接保存到对应位置 } }else{ tooBig=true; } } if(tooBig){%> ``` 还有一些参数获取,这里指出两个重要参数: ``` String mode=(String)request.getParameter("mode"); String path=(String)request.getParameter("path"); ``` 其中mode代表命令,path指定特定位置。 那么我们做如下构造: path=sound&mode=add 提交无需“multipart/form-data”方式提交。 其中: 参数:path=sound 指定的路径为:\defaultroot\upload\sound\ mode=add 为满足if条件,即上传。 第一次上传可能没有数据,跳转页面也可上传。(可以直接用burp提交) [<img src="https://images.seebug.org/upload/201411/05165309e1d34acef17331f09ed1721ebe24ec0b.png" alt="1105_1.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201411/05165309e1d34acef17331f09ed1721ebe24ec0b.png) 上传成功: [<img src="https://images.seebug.org/upload/201411/05165454989041ce09718bb03931cfc99b9ad400.png" alt="1105_3.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201411/05165454989041ce09718bb03931cfc99b9ad400.png) 此时可以通过查看页面源码看到改名后的文件: [<img src="https://images.seebug.org/upload/201411/051656100dc1d72922203e9f36eb2e50ac0cf801.png" alt="1105_2.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201411/051656100dc1d72922203e9f36eb2e50ac0cf801.png) 代码: ``` <SCRIPT LANGUAGE="JavaScript"> <!-- alert("附件上传成功"); //在调用页面的table列表中显示 opener.reView("<%=saveName%>"); var path="<%=path%>"; var parentTable="<%=tableName%>"; var fileNames="<%=fileNames%>"; var saveNames="<%=saveNames%>"; var obj=eval("opener.window.document.all."+parentTable); ``` 其中saveName为改名后的文件。 然后访问shell:http://oa.yundagroup.com:7001/defaultroothttps://images.seebug.org/upload/sound/2014110516441408716191497.jsp [<img src="https://images.seebug.org/upload/201411/051659001d4f02bde6540d4cb477b7e71b69a86c.png" alt="1105_4.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201411/051659001d4f02bde6540d4cb477b7e71b69a86c.png) 申明:所有测试均无损害。 ### 漏洞证明: 别人未提交过 [<img src="https://images.seebug.org/upload/201411/05170122f4cf6050475b9a6b04b11cbbb9082d5a.png" alt="1105_5.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201411/05170122f4cf6050475b9a6b04b11cbbb9082d5a.png) 受影响的系统较多 上次提交的多漏洞中都中招: [WooYun: 万户OA未修补漏洞致多个政府&集团OA中招](http://www.wooyun.org/bugs/wooyun-2014-081513) 测试了其中几个, shell地址: http://222.178.221.54:7001/defaultroothttps://images.seebug.org/upload/sound/2014110514261813627153789.jsp http://oa.hongdou.com:7001/defaultroothttps://images.seebug.org/upload/sound/2014110514400983604036844.jsp http://oa.yundagroup.com:7001/defaultroothttps://images.seebug.org/upload/sound/2014110514434370947164885.jsp [<img src="https://images.seebug.org/upload/201411/05170417f322c83132f1f6ed05884b7ac068eef3.png" alt="1105_6.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201411/05170417f322c83132f1f6ed05884b7ac068eef3.png)