### 简要描述:
TurboMail邮件系统处理日志文件时未对文件路径进行判断,导致可读取服务器上的任意文件。
### 详细说明:
邮件后台管理进行“WEB日志查看”时存在任意文件读取漏洞。
漏洞代码位于TomcatLogAjax.class,其中getLog函数读取web服务器日志文件的源代码实现如下:
publicstatic void getLog(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException{
MailSession ms = WebUtil.getms(request,response);
if (ms == null) {
AjaxUtil.ajaxFail(request, response,"info.nologin", null);
return;
}
UserInfo userinfo = ms.userinfo;
if (userinfo == null) {
AjaxUtil.ajaxFail(request, response,"info.loginfail", null);
return;
}
String logPath = getLogPath();
String subType =WebUtil.getParameter(request, true, "subType");
if ((subType != null) &&("getLogList".equals(subType))) {
getLogList(request, response, logPath);
return;
}
StringsLogFile = WebUtil.getParameter(request, true, "logFile");
…..//此处省略N行
try{
FiletempFile = new File(logPath + SysConts.FILE_SEPARATOR + sLogFile); //漏洞点,直接拼接
if (!tempFile.exists()) {
AjaxUtil.ajaxFail(request, response,"info.ajax.fail", null);
return;
}
bb.clear();
fis = new RandomAccessFile(tempFile,"r");
if (bReverse) {
long lFileLen = fis.length();
fis.seek(lFileLen);
bsLine = ReadLineInput.RReadLine(fis, false,lo, bb, temp_bs);
} else {
bsLine = ReadLineInput.ReadLine(fis,false, lo, bb, temp_bs);
}
getLog函数在处理用户传递的参数logFile时未进行安全路径的检测导致可以使用../进行读取服务器上的任意文件。
### 漏洞证明:
使用邮箱管理员账号登陆邮箱管理后台,进行邮件“日志查看”,选择“web服务器日志”
[<img src="https://images.seebug.org/upload/201407/11013405be0d3a589d33a255a71b4900cd7230ea.png" alt="1.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/11013405be0d3a589d33a255a71b4900cd7230ea.png)
[<img src="https://images.seebug.org/upload/201407/11013418117545eca8edffb6870bad905290d851.png" alt="2.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/11013418117545eca8edffb6870bad905290d851.png)
http请求包如下:
[<img src="https://images.seebug.org/upload/201407/11013430192bd7906986dfad96a80cf295a22459.png" alt="3.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/11013430192bd7906986dfad96a80cf295a22459.png)
使用burpsuit修改http请求包的logFile参数为../../../../../../../../../../../../../windows/win.ini:
[<img src="https://images.seebug.org/upload/201407/110134440fddf9fee97cd071141f7938994a6cbe.png" alt="4.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/110134440fddf9fee97cd071141f7938994a6cbe.png)
可以发现已经成功读取服务器上的文件:
[<img src="https://images.seebug.org/upload/201407/11013455f979a0bca73dab929ac07cd02a74382d.png" alt="5.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/11013455f979a0bca73dab929ac07cd02a74382d.png)
测试下读取c:/boot.ini:
[<img src="https://images.seebug.org/upload/201407/11013519e10ac33d6e8641332a9935b3592e5fca.png" alt="6.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/11013519e10ac33d6e8641332a9935b3592e5fca.png)
[<img src="https://images.seebug.org/upload/201407/11013532ac27002081387b45a32cad9acf211035.png" alt="7.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/11013532ac27002081387b45a32cad9acf211035.png)
暂无评论