zoukankan      html  css  js  c++  java
  • Appscan漏洞之Authentication Bypass Using HTTP Verb Tampering

    本次针对 Appscan漏洞 Authentication Bypass Using HTTP Verb Tampering(HTTP动词篡改导致的认证旁路)进行总结,如下:

    1. Authentication Bypass Using HTTP Verb Tampering

    1.1、攻击原理

      不安全的HTTP方法PUT/DELETE/MOVE/COPY/TRACE/PROPFIND/PROPPATCH/MKCOL/LOCK/UNLOCK允许攻击者修改web服务器文件、删除web页面、甚至上传web shell获取用户的身份信息等,它们都有可能制造出严重的安全漏洞,开发人员需要对HTTP请求类型进行控制,防止服务器资源被非授权篡改。

    1.2、案例分析

      APPSCAN用无意义的HTTP动词bogus向服务端发起请求,系统正常返回,显示此系统未对http请求类型进行判断限制,存在HTTP动词篡改漏洞。

    BOGUS /fams/admin/j_security_check HTTP/1.1
    Accept-Language: en-US
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Referer: http://xxx-core-stg1.paic.com.cn/fams/
    Host: xxx-core-stg1.paic.com.cn
    User-Agent: Mozilla/4.0 (compatible; MSIE 9.0; Win32) 
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Content-Type: text/html;charset=utf-8
    Content-Length: 477
    Date: Wed, 14 Mar 2018 01:56:23 GMT

    1.3、防御建议

      1. 限制http method,如仅允许GET、POST等类型

      2. 使用J2EE标准中提供的Filter方法进行请求类型过滤

      3. 检查tomcat的web.xml,weblogic的weblogic.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>

      4. Struts中使用request.getMethod方法添加请求拦截器,如:

    if(method.equalsIgnoreCase("post")||method.equalsIgnoreCase("get")||method.equalsIgnoreCase("head")||method.equalsIgnoreCase("trace")||method.equalsIgnoreCase("connect")||method.equalsIgnoreCase("options")){}

      5. 禁用IIS的WebDAV功能,WebDAV基于 HTTP 1.1 的一个通信协议,它为 HTTP 1.1 添加了一些除GET,POST,HEAD之外的方法,使得应用程序可以直接将文件写到 Web Server 上。

      6. apache的httpd.conf文件中进行如下限制

    <Location />  
     <LimitExcept GET POST HEAD CONNECT OPTIONS> 
       Order Allow,Deny 
       Deny from all 
     </LimitExcept> 
     </Location> 
      
     7.如果是nginx服务器,在nginx.conf 文件里面加如下配置就可以:
      
        location /vat{

          if ($request_method !~ ^(GET|HEAD|POST)$ ) {
        return 403;
        }
        proxy_pass http://XXX;
       }

    1.4、实际修复方案

      1、服务器可以分为Tomcat和WebSphere(WAS)两种,本地为Tomcat,加下2的配置方式,下3的方式主要是针对WAS服务器的。

      2、在web.xml文件中加以上的 <security-constraint> 配置。

      3、 如果是请求的静态资源,把下属字段另存为文件.htaccess   放到静态资源的文件夹下面。

      <LimitExcept GET POST >

      Order deny,allow

      Deny from all

      </LimitExcept>

     

      动态资源的话,需要在java 代码里面实现。 

  • 相关阅读:
    VUE学习笔记--Vue-cli
    洛谷 P5595 【XR-4】歌唱比赛(构造)
    洛谷 P3658 [USACO17FEB]Why Did the Cow Cross the Road III P(CDQ分治)
    洛谷 P2345 [USACO04OPEN]MooFest G(二维偏序,归并排序)
    洛谷 P1228 地毯填补问题(分治)
    洛谷 P4071 [SDOI2016]排列计数(排列组合、逆元、错排问题)
    初赛选择题知识点整理 & 听课笔记
    洛谷 P6833 [Cnoi2020]雷雨(set优化dijkstra,set、pair、struct的结合)
    洛谷 P1119 灾后重建(Floyd)
    洛谷 P1346 电车(双端队列广搜)
  • 原文地址:https://www.cnblogs.com/sucretan2010/p/11693266.html
Copyright © 2011-2022 走看看