模糊测试基本概念FuzzTest

1. what is FUZZ TESTing?

Fuzz Testing is an automated software testing technology, originally developed by Barton Miller of the University of Wisconsin in 1989, which is usually used to identify potential vulnerabilities in programs. The core of Fuzz Testing is to automatically or semi automatically generate random data and input it into the application, while monitoring program exceptions, such as crashes and code assertion failures, to find possible program errors, such as memory leaks.

Fuzzification refers to the automatic generation and execution of tests. The random data input in the fuzzy test is called “Fuzzy”. The types of random data include: super long strings; Random numbers such as negative numbers, floating point numbers, super large numbers, and special characters such as~! @ # $% Such characters with special meanings as input may cause error; Unicode coding, because some programs do not support unicode.

Fuzzy testers for fuzzy testing are divided into two categories:

  • One is a fuzzy tester based on mutation, which creates test cases by mutation of existing data samples
  • The other is the generation based fuzzy tester, which models the protocol or file format used by the system under test, generates inputs based on the model and creates test cases accordingly.

Fuzzy test process🌟🌟🌟

Fuzzy testing usually includes the following basic stages:

  1. Determine the test objectives: determine the nature, function, operating conditions and environment of the target program, the language for writing the program, the vulnerability information found by the software in the past, and the interface for external interaction, etc
  2. Determine input vectors, such as file data, network data, and environment variables.

  3. Generating fuzzy test data: after determining the input vector, design the method of fuzzy test and test data generation algorithm, etc

  4. Execute fuzzy test data: automatically complete the process of sending a large amount of test data to the test target, including starting the target process, sending test data, opening files, etc
  5. Monitoring exceptions: monitor whether the target program generates exceptions, and record the test data and exception related information that cause the program to generate exceptions
  6. Determine whether the discovered vulnerabilities can be used: by resending the data generating exceptions to the target program, track the processing flow related to the program before and after the exception is generated, analyze the cause of the exception, and determine whether it can be used.

  7. Output the test log.

模糊测试基本概念FuzzTest

Basic Requirements

To achieve efficient fuzzy testing, the following requirements are usually required:

  1. Reproducibility: The tester must be able to know what the test data corresponding to the state change of the target program is. If the tester does not have the ability to reproduce the test results, the whole process will lose its significance. One way to achieve reproducibility is to record the status of the test data and the target program while sending the test data
  2. Reusability: Carry out modular development, so that there is no need to re develop a fuzzy tester for a new target program
  3. Code coverage: refers to the number of all codes and process states that the fuzzy tester can make the target program reach or execute
  4. Exception monitoring: it is very important to accurately determine whether an exception occurs to the target program

Existing problems

  1. Strong blindness: even if you are familiar with the protocol format, you still haven’t solved the problem of duplicate test case paths, resulting in low efficiency
  2. Large redundancy of test cases: many test cases are generated through random strategies, resulting in repeated or similar test cases
  3. The pertinence of the associated fields is not strong: most of the time, it is just a random generation or variation of data for multiple elements, lacking the pertinence of the protocol associated fields

Method implementation

Association analysis of input data

Normally, the application will check the format of the input data object. It is an important step to improve the success rate of fuzzy testing by analyzing the structure of data objects input to the program and the dependency between its constituent elements, and constructing test cases that meet the format requirements so as to bypass the program format check.

The input data of an application usually follows certain specifications and has a fixed structure. For example, network packets usually conform to a specific network protocol specification, and file data usually conforms to a specific file format specification. Input data structure analysis is to analyze the structure of these network data packets or file formats, identify specific fields that may cause application parsing errors, and build test cases through mutation or generation. Usually focus on the following fields: fields representing length, fields representing offset, fields that may cause applications to execute different logic, variable length data, etc

The data objects that an application can handle are very complex. For example, MS Office files are composite files stored based on object embedding and linking. They can not only embed files in other formats, but also contain various types of metadata. This complexity leads to the fact that the vast majority of test data generated in the process of fuzzy testing cannot be accepted by applications. The data block association model is an effective way to solve this problem. The model takes data blocks as the basic element, and uses the correlation between data blocks as the link to generate deformity test data. Among them, the data block is the basis of the data block association model. Usually, a data object can be divided into several data blocks, and the dependency between data blocks is called data association

The division of data blocks generally follows three basic principles:

  1. Keep the correlation between data blocks as small as possible
  2. Divide data with specific meaning into a data block
  3. Divide a continuous and fixed data into the same data block

