Program fuzz testing method based on simulation execution

Through the program fuzz testing method based on simulation execution, genetic algorithms and automated tools are used to generate test data, which solves the problem of low test data coverage in the existing technology and achieves more efficient software vulnerability detection and security optimization.

CN118656303AInactive Publication Date: 2024-09-17ZHONGKE DIGITAL MEASUREMENT GUYUAN TECHNOLOGY (ANHUI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410854041.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-09-17
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In fuzz testing, mutation-based test data generation methods are difficult to achieve high code coverage, resulting in poor vulnerability mining results, especially when the program under test has no source code and the input data format is unknown.

Method used

Adopt a program fuzz testing method based on simulation execution, use genetic algorithms to guide test data generation, and combine automated testing tools, Fuzz tool chains, cloud computing and simulation execution programs to optimize the test data generation and analysis process and improve code coverage and testing efficiency. .

Benefits of technology

It improves the stability and robustness of the software under abnormal input, reduces testing costs and time, can detect potential software problems more comprehensively, and improves the safety and quality of the software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656303A
    Figure CN118656303A
Patent Text Reader

Abstract

The invention relates to the technical field of program fuzz testing of simulation execution, in particular to a program fuzz testing method based on simulation execution, which comprises a data processing program, the data processing program is in communication connection with a data testing program, and the data testing program is in communication connection with a monitoring program. The data test program is in communication connection with a fuzzy test program, the fuzzy test program is in communication connection with the monitoring program, the number of times of repeatedly executing the program can be reduced by simulating the execution program, so that the test cost is reduced, and the operation efficiency is improved, which means that under the same resource condition, the test efficiency is improved. According to the method, a tester can cover more test scenes, potential problems of the software can be detected more comprehensively, the abnormal behaviors and the potential problems in the software can be quickly found by automatically generating the test cases and simulating execution, the tester can timely position and repair software defects, and the test efficiency is improved. Therefore, the quality and reliability of software are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of program fuzzy testing based on simulated execution, and in particular to a program fuzzy testing method based on simulated execution; Background Art

[0002] The basic principle of fuzz testing is to generate a large amount of irregular test data and provide them to the program under test for testing, monitoring whether the program under test has any anomalies in the process of processing these test data so as to discover possible vulnerabilities.

[0003] When fuzz testing a program, the higher the code coverage of the test data generated by the fuzz testing system, the greater the possibility of discovering vulnerabilities. Therefore, a key point of fuzz testing is to generate test data with high code coverage. At present, the test data generation methods are mainly divided into specification-based generation methods and mutation-based generation methods. When the data format specification is known, the specification-based test data generation method can generate test data that meets the format constraints and achieves a very high code coverage. However, in many cases, the program under test in fuzz testing is a binary program without source code, and the format of the input data is unknown. The error-based test data generation method is the main method in this case and is also a hot topic of research. The error-based method generates new test data by directly modifying the existing test data. However, if random mutation is used, the generated test data will largely test repeated program execution paths and cannot achieve a high coverage rate. The actual vulnerability mining effect is not particularly good. To this end, we propose a program fuzz testing method based on simulated execution to solve the above problems. This method guides the test data generation process through a genetic algorithm to improve the test data coverage rate. Summary of the invention

[0004] The purpose of the present invention is to provide a program fuzz testing method based on simulation execution to solve the problems raised in the above background technology;

[0005] The technical solution of the present invention is: a program fuzz testing method based on simulation execution, including a data processing program, the data processing program is communicatively connected to a data testing program, the data testing program is communicatively connected to a monitoring program, the data testing program is communicatively connected to a fuzz testing program, the fuzz testing program is communicatively connected to the monitoring program, the fuzz testing program is communicatively connected to a test result analysis program, the test result analysis program is communicatively connected to a simulation execution program, the simulation execution program is communicatively connected to an analysis simulation result program, and the analysis simulation result program is communicatively connected to an output test report.

[0006] Preferably, an automated testing tool is provided in the data testing program.

[0007] Preferably, an initialization management tool is provided in the monitoring program.

[0008] Preferably, the data testing method in the fuzz testing program adopts the Fuzz tool chain.

[0009] Preferably, the data calculation in the test result analysis program adopts cloud computing.

[0010] Preferably, the simulation execution program executes the user's DSP program on a computer.

[0011] Preferably, the program fuzz testing method based on simulation execution includes the following steps:

[0012] Step S1: Clarify the test objectives and determine the key functions and security vulnerabilities that need to be tested in the data processing program;

[0013] Step S2: Set up a suitable test environment to ensure that the conditions of simulation execution are close to the actual situation;

[0014] Step S3: obtaining or generating a set of initial test data through a data processing program, and the test data will serve as the starting point of the fuzz test;

[0015] Step S4: input the current test data into the data test program and execute the fuzzy test program;

[0016] Step S5: monitor the execution process of the program and record the test results, including whether the program crashes, whether abnormal output is generated, etc.;

[0017] Step S6: input the data into the test result analysis program to determine whether it meets the test end condition, which may include finding a certain number of errors, reaching a predetermined test time, etc.;

[0018] Step S7: If the test result does not meet the end condition, the current test case is modified to generate a new test case;

[0019] Step S8: The method for updating the test case changes certain bytes or files of the input data or generates new test data based on the known protocol or interface specification based on the generation method;

[0020] Step S9: input new test data into the data test program, and obtain simulation results by using the simulation execution program;

[0021] Step S10: The simulation execution program can record information such as code coverage by inserting stubs into the program source code to guide the generation of test data;

[0022] Step S11: restart the simulation result analysis program to determine whether it meets the preset constraint conditions, which include code coverage reaching a certain threshold and discovering a new execution path;

[0023] Step S12: If the simulation result satisfies the constraint condition, the data test program is continued to be fuzzy tested using the new test data;

[0024] Step S13: repeating steps S3 to S8, using a genetic algorithm in the data processing program and using a binary method test in the data testing program, until the test end condition is met or a predetermined test time is reached;

[0025] Step S14: When the test end conditions are met, a detailed test report is output, including information such as errors found, test coverage, and test time.

[0026] The present invention provides a program fuzz testing method based on simulation execution by improvement, which has the following improvements and advantages compared with the prior art:

[0027] First, in the present invention, fuzz testing can simulate various abnormal inputs, so as to test the stability and robustness of the software under abnormal conditions. Through this method, software developers can have an in-depth understanding of the performance of the software when facing unpredictable inputs, and then optimize the processing mechanism and return mechanism of the software to improve the robustness of the software. Fuzz testing, as a security testing method, can help the development team discover potential security vulnerabilities. By simulating the execution of the program, the tester can simulate the attack behavior of hackers to detect whether the software has exploitable vulnerabilities. This helps the development team to repair security vulnerabilities in time before the software is released, thereby improving the security of the system.

[0028] Second: The present invention can reduce the number of repeated executions of the program by simulating the execution of the program, thereby reducing the testing cost and improving the operating efficiency. This means that under the same resource conditions, testers can cover more test scenarios and thus more comprehensively detect potential problems in the software. By automatically generating test cases and simulating their execution, the method can quickly discover abnormal behaviors and potential problems in the software, which helps testers to locate and fix software defects in a timely manner, thereby improving the quality and reliability of the software. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The present invention will be further explained below in conjunction with the accompanying drawings and embodiments:

[0030] Figure 1 It is a schematic diagram of the program flow of the present invention;

[0031] Figure 2 It is a schematic diagram of the genetic algorithm principle of the present invention;

[0032] Figure 3 It is a schematic diagram of several basic blocks in the simple program of the present invention. DETAILED DESCRIPTION

[0033] The present invention is described in detail below, and the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention;

[0034] The present invention provides a program fuzz testing method based on simulation execution by improvement. The technical solution of the present invention is:

[0035] like Figure 1 - Figure 3 As shown, a program fuzz testing method based on simulation execution includes a data processing program, the data processing program is communicatively connected to a data testing program, the data testing program is communicatively connected to a monitoring program, the data testing program is communicatively connected to a fuzz testing program, the fuzz testing program is communicatively connected to the monitoring program, the fuzz testing program is communicatively connected to a test result analysis program, the test result analysis program is communicatively connected to a simulation execution program, the simulation execution program is communicatively connected to an analysis simulation result program, and the analysis simulation result program is communicatively connected to an output test report.

[0036] Furthermore, an automated testing tool is set up in the data testing program. By setting up the automated testing tool, a large number of heavy testing tasks can be executed in a short period of time, and potential defects and problems can be quickly discovered. Compared with traditional manual testing, the automated testing tool writes tests in a scripted manner and can run the same test case multiple times at a time, significantly reducing the testing time. The automated testing tool can run multiple test tasks in parallel, making full use of the computer's computing power and resources to improve the efficiency and effectiveness of the test. The automated testing tool uses the same test conditions and steps to perform tests, maintaining consistency and repeatability. Automated testing can reduce the impact of human factors on test results and improve the accuracy of test results. Although in the initial stage, automated testing tools require a certain amount of investment and learning costs, in the long run, they can significantly reduce the labor cost of testing. Automated testing can run unattended, reducing the workload of testers and saving time and energy by reusing test scripts.

[0037] Furthermore, an initialization management tool is provided in the monitoring program. By setting the initialization management tool, it can be ensured that after the monitoring system is installed or the monitoring equipment is replaced, the basic settings and configurations of the monitoring equipment can be performed to ensure the normal operation of the monitoring equipment. This process includes network settings, hardware settings, storage settings, etc., which are the basis for the reliable operation of the monitoring system. Through the setting of the initialization management tool, it can be ensured that the various parameters of the monitoring system are correctly configured, thereby reducing the possibility of system errors and improving the reliability and stability of the system. The initialization management tool also includes user authority settings. Through this function, the authority scope of each user can be clarified, including viewing permissions, operating permissions, etc., thereby ensuring the security of the system and the confidentiality of data. Through correct initialization settings, the stability and reliability of the system in the subsequent operation process can be ensured, thereby reducing the workload required for subsequent maintenance. Some initialization management tools support flexible expansion and upgrade functions, and can be adjusted and optimized accordingly according to user needs and system changes to meet the ever-changing needs of users.

[0038] Furthermore, the data testing method in the fuzz testing program adopts the Fuzz tool chain. By setting up the Fuzz test, it can be automatically executed. Compared with manual testing, the testing efficiency is greatly improved, and the testing time and cost are significantly saved. Fuzz testing tests the stability and security of the application or system by generating a large amount of random, invalid or abnormal data, thereby greatly enhancing the coverage of the test and helping to discover more potential problems. Since Fuzz testing can be integrated with the early stages of the software development life cycle, it can promptly discover and report potential problems, thereby accelerating the development cycle and reducing the time and cost of later repairs. By performing Fuzz testing in the development stage, developers can identify and fix code that may cause program crashes or abnormal behavior, thereby reducing long-term software maintenance pressure and costs. By using Fuzz testing in software development to improve the security and robustness of the software, users' trust in software products can be increased. Fuzz testing provides a basis for building user trust by identifying and fixing potential security vulnerabilities and defects. Fuzz testing not only helps to discover security vulnerabilities, but also helps developers identify and fix code that causes program crashes or abnormal behavior, thereby improving the stability of the software.

[0039] Furthermore, the data calculation in the test result analysis program adopts cloud computing. By adopting cloud computing with its powerful computing resources, it can quickly process a large number of data computing tasks and significantly improve the efficiency of test result analysis. Compared with traditional computing methods, cloud computing can complete complex calculations and analysis faster, helping testers to obtain results faster. Cloud computing has a high degree of scalability and can dynamically expand or reduce computing resources according to the needs of test tasks. This flexibility enables the test result analysis program to cope with test tasks of different scales and complexities and ensure the effective use of computing resources. Through cloud computing, the test team can use computing resources on demand, avoiding the cost of purchasing and maintaining expensive hardware equipment. At the same time, cloud computing usually adopts a pay-as-you-go model, making the test cost more transparent and controllable. Cloud computing platforms usually have a high degree of availability and can maintain service continuity and stability in the event of resource failure or network interruption. This ensures that the test result analysis program can run stably at critical moments and will not affect the test progress due to hardware failure or network problems. The cloud computing platform provides automated management functions, which can realize intelligent allocation and operation management of computing resources, which reduces the management and maintenance costs of the test team and enables them to focus more on the analysis and optimization of test results.

[0040] Furthermore, the simulation execution program executes the user's DSP program on the computer. By setting up the DSP program, it is possible to avoid directly purchasing expensive DSP hardware, thereby reducing the cost of the development and testing stages. Through simulation, developers can quickly verify the correctness and performance of the DSP algorithm and reduce the time spent on hardware debugging and testing. Simulating the DSP program on the computer allows developers to easily modify and test different algorithms and parameter configurations without worrying about hardware limitations. In the simulation environment, even if the DSP program has errors or instability, it will not cause damage to the actual hardware, thereby improving the security of the development process. With the help of debugging tools on the computer, developers can more easily track and analyze the execution process of the DSP program, quickly locate and fix problems. The simulation environment usually supports saving and sharing DSP programs and data in the form of files, which facilitates collaboration and communication between team members. Simulating the DSP program on the computer can simulate various complex input signals and scenarios, thereby comprehensively evaluating the performance and robustness of the DSP algorithm. With the development of technology and the optimization of algorithms, the simulation environment can be easily upgraded and expanded to adapt to new DSP needs and challenges. Since the simulation environment is usually based on software implementation, it can support remote development and testing, allowing team members to collaborate in different locations.

[0041] Furthermore, the program fuzz testing method based on simulation execution includes the following steps:

[0042] Step S1: Clarify the test objectives and determine the key functions and security vulnerabilities that need to be tested in the data processing program;

[0043] Step S2: Set up a suitable test environment to ensure that the conditions of simulation execution are close to the actual situation;

[0044] Step S3: obtaining or generating a set of initial test data through a data processing program, and the test data will serve as the starting point of the fuzz test;

[0045] Step S4: input the current test data into the data test program and execute the fuzzy test program;

[0046] Step S5: monitor the execution process of the program and record the test results, including whether the program crashes, whether abnormal output is generated, etc.;

[0047] Monitor whether the current test data will cause the tested program to crash and record the program execution path. When a program crashes, it will send an error signal. Therefore, by receiving the signal sent by the program, you can monitor whether the program crashes. A program can be divided into many basic blocks. The process of program execution is to repeatedly execute a basic block and jump to another basic block. By tracking and recording the basic block currently being executed, you can get the program execution path;

[0048] Each basic block has only one entry and one exit, and execution will only start from the entry and leave from the exit. Therefore, the entry address of each basic block can be used to represent a basic block. Several basic blocks in a simple program are as follows: Figure 3 As shown, using QEMU for instrumentation can obtain the basic block information during the program execution process. In the process of QEMU simulating the execution of the program in user mode, the program is divided into basic blocks for translation and execution. By inserting a code that outputs the information of the basic block currently being executed before QEMU executes a basic block, the basic block sequence corresponding to the program execution process can be obtained when QEMU simulates the execution of the program.

[0049] Consider each basic block b in the program as a point, and use the entry address of the basic block to represent b. By tracking the program execution process, a sequence of basic blocks (b1, b2, b3, ..., bn) can be obtained. The jump between two consecutive basic blocks during the program execution process is defined as e = (bk, bk+1). Then e is the edge in the program control flow graph with basic blocks as nodes (such as Figure 2As shown in the figure, after the conversion from basic blocks to edges, the execution path of the program can be represented as a sequence of edges (Ee=e1, e2, e3, ..., en-1). In the sequence Ee, some edges will inevitably appear multiple times, that is, there may be x and y that make ex and ey in the sequence represent the same edge. Merging these same edges will obtain a set of edges containing the number of occurrences, Ee={e1, e2, e3, ...}. The number of times each edge appears may be different in different program execution processes. According to the number of occurrences, it is divided into 8 There are different types: 1, 2, 3, 4-7, 8-15, 16-31, 32-127, ≥128. These 8 types can be represented by different bits of a byte in practical applications, which is convenient for programming. After classification, a new edge set Ee = {e1, e2, e3, ...} will be obtained. The program basic block sequence corresponding to each individual Xi in the population is processed using the above process, and the execution path information of the program will be obtained in the end, that is, the edge set ei = {ei.1, ei.2, ei.3, ...};

[0050] Step S6: input the data into the test result analysis program to determine whether it meets the test end condition, which may include finding a certain number of errors, reaching a predetermined test time, etc.;

[0051] Step S7: If the test result does not meet the end condition, the current test case is modified to generate a new test case;

[0052] Step S8: The method for updating the test case changes certain bytes or files of the input data or generates new test data based on the known protocol or interface specification based on the generation method;

[0053] Step S9: input new test data into the data test program, and obtain simulation results by using the simulation execution program;

[0054] Step S10: The simulation execution program can record information such as code coverage by inserting stubs into the program source code to guide the generation of test data;

[0055] Step S11: restart the simulation result analysis program to determine whether it meets the preset constraint conditions, which include code coverage reaching a certain threshold and discovering a new execution path;

[0056] Step S12: If the simulation result satisfies the constraint condition, the data test program is continued to be fuzzy tested using the new test data;

[0057] Step S13: repeating steps S3 to S8, using a genetic algorithm in the data processing program and using a binary method test in the data testing program, until the test end condition is met or a predetermined test time is reached;

[0058] The test data is converted into individuals in the population of the genetic algorithm, and new test data is generated using the changes in individuals during the evolution process. The principle is as follows Figure 2 As shown in the figure, the population in the genetic algorithm is first initialized with initial test data or random values. Each individual in the population corresponds to a test data. Then, the process of the tested program processing these test data is tracked and the execution path information is recorded. At the same time, the execution status of the program is monitored and the test data that causes the program to crash is extracted. Next, the fitness of each individual is calculated using the execution path information. Finally, new test data is generated by selecting, crossing and mutating individuals and a new round of testing begins.

[0059] In the genetic algorithm, the population is composed of a number of individuals, each of which can be abstractly represented as a chromosome. If the length of the chromosome is D, then the i-th individual in the population can be represented as xi = (xi.1, xi.1, xi.1, ..., xi.1, D). The process of population initialization is to assign a value to each gene xi.d in xi. Each xi.d represents a byte, and the length D is the number of bytes of the test data. When there is initial test data, each byte of the initial test data is used to assign a value to each xi.d. In other cases, the entire population is initialized by random assignment. After initialization, the chromosome data of each individual is the content of a test data, which can be directly converted into the test data required for the next step.

[0060] Step S14: When the test end conditions are met, a detailed test report is output, including information such as errors found, test coverage, and test time.

[0061] The above description enables those skilled in the art to implement or use the present invention; various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention; therefore, the present invention will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A program fuzz testing method based on simulation execution, including a data processing program, characterized in that: The data processing program is communicatively connected to a data testing program, the data testing program is communicatively connected to a monitoring program, the data testing program is communicatively connected to a fuzz testing program, the fuzz testing program and the monitoring program are communicatively connected, the fuzz testing program is communicatively connected to a test result analysis program, the test result analysis program is communicatively connected to a simulation execution program, the simulation execution program is communicatively connected to an analysis simulation result program, and the analysis simulation result program is communicatively connected to an output test report.

2. The program fuzz testing method based on simulation execution according to claim 1 is characterized in that: An automated testing tool is provided in the data testing program.

3. The program fuzz testing method based on simulation execution according to claim 1, characterized in that: An initialization management tool is provided in the monitoring program.

4. The program fuzz testing method based on simulation execution according to claim 1, characterized in that: The data testing method in the fuzz testing program adopts the Fuzz tool chain.

5. The program fuzz testing method based on simulation execution according to claim 1 is characterized in that: The data calculation in the test result analysis program adopts cloud computing.

6. The program fuzz testing method based on simulation execution according to claim 1 is characterized in that: The simulation execution program executes the user's DSP program on the computer.

7. The program fuzz testing method based on simulation execution according to claim 1 is characterized in that: The program fuzz testing method based on simulation execution includes the following steps: Step S1: Clarify the test objectives and determine the key functions and security vulnerabilities that need to be tested in the data processing program; Step S2: Set up a suitable test environment to ensure that the conditions of simulation execution are close to the actual situation; Step S3: obtaining or generating a set of initial test data through a data processing program, and the test data will serve as the starting point of the fuzz test; Step S4: input the current test data into the data test program and execute the fuzzy test program; Step S5: monitor the execution process of the program and record the test results, including whether the program crashes, whether abnormal output is generated, etc.; Step S6: input the data into the test result analysis program to determine whether it meets the test end condition, which may include finding a certain number of errors, reaching a predetermined test time, etc.; Step S7: If the test result does not meet the end condition, the current test case is modified to generate a new test case; Step S8: The method for updating the test case changes certain bytes or files of the input data or generates new test data based on the known protocol or interface specification based on the generation method; Step S9: input new test data into the data test program, and obtain simulation results by using the simulation execution program; Step S10: The simulation execution program can record information such as code coverage by inserting stubs into the program source code to guide the generation of test data; Step S11: restart the simulation result analysis program to determine whether it meets the preset constraint conditions, which include code coverage reaching a certain threshold and discovering a new execution path; Step S12: If the simulation result satisfies the constraint condition, the data test program is continued to be fuzzy tested using the new test data; Step S13: repeating steps S3 to S8, using a genetic algorithm in the data processing program and using a binary method test in the data testing program, until the test end condition is met or a predetermined test time is reached; Step S14: When the test end conditions are met, a detailed test report is output, including information such as errors found, test coverage, and test time.

Citation Information

Patent Citations

  • Binary program fuzz-testing method based on multi-population genetic algorithm

    CN108427643A

  • Program fuzzy test method and device based on simulation execution

    CN109992507A