### 简要描述: 登录情况下有效。 ### 详细说明: Web.xml中有个j2me的servlet [<img src="https://images.seebug.org/upload/201408/301211572327c876d226a84f571f17219b9747bf.png" alt="1.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201408/301211572327c876d226a84f571f17219b9747bf.png) 打开反编译出来的J2MEServlet.java,有以下的代码: ``` else if (ACTION_TYPE.equals("ACTION_VIEW_EMAIL_ATTACHS")) { /* 348 */ String sessionId = dataInputStream.readUTF(); /* 349 */ if (sessionId == null) { /* 350 */ return; /* */ } /* */ /* 353 */ String mbtype = dataInputStream.readUTF(); /* 354 */ String msgid = dataInputStream.readUTF(); /* 355 */ String realFileName = dataInputStream.readUTF(); /* 356 */ String fileName = dataInputStream.readUTF(); /* 357 */ dataOutputStream.writeUTF(MailAdmin.getAttachContent(sessionId, /* 358 */ mbtype, msgid, realFileName, fileName)); /* */ } /* */ } /* */ catch (Exception e) { /* 362 */ e.printStackTrace(); /* */ } /* */ /* 367 */ byte[] bs1 =...
### 简要描述: 登录情况下有效。 ### 详细说明: Web.xml中有个j2me的servlet [<img src="https://images.seebug.org/upload/201408/301211572327c876d226a84f571f17219b9747bf.png" alt="1.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201408/301211572327c876d226a84f571f17219b9747bf.png) 打开反编译出来的J2MEServlet.java,有以下的代码: ``` else if (ACTION_TYPE.equals("ACTION_VIEW_EMAIL_ATTACHS")) { /* 348 */ String sessionId = dataInputStream.readUTF(); /* 349 */ if (sessionId == null) { /* 350 */ return; /* */ } /* */ /* 353 */ String mbtype = dataInputStream.readUTF(); /* 354 */ String msgid = dataInputStream.readUTF(); /* 355 */ String realFileName = dataInputStream.readUTF(); /* 356 */ String fileName = dataInputStream.readUTF(); /* 357 */ dataOutputStream.writeUTF(MailAdmin.getAttachContent(sessionId, /* 358 */ mbtype, msgid, realFileName, fileName)); /* */ } /* */ } /* */ catch (Exception e) { /* 362 */ e.printStackTrace(); /* */ } /* */ /* 367 */ byte[] bs1 = byte_stream.toByteArray(); /* */ /* 369 */ byte[] bs = ZipUtil.compress(bs1); /* 370 */ response.setContentLength(bs.length); /* 371 */ response.getOutputStream().write(bs); /* */ /* 374 */ response.getOutputStream().flush(); /* */ } ``` 程序使用readUTF()获取数据,然后在357那里调用了MailAdmin.getAttachContent()方法,在MailAdmin.java文件中找到此方法定义: ``` /* */ public static String getAttachContent(String sessionid, String mbtype, String msgid, String realFileName, String fileName) /* */ throws UnsupportedEncodingException /* */ { /* 421 */ MailSession ms = MailMain.s_sessionadmin.getSession(sessionid); /* 422 */ UserInfo userinfo = ms.userinfo; /* 423 */ msgid = /* 424 */ Util.formatRequest(msgid, MailMain.s_os, SysConts.New_InCharSet); /* 425 */ String prefix = ms.temp_path; /* 426 */ String path = prefix + SysConts.FILE_SEPARATOR + userinfo.getUid() + /* 427 */ "@" + userinfo.domain; /* 428 */ path = path + SysConts.FILE_SEPARATOR + /* 429 */ Util.GBToISO(mbtype, ms.encoding, MailMain.s_os); /* 430 */ path = path + SysConts.FILE_SEPARATOR + msgid; /* */ /* 432 */ String realfile = path + SysConts.FILE_SEPARATOR + realFileName; /* 433 */ String strContent = ""; /* */ /* 435 */ if (fileName.endsWith(".txt")) { /* 436 */ FileInputStream fis = null; /* 437 */ byte[] bs = null; /* */ try /* */ { /* 440 */ File f = new File(realfile); /* 441 */ if (f.exists()) { /* 442 */ int iLen = (int)f.length(); /* 443 */ bs = new byte[iLen]; /* 444 */ fis = new FileInputStream(realfile); /* 445 */ fis.read(bs); /* 446 */ fis.close(); /* */ } /* */ } catch (Exception localException) { /* */ } /* */ try { /* 451 */ if (fis != null) /* 452 */ fis.close(); /* */ } /* */ catch (Exception localException1) { /* */ } /* 456 */ if (bs != null) /* 457 */ strContent = new String(bs, ServerConf.s_Default_Encoding); /* 458 */ } else if (fileName.endsWith(".pdf")) { /* 459 */ strContent = PDFUtil.getTextFromPDF(realfile); /* 460 */ } else if (fileName.endsWith(".doc")) { /* 461 */ strContent = POIUtil.getTextFromWord(realfile); /* 462 */ } else if (fileName.endsWith(".ppt")) { /* 463 */ strContent = POIUtil.getTextFromPowerPoint(realfile); /* 464 */ } else if (fileName.endsWith(".xls")) { /* 465 */ strContent = POIUtil.getTextFromExcel(realfile); /* */ } /* 467 */ strContent = Util.replace(strContent, "\r", ""); /* 468 */ return strContent; /* */ } ``` 最终的读取的文件路径realfile由以下的数据组成: ``` String realfile = path + SysConts.FILE_SEPARATOR + realFileName; ``` 控制realFileName参数的值即可浏览文件,下面用writeUTF构造POST数据(注意需要登录之后的sessionid): [<img src="https://images.seebug.org/upload/201408/30122904bec3127bef9a1246b301922ae0c4968a.png" alt="2.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201408/30122904bec3127bef9a1246b301922ae0c4968a.png) 读取回来的数据在程序中使用ZipUtil.compress()加密,大概是这个样子: [<img src="https://images.seebug.org/upload/201408/30123108f7f572db35e0bd776af8b1c2e62bad57.png" alt="3.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201408/30123108f7f572db35e0bd776af8b1c2e62bad57.png) 其还有一个解密方法ZipUtil.decompress(),调用它解密数据: [<img src="https://images.seebug.org/upload/201408/301235448f9d5c186c1ebfe136341c5b037ca406.png" alt="4.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201408/301235448f9d5c186c1ebfe136341c5b037ca406.png) turbomail默认情况下是将密码(base64encode)以文件的形式存放在服务器上,此漏洞影响还是比较大的。 ### 漏洞证明: 同上