Division of data block association model:

  • Association method
  • Internal Association: refers to the association between different data blocks in the same data object.

    • Length association: one or several data blocks in a data object represent the length of another data block. It is the most common data association method in file format, network protocol and ActiveX control fuzzy testing.
  • External association: refers to the association between multiple different data blocks belonging to multiple different data objects

    • Content association: A data block of a data object represents the value of another data block of another (or the same) data object. It often appears in network protocol applications requiring user authentication.
  • Correlation strength

  • Strong Association: the number of associated data blocks is greater than or equal to the number of non associated data blocks.

  • Weak association: the number of associated data blocks is less than the number of non associated data blocks.

  • evaluation criterion
    Effective data object efficiency: the ratio of the number of malformed data objects constructed to the number of data objects that can be accepted and processed by the application.

Construction method of test case set

Common construction methods are as follows:

  1. Random method: simply generate a large number of pseudo random data to the target program.

  2. Mandatory test: The fuzzy tester starts from a valid protocol or data format sample, and continuously scrambles every byte, word, doubleword or string in the data package or file.

  3. Pre generation of test cases: study a special specification to understand all supported data formats and the acceptable value range of each data format, and then generate hard coded data packages or files used to test boundary conditions or force violations of the specification.

  4. Genetic algorithm: the test case generation process is transformed into a numerical optimization problem using genetic algorithm. The search space of the algorithm is the input domain of the software to be tested, and the optimal solution is the test case that meets the test objectives. First, use the initial data and seeds to generate data, then test and evaluate the data, and monitor the test process. If the conditions for test termination are met, output the test results, otherwise generate new data through selection, hybridization, and mutation

  5. Error injection and fuzzy heuristic
  6. Error injection: It refers to generating faults artificially and consciously according to specific fault models, and applying specific faults to the software system to be tested to accelerate the occurrence of system errors and failures.

    • Error types that can be injected generally: memory error, processor error, communication error, process error, message error, network error, program code error, etc
    • Fuzzy Heuristics: The specific potential danger values contained in the fuzzy string or fuzzy value list are called fuzzy heuristics.
    • Boundary integer value: integer value overflow, underflow, symbol overflow, etc.

    • String duplication: stack overflow, etc.

    • Field separator: Randomly include non alphanumeric characters such as spaces, tabs, etc. into the fuzzy test string.

    • Format string: it is better to select “% s”, “% n”, etc. to be included in the string.

    • Character conversion and translation: Special attention is paid to the processing of extended characters.

    • Directory traversal: appending symbols such as “../” to the URL will cause attackers to access unauthorized directories.

    • Command injection: pass unfiltered user data to API calls such as “exec()” and “system()”.

Test exception analysis

In the process of program dynamic analysis, there are several ways to obtain relevant information:

  • Get information through the normal output of the program
  • Get information through static code pegging
  • Get information through dynamic binary instrumentation
  • Get information through virtual machine
  • Get information through *the debugging interface or debugger

Fuzzy testing framework

The fuzzy testing framework is a general fuzzier, which can perform fuzzy testing on different types of targets. It abstracts some monotonous work and reduces these work to a minimum. Generally, the fuzzy testing framework includes the following parts:

  • Fuzzy test data generation module
  • Raw data generation module: it can directly read some manually constructed normal data, or automatically generate normal test data according to the structure definition
  • Deformity data generation module: make some modifications and deformation on the basis of the original data to generate the final deformity data
  • Dynamic debugging module: use the debugging interface provided by the operating system to realize the dynamic debugging function to capture the abnormal information generated by the debugged program
  • Execution monitoring module: on the basis of dynamic debugging module, it can monitor the execution status of the debugged program during the running process of the debugged program, so as to decide when to terminate the running of the debugged program
  • Automatic script module: provides more complex monitoring functions on the basis of executing the monitoring module
  • Exception filtering module: based on the dynamic debugging module, it can filter the results of exceptions in real time
  • Test result management module: in addition to the abnormal information in the test result database, the abnormal data will also be saved. Regression testing can be realized by using the test result database.

