来源:自学PHP网 时间:2015-04-15 15:00 作者: 阅读:次
[导读] 登录情况下有效。Web xml中有个j2me的servlet打开反编译出来的J2MEServlet java,有以下的代码:else if (ACTION_TYPE equals(ACTION_VIEW_EMAIL_ATTACHS)) { * 348 * String session...
|
登录情况下有效。
Web.xml中有个j2me的servlet
![]() 打开反编译出来的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):
![]() 读取回来的数据在程序中使用ZipUtil.compress()加密,大概是这个样子:
![]() 其还有一个解密方法ZipUtil.decompress(),调用它解密数据:
![]() turbomail默认情况下是将密码(base64encode)以文件的形式存放在服务器上,此漏洞影响还是比较大的。
修复方案:
混淆代码过滤数据你懂的 |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com