网站漏洞解决-[轻微]WEB服务器启动了OPTIONS方法

2019-07-05  本文已影响0人  昵称又重复

网站漏洞解决-[轻微]WEB服务器启动了OPTIONS方法
tomcat 如何关闭不必要的请求方式
解决方法:

使所有项目都执行,修改tomcat配置文件web.xml,添加如下代码:

<security-constraint>  
   <web-resource-collection>  
       <url-pattern>/*</url-pattern>  
       <http-method>PUT</http-method>  
   <http-method>DELETE</http-method>  
   <http-method>HEAD</http-method>  
   <http-method>OPTIONS</http-method>  
   <http-method>TRACE</http-method>  
   </web-resource-collection>  
   <auth-constraint>  
   </auth-constraint>  
</security-constraint>  
<login-config>  
    <auth-method>BASIC</auth-method>  
</login-config>

若只想某个项目使用,只需要在该项目的web.xml文件添加上述代码。

屏蔽tomcat版本信息
将tomcat 停止
cd 到 tomcat 的lib 目录下
vim catalina.jar
找到这个文件ServerInfo.properties
/ServerInfo.properties 按回车进入文件
修改内容
server.info=Apache Tomcat
server.number=0.0.0.0
server.built=Aug 12 2018 08:20:08 UTC

重启tomcat

上一篇下一篇

猜你喜欢

热点阅读