Original: https://www.cnblogs.com/ivanlee717/p/16750657.html
Author: ivanlee717
Title: 模糊测试基本概念FuzzTest

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/582549/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • phpcms如何在前台文章列表前显示所属类别名称

    最近做单位网站模版遇到的问题,欲实现的效果: 但是phpcms中自带的文章列表标签没有这个功能,数据库中文章表中也只有类别id的字段,因此不能通过简单的{$r[catname]}读…

    Linux 2023年6月13日
    093
  • Android系统的三种分屏显示模式

    Google在Android 7.0中引入了一个新特性——多窗口支持,允许用户一次在屏幕上打开两个应用。在手持设备上,两个应用可以在”分屏”模式中左右并排或…

    Linux 2023年6月7日
    0104
  • Celery异步任务

    情景: 用户发起request,并等待response返回。在本些views中,可能需要执行一段耗时的程序,那么用户就会等待很长时间,造成不好的用户体验,比如发送邮件、手机验证码等…

    Linux 2023年6月8日
    087
  • 第2次作业:支付宝案例分析

    1.介绍产品相关信息 *你选择的产品是? 支付宝 *为什么选择该产品作为分析? 在使用支付宝前,像交学费这种金额比较大的金钱来往都得去银行处理,在银行排队通常需要很多时间,尤其是办…

    Linux 2023年6月8日
    082
  • JavaScript this

    本博客所有文章仅用于学习、研究和交流目的,欢迎非商业性质转载。 博主的文章没有高度、深度和广度,只是凑字数。由于博主的水平不高,不足和错误之处在所难免,希望大家能够批评指出。 博主…

    Linux 2023年6月13日
    090
  • 带你了解我们的“彩虹运维技术栈社区”

    关于我们 彩虹象征着美好、童话、幻想,所要追求的成功,必历经挫折之后才能达到目标。我们每个人都需经历学习的枯燥、工作和生活的辛苦,不经历风雨又怎能见彩虹? TTR,全称Taste …

    Linux 2023年6月7日
    089
  • linux下通过命令连接wifi

    故事背景:我司是做新零售的,机器支持4G、wifi、网线,可能会涉及到网络的切换和连接 项目需求:用户在web端输入wifi名称和密码,客户端可以通过服务端下发的信息进行连接 技术…

    Linux 2023年6月13日
    088
  • 前端奇奇怪怪的CSS样式

    使用inline-block相当于将元素介于块级元素与行内元素之间,将换行符转换成了空格,因此各个元素之间会有空隙 各个元素没有间隙,且元素自身大小不会改变,若一行容不下,则会换行…

    Linux 2023年6月13日
    091
  • CentOS.7下安装配置FTP和SFTP服务

    一: FTP Centos7中默认已经安装了sshd服务(sftp), vsftpd需要手动安装 1、安装并启动FTP服务 1.1 安装vsftp d 使用 yum 安装 vsft…

    Linux 2023年6月6日
    0135
  • 博客园排名预测

    前言 之前写过一篇绘制博客园积分与排名趋势图的文章——《查看博客园积分与排名趋势图的工具》,使用那篇文章介绍的工具,可以通过趋势图直观的看出排名前进的走势。但是如果想看看自己积分达…

    Linux 2023年6月6日
    098
  • Django自带序列化组件;分页器

    django自带的序列化组件 代码实现序列化 models.py class User(models.Model): name = models.CharField(max_len…

    Linux 2023年6月7日
    0100
  • Redis基础教程

    redis基础教程 1、 string数据结构 a) SET server:name “fido” b) SETNX server:name1″…

    Linux 2023年5月28日
    083
  • 内部类

    内部类:将一个类的定义放在另一个类的定义内部。内部类机制可以把逻辑相关的类组织在一起,并控制位于内部的类的可视性。 内部类与组合是完全不同的概念。 内部类不仅是一种代码隐藏机制(将…

    Linux 2023年6月8日
    0101
  • Ajax 技术(四)

    目的: 熟练掌握AJAX基础和XMLHttpRequest对象及其方法。 重点掌握AJAX发送请求的具体过程,及过程中的不同状态。 要求: 实现用户注册表单中,使用AJAX技术根据…

    Linux 2023年6月13日
    0106
  • CentOS 8 上安装和配置 nginx

    1、检查yum上的nginx版本 yum info nginx 2、安装nginx yum install nginx 3、将服务设置为每次开机启动 sudo systemctl …

    Linux 2023年5月27日
    0113
  • 兼容各种浏览器的自动左右滚动兼左右点击滚动代码

    直接切入正题 红色表示要统一(所有的id) 本框架为phpcms,大家可根据自己的框架更改循环。 {pc:content action=”lists” ca…

    Linux 2023年6月13日
    092
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球