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 阅读(633) 评论(0)  编辑  收藏 所属分类: 测试学习专栏安全性测试


只有注册用户登录后才能发表评论。


网站导航:
 
<2014年3月>
2324252627281
2345678
9101112131415
16171819202122
23242526272829
303112345

导航

统计

常用链接

留言簿(55)

随笔分类

随笔档案

文章分类

文章档案

搜索

最新评论

阅读排行榜

评论排行榜