qileilove

          blog已經(jīng)轉(zhuǎn)移至github,大家請訪問 http://qaseven.github.io/

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

            1.什么是安全測試(What)?
            安全測試就是要提供證據(jù)表明,在面對敵意和惡意輸入的時候,應(yīng)用仍然能夠充分的滿足它的需求。
            a.如何提供證據(jù)? 我們通過一組失敗的安全測試用例執(zhí)行結(jié)果來證明web應(yīng)用不滿足安全需求。
            b.如何看待安全測試的需求?與功能測試相比,安全測試更加依賴于需求,因為它有更多可能的輸入和輸出可供篩選。
            真正的軟件安全其實際上指的是風險管理,即我們確保軟件的安全程度滿足業(yè)務(wù)需要即可。
            2. 如何開展(How to)?
            基于常見攻擊和漏洞并結(jié)合實際添加安全測試用例,就是如何將安全測試變?yōu)槿粘9δ軠y試中簡單和普通的一部分的方法。
            選擇具有安全意義的特殊邊界值,以及具有安全意義的特殊等價類,并將這些融入到我們的測試規(guī)劃和測試策略過程中。
            但是若在功能測試基礎(chǔ)上進行安全測試,則需要增加大量測試用例。這意味著必須做兩件事來使其便于管理:
            縮小關(guān)注的重點和測試自動化。
            黑盒安全測試自動化的實施:
            使用工具:
            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 ... )
            數(shù)據(jù)庫注入(PHP/JSP/ASP,SQL和XPath注入)
            XSS(跨站點腳本)注入
            LDAP注入
            命令執(zhí)行檢測(eval(), system(), passtru()...)
            CRLF注射入(HTTP響應(yīng),session固定... )
            ----------------
            統(tǒng)計漏洞數(shù)量
            成功襲擊的細節(jié)
            漏洞詳細信息
            提供解決漏洞的方法
            HTML報告格式
            XML報告格式

           b.使用:wapiti使用比較簡單,官網(wǎng)上給出的命令行及參數(shù)如下:
          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的執(zhí)行寫入到shell腳本中,由計劃任務(wù)定時去跑該腳本。
            然后將wapiti生成的報告以郵件形式發(fā)到測試執(zhí)行者指定的郵箱即可。
            shell 腳本按行讀取文本文件url(待測頁面),交由wapiti執(zhí)行測試。將結(jié)果輸出到generated-report.txt文件。
            用javamail發(fā)送report郵件到指定郵箱,測試執(zhí)行結(jié)束。具體如下:
          #! /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)
            流程。感覺在日常測試工作中加入黑盒安全自動化測試最易實施,效果可能也最好。從流程、組織、技術(shù)三方面保證
            測試質(zhì)量。評審或是評價安全測試的活動,沒有資格說,做過再說。

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

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

          導(dǎo)航

          統(tǒng)計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 永平县| 长海县| 彩票| 盐城市| 无极县| 祁东县| 象山县| 渝北区| 辽阳县| 沙雅县| 阜新市| 江永县| 嵊州市| 安陆市| 湖北省| 邯郸市| 武邑县| 江达县| 鹤庆县| 宁都县| 繁峙县| 黔西| 封开县| 和林格尔县| 嵊州市| 同德县| 博白县| 文安县| 南丹县| 商洛市| 安乡县| 肃南| 建瓯市| 格尔木市| 霞浦县| 广州市| 孟连| 灵寿县| 保德县| 肇州县| 郯城县|