漏洞名称:点击劫持漏洞【原理扫描】tomcat

ZHUWEI
2021-12-07 13:49:38
232 赞(0) 踩(0)

解决方案(修改tomcat配置文件) 打开Tomcat配置文件(conf\web.xml)搜索httpHeaderSecurity有两处地方

漏洞名称

点击劫持漏洞【原理扫描】

风险等级:

高可利用:

CVE编号:

-

端口(服务)

-

风险描述:

Clickjacking(用户界面矫正攻击,UI矫正攻击,UI矫正)是一种恶意技术,诱使Web用户单击与用户认为单击的内容不同的内容,从而有可能泄露机密信息或控制其计算机。服务器未返回X-Frame-Options标头,这意味着该网站可能会受到点击劫持攻击的风险。 X-Frame-Options HTTP响应标头可用于指示是否应允许浏览器在框架或i-frame中呈现页面。网站可以通过确保其内容未嵌入其他网站来避免点击劫持攻击。

风险影响:

影响取决于受影响的Web应用程序。

解决方案:

配置Web服务器包含X-Frame-Options标头。有关该头的可能值的更多信息,请查阅Web参考。

参考资料:

https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options http://en.wikipedia.org/wiki/Clickjacking https://www.owasp.org/index.php/Clickjacking https://www.owasp.org/index.php/Clickjacking_Defense_Cheat_Sheet#Defending_with_Content_Security_Policy_frame-ancestors_directive http://stackoverflow.com/questions/958997/frame-buster-buster-buster-code-needed https://www.owasp.org/index.php/Clickjacking_Protection_for_Java_EE

协议类型:

-

风险举证:

http://xxxx/

请求:

GET / HTTP/1.1 Connection: Keep-Alive

漏洞ID

SF-0000-0440

解决方案(修改tomcat配置文件) 

打开Tomcat配置文件(conf\web.xml)

搜索 httpHeaderSecurity有两处地方      
<!--第一处将注释放开-->
   <filter>
        <filter-name>httpHeaderSecurity</filter-name>
            <filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
        <async-supported>true</async-supported>
<!--新增内容-->
        <init-param>
            <param-name>antiClickJackingEnabled</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>antiClickJackingOption</param-name>
            <param-value>SAMEORIGIN</param-value>
        </init-param>
    </filter>
 
<!--第二处-->
    <filter-mapping>
        <filter-name>httpHeaderSecurity</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
方法二:在项目过滤器中添加Header

@Override
public void doFilter(ServletRequest request, ServletResponse response)
throws IOException, ServletException {
HttpServletResponse resp = (HttpServletResponse) response;
resp.setHeader("x-frame-options","x-frame-options");
}
方法三:在jsp的公共页面添加java代码。(其实跟第二种一样)

<%
response.setHeader("x-frame-options","x-frame-options");
%>
以上就是试过的方法,我使用的是第一种,修改tomcat配置文件。最后测试浏览器的响应头中有添加的内容就成功了

↑TOP