qileilove

          blog已經(jīng)轉(zhuǎn)移至github,大家請(qǐng)?jiān)L問(wèn) http://qaseven.github.io/

          Appscan安全漏洞修復(fù)

           1.會(huì)話標(biāo)識(shí)未更新:登錄頁(yè)面加入以下代碼
            request.getSession(true).invalidate();//清空session
            Cookie cookie = request.getCookies()[0];//獲取cookie
            cookie.setMaxAge(0);//讓cookie過(guò)期
            request.getSession(true).invalidate();//清空session
            Cookie cookie = request.getCookies()[0];//獲取cookie
            cookie.setMaxAge(0);//讓cookie過(guò)期
            不是很明白session的機(jī)制,高手路過(guò)可以指教一下。
            2.跨站點(diǎn)請(qǐng)求偽造:
            在出錯(cuò)的url加參數(shù)sessionid。
            response.getWriter().write( "<script>parent.location.href='dbase/admin/loginJsp.action?sessionId="+sessionId+"'</script>");
            response.getWriter().write( "<script>parent.location.href='dbase/admin/loginJsp.action?sessionId="+sessionId+"'</script>");
            如果帶參數(shù)報(bào)ssl錯(cuò)誤,使用下面的post方式傳值:
          response.getWriter().write(
          "<script language=\"javascript\"> " +
          "document.write(\"<form action=dbase/admin/loginJsp.action method=post name=formx1 style='display:none'>\");" +
          "document.write(\"<input type=hidden name=name value='"+sessionId+"'\");" +
          "document.write(\"</form>\");" +
          "document.formx1.submit();" +
          "</script>"
          );
          response.getWriter().write(
          "<script language=\"javascript\"> " +
          "document.write(\"<form action=dbase/admin/loginJsp.action
          method=post name=formx1 style='display:none'>\");" +
          "document.write(\"<input type=hidden name=name value='"+sessionId+"'\");" +
          "document.write(\"</form>\");" +
          "document.formx1.submit();" +
          "</script>"
          );
            3.啟用不安全HTTP方法
            修改web工程中或者服務(wù)器web.xml,增加安全配置信息,禁用不必要HTTP方法
          <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工程中或者服務(wù)器web.xml,增加安全配置信息,禁用不必要HTTP方法
          <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.已解密登錄請(qǐng)求
            配置SSL,具體見(jiàn)http://serisboy.iteye.com/admin/blogs/1320231
            在web.xml加入如下配置。
          <security-constraint>
          <web-resource-collection >
          <web-resource-name >SSL</web-resource-name>
          <url-pattern>/*</url-pattern>
          </web-resource-collection>
          <user-data-constraint>
          <transport-guarantee>CONFIDENTIAL</transportguarantee>
          </user-data-constraint>
          </security-constraint>
          <security-constraint>
          <web-resource-collection >
          <web-resource-name >SSL</web-resource-name>
          <url-pattern>/*</url-pattern>
          </web-resource-collection>
          <user-data-constraint>
          <transport-guarantee>CONFIDENTIAL</transportguarantee>
          </user-data-constraint>
          </security-constraint>
            5.高速緩存的ssl頁(yè)面
            頁(yè)面
            <meta http-equiv="Pragma" contect="no-cache">
            頁(yè)面
            <meta http-equiv="Pragma" contect="no-cache">
            response.setHeader("Pragma", "No-cache");
            response.setHeader("Pragma", "No-cache");
            6.目錄列表
            配置文件目標(biāo)拒絕訪問(wèn)。
            在conf/web.xml下:
          <servlet>
          <servlet-name> default </servlet-name>
          <servlet-class> org.apache.catalina.servlets.DefaultServlet </servlet-class>
          <init-param>
          <param-name> debug </param-name>
          <param-value> 0 </param-value>
          </init-param>
          <init-param>
          <param-name> listings </param-name>
          <param-value> false </param-value>
          </init-param>
          <load-on-startup> 1 </load-on-startup>
          </servlet>
          <servlet>
          <servlet-name> default </servlet-name>
          <servlet-class> org.apache.catalina.servlets.DefaultServlet </servlet-class>
          <init-param>
          <param-name> debug </param-name>
          <param-value> 0 </param-value>
          </init-param>
          <init-param>
          <param-name> listings </param-name>
          <param-value> false </param-value>
          </init-param>
          <load-on-startup> 1 </load-on-startup>
          </servlet>
            把listings對(duì)應(yīng)的value設(shè)置為fasle.
            或者把上面的這個(gè)servlet加到你的虛擬路徑下的web-inf/web.xml中,把servlet-name改為其它的,再加一下servlet-mapping
          <servlet>
          <servlet-name> default1 </servlet-name>
          <servlet-class> org.apache.catalina.servlets.DefaultServlet </servlet-class>
          <init-param>
          <param-name> debug </param-name>
          <param-value> 0 </param-value>
          </init-param>
          <init-param>
          <param-name> listings </param-name>
          <param-value> false </param-value>
          </init-param>
          <load-on-startup> 1 </load-on-startup>
          </servlet>
          <servlet-mapping>
          <servlet-name> default1 </servlet-name>
          <url-pattern> / </url-pattern>
          <servlet-mapping>
          <servlet>
          <servlet-name> default1 </servlet-name>
          <servlet-class> org.apache.catalina.servlets.DefaultServlet </servlet-class>
          <init-param>
          <param-name> debug </param-name>
          <param-value> 0 </param-value>
          </init-param>
          <init-param>
          <param-name> listings </param-name>
          <param-value> false </param-value>
          </init-param>
          <load-on-startup> 1 </load-on-startup>
          </servlet>
          <servlet-mapping>
          <servlet-name> default1 </servlet-name>
          <url-pattern> / </url-pattern>
          <servlet-mapping>

          posted on 2014-08-18 10:11 順其自然EVO 閱讀(699) 評(píng)論(0)  編輯  收藏 所屬分類: 測(cè)試學(xué)習(xí)專欄安全性測(cè)試

          <2014年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 南靖县| 大关县| 乐至县| 山东| 高青县| 屯留县| 武汉市| 伊吾县| 本溪| 金湖县| 桐乡市| 广丰县| 西安市| 彰化市| 凤翔县| 萨嘎县| 柳江县| 昭平县| 漳州市| 松江区| 哈巴河县| 沁阳市| 辽宁省| 灵台县| 奉化市| 吐鲁番市| 观塘区| 寿宁县| 华亭县| 南通市| 文登市| 天水市| 广德县| 大荔县| 北安市| 永福县| 鹤庆县| 高台县| 宁蒗| 威宁| 中西区|