qileilove

          blog已經轉移至github,大家請訪問 http://qaseven.github.io/

          黑盒自動化WEB安全測試的實施

            1.什么是安全測試(What)?
            安全測試就是要提供證據表明,在面對敵意和惡意輸入的時候,應用仍然能夠充分的滿足它的需求。
            a.如何提供證據? 我們通過一組失敗的安全測試用例執行結果來證明web應用不滿足安全需求。
            b.如何看待安全測試的需求?與功能測試相比,安全測試更加依賴于需求,因為它有更多可能的輸入和輸出可供篩選。
            真正的軟件安全其實際上指的是風險管理,即我們確保軟件的安全程度滿足業務需要即可。
            2. 如何開展(How to)?
            基于常見攻擊和漏洞并結合實際添加安全測試用例,就是如何將安全測試變為日常功能測試中簡單和普通的一部分的方法。
            選擇具有安全意義的特殊邊界值,以及具有安全意義的特殊等價類,并將這些融入到我們的測試規劃和測試策略過程中。
            但是若在功能測試基礎上進行安全測試,則需要增加大量測試用例。這意味著必須做兩件事來使其便于管理:
            縮小關注的重點和測試自動化。
            黑盒安全測試自動化的實施:
            使用工具:
            1.wapiti
            a.簡介:wapiti:開源安全測試漏洞檢測工具(Web application vulnerability scanner / security auditor)
          Wapiti allows you to audit the security of your web applications. It performs "black-box" scans,
          i.e. it does not study the source code of the application but will scans the web pages of the deployed web applications,
          looking for scripts and forms where it can inject data. Once it gets this list, Wapiti acts like a fuzzer,
          injecting payloads to see if a script is vulnerable. Wapiti can detect the following vulnerabilities:
          File Handling Errors (Local and remote include/require, fopen, ...)
          Database Injection (PHP/JSP/ASP SQL Injections and XPath Injections)
          XSS (Cross Site Scripting) Injection
          LDAP Injection
          Command Execution detection (eval(), system(), passtru()...)
          CRLF Injection (HTTP Response Splitting, session fixation...)
            ---------------------------------------------------------------------------------------
            功能和特點:
            文件處理錯誤(本地和遠程打開文件,readfile ... )
            數據庫注入(PHP/JSP/ASP,SQL和XPath注入)
            XSS(跨站點腳本)注入
            LDAP注入
            命令執行檢測(eval(), system(), passtru()...)
            CRLF注射入(HTTP響應,session固定... )
            ----------------
            統計漏洞數量
            成功襲擊的細節
            漏洞詳細信息
            提供解決漏洞的方法
            HTML報告格式
            XML報告格式

           b.使用:wapiti使用比較簡單,官網上給出的命令行及參數如下:
          Usage
          Wapiti-2.2.1 - A web application vulnerability scanner
          Usage: python wapiti.py http://server.com/base/url/ [options]
          Supported options are:
          -s
          --start
          To specify an url to start with
          ----------
          -x
          --exclude
          To exclude an url from the scan (for example logout scripts)
          You can also use a wildcard (*)
          Example : -x "http://server/base/?page=*&module=test"
          or -x http://server/base/admin/* to exclude a directory
          ----------
          -p
          --proxy
          To specify a proxy
          Exemple: -p http://proxy:port/
          ----------
          -c
          --cookie
          To use a cookie
          ----------
          -t
          --timeout
          To fix the timeout (in seconds)
          ----------
          -a
          --auth
          Set credentials for HTTP authentication
          Doesn't work with Python 2.4
          ----------
          -r
          --remove
          Remove a parameter from URLs
          ----------
          -n
          --nice
          Define a limit of urls to read with the same pattern
          Use this option to prevent endless loops
          Must be greater than 0
          ----------
          -m
          --module
          Set the modules and HTTP methods to use for attacks.
          Example: -m "-all,xss:get,exec:post"
          ----------
          -u
          --underline
          Use color to highlight vulnerables parameters in output
          ----------
          -v
          --verbose
          Set the verbosity level
          0: quiet (default), 1: print each url, 2: print every attack
          ----------
          -f
          --reportType
          Set the type of the report
          xml: Report in XML format
          html: Report in HTML format
          ----------
          -o
          --output
          Set the name of the report file
          If the selected report type is "html", this parameter must be a directory
          ----------
          -i
          --continue
          This parameter indicates Wapiti to continue with the scan from the specified
          file, this file should contain data from a previous scan.
          The file is optional, if it is not specified, Wapiti takes the default file
          from \"scans\" folder.
          ----------
          -k
          --attack
          This parameter indicates Wapiti to perform attacks without scanning again the
          website and following the data of this file.
          The file is optional, if it is not specified, Wapiti takes the default file
          from \"scans\" folder.
          ----------
          -h
          --help
          To print this usage message
          ------------------------------------------------------------


           注:將wapiti的執行寫入到shell腳本中,由計劃任務定時去跑該腳本。
            然后將wapiti生成的報告以郵件形式發到測試執行者指定的郵箱即可。
            shell 腳本按行讀取文本文件url(待測頁面),交由wapiti執行測試。將結果輸出到generated-report.txt文件。
            用javamail發送report郵件到指定郵箱,測試執行結束。具體如下:
          #! /bin/bash
          count=1
          cat url | while read line
          do
          echo "------$(date)------"
          wapiti $line >>generated-report.txt
          echo "execute $count complete"
          count=$(($count + 1))
          done
          exit 0
            3.如何評價(How to audit)?
            黑盒安全測試一般是在黑盒功能測試、性能測試完成之后進行。可參考微軟的SDL(Security Development Lifecycle)
            流程。感覺在日常測試工作中加入黑盒安全自動化測試最易實施,效果可能也最好。從流程、組織、技術三方面保證
            測試質量。評審或是評價安全測試的活動,沒有資格說,做過再說。

          posted on 2014-03-06 10:15 順其自然EVO 閱讀(649) 評論(0)  編輯  收藏 所屬分類: 測試學習專欄安全性測試

          <2014年3月>
          2324252627281
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345

          導航

          統計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 龙州县| 东乌珠穆沁旗| 锦州市| 威宁| 临泉县| 石嘴山市| 克拉玛依市| 松桃| 锡林郭勒盟| 太白县| 新绛县| 新建县| 巴青县| 道孚县| 留坝县| 永胜县| 永昌县| 仁寿县| 宁晋县| 嘉义县| 邮箱| 赤水市| 仁布县| 金昌市| 绿春县| 绩溪县| 和田县| 武城县| 蛟河市| 定边县| 绥芬河市| 蒲城县| 武平县| 辰溪县| 观塘区| 新巴尔虎左旗| 广南县| 兴海县| 凌海市| 绥滨县| 溧阳市|