平时我们项目中基本上用的都是GET/POST请求方法,其他的方法是很少用到的,如PUT/DELETE/HEAD/OPTIONS/TRACE,不关闭这些HTTP请求方法,是常见的web漏洞之一。

二、解决办法

把他们关闭即可!!!

添加以下节点代码到web.xml配置文件当中。可以在项目WEB-INF/web.xml中添加,也可以在tomcat/conf/web.xml中添加

  1. <!-- close insecure http methods -->
  2. <security-constraint>
  3. <web-resource-collection>
  4. <web-resource-name>fortune</web-resource-name>
  5. <url-pattern>/*</url-pattern>
  6. <http-method>PUT</http-method>
  7. <http-method>DELETE</http-method>
  8. <http-method>HEAD</http-method>
  9. <http-method>OPTIONS</http-method>
  10. <http-method>TRACE</http-method>
  11. </web-resource-collection>
  12. <auth-constraint></auth-constraint>
  13. </security-constraint>

相关文章:

  • 2022-01-20
  • 2022-01-14
  • 2022-01-10
  • 2021-07-27
  • 2021-08-13
猜你喜欢
  • 2021-11-24
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
  • 2022-01-15
  • 2022-03-04
相关资源
相似解决方案