Method and system for heap vulnerability detection based on improved fuzzy testing

By improving the fuzz testing method, including code insertion and phased seed selection and energy allocation, the problem of insufficient heap vulnerability detection capabilities in the prior art is solved, and more efficient and accurate heap vulnerability detection is achieved.

CN118965368APending Publication Date: 2024-11-15SOUTHEAST UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411090271.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

Existing fuzz testing technology is insufficient in detecting heap vulnerabilities in C/C++ programs, especially after the increase in the complexity of software systems and the scale of the expansion, the exponential growth of the number of paths makes comprehensive tracking unrealistic, resulting in excessive instrumentation consumption. Yamato local optimal problem.

Method used

Using improved fuzz testing methods, including code insertion and fuzz testing steps, the code coverage and number of heap operations are collected through lightweight instrumentation, which is divided into exploration stages and reinforcement stages. The exploration stage uses non-dominant sorting priority algorithm to select and generate more The seeds of related operations are selected in the strengthening stage to select seeds with lower execution frequency for priority variation, and a simulated annealing algorithm is used to balance the running time of the seeds during the energy distribution process.

Benefits of technology

It improves the efficiency and accuracy of heap vulnerability detection, avoids local optimal problems, enhances detection capabilities, and can more effectively explore and discover heap vulnerabilities in the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118965368A_ABST
    Figure CN118965368A_ABST
Patent Text Reader

Abstract

The invention discloses a heap vulnerability detection method and system based on improved fuzz testing. The heap vulnerability detection method at least comprises the steps of code instrumentation and fuzz testing. In the code instrumentation step, lightweight instrumentation is carried out on a key code segment, the code coverage rate and the heap operation number in the program execution process are collected in real time, and heap operation comprises heap memory allocation and release type operation, memory access type operation and pointer alias type operation; the fuzzy testing step sequentially comprises an exploration stage and a strengthening stage; in the exploration stage, seeds generating more heaps of related operations are selected through a non-dominated sorting priority algorithm for variation, in order to prevent local optimum, the seeds enter the strengthening stage after the exploration stage is executed, the execution frequency of the seeds in the exploration stage is counted, and the seeds with low execution frequency are selected for preferential variation. Compared with a traditional heap vulnerability detection method, the heap vulnerability detection method provided by the invention has the advantages that the detection capability and efficiency are higher by fully utilizing the characteristics of fuzzy test heritable variation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of fuzzy testing, and mainly relates to a heap vulnerability detection method and system based on improved fuzzy testing. Background Art

[0002] In today's era of rapid development of information technology, software security issues are becoming more and more prominent, especially heap memory-related vulnerabilities, which pose a severe challenge to the stability and security of software systems. Heap memory, as a key link in program dynamic memory allocation, is directly related to the security architecture of the entire system. Heap vulnerabilities such as buffer overflow, memory leak, data tampering and remote code execution have become the main source of system security threats.

[0003] In the field of software vulnerability detection technology, the rise of fuzz testing technology, especially gray-box fuzz testing, provides security experts with an effective means to discover vulnerabilities without a comprehensive understanding of the code structure. By inserting probes into the program and collecting feedback information at runtime, this information can guide the generation of test cases that trigger program crashes, thereby discovering potential security vulnerabilities. This method not only inherits the speed and flexibility of black-box testing, but also significantly improves the efficiency and effectiveness of testing through a limited internal perspective.

[0004] Designing a fuzz-based heap vulnerability detection tool also faces a series of challenges. The paths in the program that frequently involve heap-related operations are the focus of detection, but as the complexity and scale of software systems increase, the exponential growth in the number of paths makes comprehensive tracking unrealistic. Therefore, it is necessary to focus on test cases that can trigger more heap operations. However, this targeted approach will lead to excessive instrumentation consumption and local optimal problems that favor a small number of paths during the detection process. Traditional vulnerability detection methods can no longer meet current security needs, and it is urgent to develop a more efficient and accurate heap vulnerability detection method. Summary of the invention

[0005] The present invention is aimed at the problem that the fuzzy testing technology in the prior art is insufficient in detecting the heap vulnerability in C / C++ programs, and provides a heap vulnerability detection method and system based on improved fuzzy testing, which at least includes code plugging and fuzzy testing steps; in the code plugging step, lightweight plugging is performed on key code segments, and the code coverage and the number of heap operations in the program execution process are collected in real time, and the heap operations include three types of heap memory allocation and release operations, memory access operations, and pointer alias operations; the fuzzy testing step includes two stages, the exploration stage and the strengthening stage; the exploration stage selects seeds that generate more heap-related operations through a non-dominated sorting priority algorithm for mutation, and in order to prevent the occurrence of local optimality, the exploration stage is executed and enters the strengthening stage, the execution frequency of the seeds in the exploration stage is counted, and the seeds with lower execution frequency are selected for priority mutation. The present invention can make full use of the characteristics of fuzzy testing genetic variation, and its detection capability and efficiency are higher than those of traditional heap vulnerability detection methods.

[0006] In order to achieve the above object, the technical solution adopted by the present invention is: a heap vulnerability detection method based on improved fuzz testing, which at least includes code stubbing and fuzz testing steps;

[0007] In the code instrumentation step, lightweight instrumentation is performed on key code segments to collect code coverage and the number of heap operations during program execution in real time. The heap operations include heap memory allocation and release operations, memory access operations, and pointer alias operations.

[0008] The fuzz testing steps include an exploration phase and an enhancement phase in sequence; in the exploration phase, seeds that generate more heap-related operations are selected for mutation through a non-dominated sorting priority algorithm, and then the enhancement phase is entered to count the execution frequency of the seeds in the exploration phase and select seeds with lower execution frequency for priority mutation.

[0009] As an improvement of the present invention, a heap vulnerability detection method based on improved fuzzy testing includes at least the following steps:

[0010] S1, code instrumentation: instrument the source code of a given program, traverse the LLVM intermediate files corresponding to the target program in turn, determine all basic blocks, instrument before the start of each basic block, and assign an ID for subsequent calculation of code coverage; instrument the three types of heap operations after conversion to LLVM intermediate files;

[0011] S2, fuzz testing: the code coverage of the current seed obtained in step S1 and the number of three types of heap-related operations are collected through shared memory, and the fuzz test is divided into two stages based on whether the seeds in the queue have been fuzz tested. The fuzz test goes through the exploration stage and the strengthening stage in sequence, and the seeds that generate more heap-related operations and have a lower execution frequency are preferentially selected for mutation; the steps at least include:

[0012] S21, exploration phase: select seeds that generate more heap-related operations through the non-dominated sorting priority algorithm, allocate more energy to the selected seeds through the simulated annealing algorithm, perform fuzz testing, and record the execution path frequency;

[0013] S22, strengthening stage: select seeds with lower execution path frequency in the exploration stage of step S21, allocate more energy to them through simulated annealing algorithm, perform fuzz testing, and record the execution path frequency;

[0014] S23, information feedback: When steps S21 and S22 perform fuzz testing, the seeds that generate new code coverage are saved in the queue and enter the next round of fuzz testing; the seeds that trigger the program crash are recorded in the file for further analysis and verification; in the exploration phase, there are still seeds in the seed queue that have not been fuzz tested, and in the reinforcement phase, all seeds in the seed queue have been tested. Once a new test case is generated in the reinforcement phase, it returns to the exploration phase to continue testing.

[0015] As another improvement of the present invention, the plugging functions of the three types of heap operations in step S1 are:

[0016] Heap memory allocation and release classes: "malloc", "valloc", "calloc", "realloc", "safe_malloc", "safemalloc", "safexmalloc", "memalign", "aligned_alloc", "safe_calloc", "safecalloc", "safexcalloc", "\_Znwm", "\_Znam", "\_Znaj", "\_Znwj", "free", "cfree", "safe_cfree", "safefree", "\_ZdaPv", "\_ZdlPv";

[0017] Memory access class: Use the APIs mayReadFromMemory() and mayWriteToMemory() provided by LLVM to detect whether the instruction involves reading and writing heap allocated memory;

[0018] Pointer alias class: Use LLVM's API GetElementPtr() to determine whether the pointer is passed directly by calling or passed as a function parameter.

[0019] As another improvement of the present invention, in the exploration phase of step S21, the seed heap operation score heap_s is calculated by using an equal weight method. According to the simulated annealing algorithm, for a given seed and its heap operation score, after reaching thermal equilibrium, the energy P obtained by the seed at the running time t is:

[0020] P = heap_s (1.0-T k )+0.5T k

[0021] Among them, T k The temperature of the seed at running time t after reaching thermal equilibrium is calculated by the simulated annealing algorithm.

[0022] As a further improvement of the present invention, in the strengthening stage of step S22, the path frequency of the current seed is normalized to the maximum and minimum to obtain the seed frequency score freq_s. After reaching thermal equilibrium, the energy P obtained by the seed at the running time t is:

[0023] P=(1-freq_s)·(1.0-T k )+0.5T k

[0024] Among them, T k The temperature of the seed at running time t after reaching thermal equilibrium is calculated by the simulated annealing algorithm.

[0025] In order to achieve the above-mentioned purpose, the present invention also adopts a technical solution: a heap vulnerability detection system based on improved fuzzy testing, including a computer program, which implements the steps of any of the above-mentioned methods when executed by a processor.

[0026] Compared with the prior art, the present invention has the following beneficial effects:

[0027] 1. The static instrumentation part of the present invention adopts coarse-grained instrumentation of functions involving heap-related operations, and considers three situations to improve the efficiency of instrumentation and the accuracy of subsequent detection of heap vulnerabilities.

[0028] 2. The present invention divides the fuzzy test into two stages based on whether the seeds in the queue have been fuzz tested. The exploration stage tends to generate paths with more heap operations, and the reinforcement stage tends to generate paths with low execution frequency. This can avoid the local optimal problem caused by the exploration stage, and explore heap vulnerabilities in a few paths, thereby improving detection capabilities and efficiency.

[0029] 3. The present invention adopts a non-dominated sorting method to balance the number of three types of heap-related operations in the seed selection process of the fuzzy test exploration phase, avoiding conflicts among the three types of operations. Optimizing one of them may lead to a reduction in the number of other operations.

[0030] 4. The present invention adopts a simulated annealing algorithm to balance the running time of high-quality seeds and ordinary seeds in the energy allocation process of fuzzy testing, and allocates more mutation time to high-quality seeds in order to trigger more crashes. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 The present invention is a flowchart of the steps of a heap vulnerability detection method based on improved fuzzy testing. DETAILED DESCRIPTION

[0032] The present invention will be further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.

[0033] Example 1

[0034] A heap vulnerability detection method based on improved fuzz testing, such as Figure 1 As shown, the following steps are included:

[0035] Step S1, code stub: perform code stub on the source code of a given C / C++ program, implant probes at the entry of the basic block and the three types of heap operations, and record the code blocks and the three types of heap related operations. The specific process is as follows:

[0036] S11: insert the code segments in the program, traverse the LLVM intermediate files corresponding to the target program in turn, determine all basic blocks, then insert before the start of each basic block, and assign an ID for subsequent calculation of code coverage;

[0037] S12: Heap-related operations are divided into three categories, namely, heap memory allocation and release functions, memory access functions, and pointer alias functions, and the three types of heap operations are instrumented after being converted into LLVM intermediate files. The instrumented functions involved in the three types of heap-related operations are:

[0038] 1) Allocate and release heap memory classes: "malloc", "valloc", "calloc", "realloc", "safe_malloc", "safemalloc", "safexmalloc", "memalign", "aligned_alloc", "safe_calloc", "safecalloc", "safexcalloc", "\_Znwm", "\_Znam", "\_Znaj", "\_Znwj", "free", "cfree", "safe_cfree", "safefree", "\_ZdaPv", "\_ZdlPv";

[0039] 2) Heap memory access class: Use the APIs mayReadFromMemory() and mayWriteToMemory() provided by LLVM to detect whether the instruction involves reading and writing the heap allocated memory;

[0040] 3) Pointer alias related classes: Use LLVM's API GetElementPtr() to determine whether the pointer is passed directly by calling or as a function parameter.

[0041] Step S2, fuzz testing: Step S1 has performed code instrumentation, so the code coverage and the number of three types of heap-related operations generated by different input use cases (i.e., seeds) can be collected through shared memory during program execution. Before a seed is fuzz tested, the fuzz test will go through a seed selection process and an energy allocation process. Seed selection is used to select seeds for priority mutation, and energy allocation determines the duration of non-deterministic mutation of each seed. Obviously, it is necessary to give priority to seeds that generate more heap-related operations and give them more mutation time. Considering that local optimal problems are prone to occur during the iteration process, each round of fuzz testing is divided into two stages, namely the exploration stage and the reinforcement stage.

[0042] First, select the seed input executable program from the initial seed queue. During the execution process, the code coverage and heap-related operation information generated by each test case will be automatically collected. If new code coverage is generated, the test case will be added to the seed queue to monitor the operation of the program under test. If a crash occurs, it will be added to the crash case collection for subsequent analysis. The fuzz test is divided into two stages based on whether the seeds in the queue have been fuzz tested. In the exploration stage, there are still seeds in the seed queue that have not been fuzz tested. In the enhancement stage, all seeds in the seed queue have been tested. Once a new test case is generated in the enhancement stage, it will return to the exploration stage to continue testing. The specific steps are as follows:

[0043] S21: Obtain the code coverage of the current seed and the number of three types of heap-related operations through shared memory;

[0044] S22: Exploration phase, firstly, the seeds that generate more heap-related operations are selected through the non-dominated sorting algorithm, then more energy is allocated to the selected seeds through the simulated annealing algorithm, and finally fuzz testing is performed and the execution path frequency is recorded;

[0045] There are still unfuzzified seeds in the queue. During the seed selection process, due to the statistics of three types of heap-related operations, there are three conflicting goals. Optimizing one goal may lead to a reduction in the number of other goals. The non-dominated sorting algorithm is used for optimization.

[0046] The energy allocated to the seed in the energy allocation process represents the duration of the seed mutation. The increase in the mutation duration correspondingly increases the number of mutations of the seed and enhances the ability to explore the program state space. Allocating more energy to the selected high-quality seeds ensures that seeds with higher heap vulnerability detection potential can obtain more mutation time and increase the possibility of discovering heap vulnerabilities. The method of the present invention adopts an exponential simulated annealing algorithm, and the formula is as follows:

[0047] T k =T0·α k

[0048] In the initial state, the initial temperature T0 is set to 1. After cooling, the temperature T gets closer and closer to 0; α represents the temperature attenuation system, which is generally between 0.8 and 0.99; k is the number of cycles. Thermal equilibrium condition T n Set to 0.05, when T k >T n When T , all seeds are allocated the same energy to ensure the fairness of the mutation process; k <T n When , the system reaches thermal equilibrium, and the selected seeds will be allocated more energy to ensure the efficiency of the mutation process.

[0049] Time is a typical constraint factor of fuzz testing. Usually, fuzz testing is terminated after a given time t is executed. Therefore, time t is used as a parameter to adjust the number of loops k, where k is n Indicates that the temperature drops to the thermal equilibrium condition T n The number of times, t n Indicates that the temperature drops to T n Time:

[0050]

[0051] Before reaching thermal equilibrium, each seed has the same energy distribution, so no calculation is required. It is necessary to calculate the energy distributed to different seeds after reaching thermal equilibrium. At this time, T k =T n = 0.05; use k to establish the relationship between time t and temperature T. It is known that after reaching thermal equilibrium Depend on Finally, calculate the temperature T at any time t k for:

[0052]

[0053] The seed heap operation score heap_s is calculated using the equal weight method. According to the simulated annealing algorithm, for a given seed and its heap operation score, after reaching thermal equilibrium, the energy P obtained by the seed at running time t is as follows:

[0054] P = heap_s (1.0-T k )+0.5T k ;

[0055] S23: Intensification phase, firstly, seeds with low execution path frequency in the exploration phase are selected, then more energy is allocated to these seeds through simulated annealing algorithm, and finally fuzz testing is performed and the execution path frequency is recorded;

[0056] In this step, the fuzz test has been going on for a while and has covered most of the easily accessible paths as much as possible. Some difficult-to-reach paths can only be reached by a few seeds with low execution frequency, and these paths may also have heap-related vulnerabilities. Therefore, a path frequency variable is set for each seed. After each test case is executed, the checksum of the current path is calculated, and the path frequency of the same path seed in the queue is increased by 1. The seed selection process selects seeds with low frequency for mutation first.

[0057] The energy allocation process uses the same algorithm as step S22 to perform maximum and minimum normalization on the path frequency of the current seed to obtain the seed frequency score freq_s. After reaching thermal equilibrium, the energy P obtained by the seed at the running time t is as follows:

[0058] P=(1-freq_s)·(1.0-T k )+0.5T k ;

[0059] S24: Exploration and Enhancement Phase During fuzz testing, seeds that generate new code coverage will be saved in a queue and enter the next round of fuzz testing. The seeds that trigger program crashes will be recorded in a file for further analysis and verification.

[0060] Example 2

[0061] like Figure 1 As shown, a heap vulnerability detection method based on improved fuzz testing includes the following steps:

[0062] The first step is code instrumentation: for a C / C++ source file to be tested, convert it into LLVM intermediate language and obtain a pointer to the shared memory address:

[0063] 1.1 Randomly calculate the number of the current basic block and set it to A; get the number of the previous basic block and set it to B;

[0064] 1.2 Calculate the corresponding addresses of the two basic blocks in the shared memory through XOR, and increment the corresponding counter on the address, which means the number of times the edge A->B is passed is increased by 1;

[0065] 1.3 Shift the number of the current basic block right by one position as the "number of the previous basic block" of the next instrumented basic block to avoid the situation where the results of A->B and B->A are the same after XOR.

[0066] Before 1.3, three types of heap-related operations were instrumented to obtain the shared memory address pointing to the number of three types of heap-related operations:

[0067] (1) Determine whether the currently traversed function is a heap memory allocation or release function, and increment the corresponding shared memory counter;

[0068] (2) Determine whether the currently traversed function involves memory reading, and increment the corresponding shared memory counter;

[0069] (3) Determine whether the function parameters currently traversed involve pointer transfer, whether the current operation involves pointer transfer, and the corresponding shared memory counter is incremented;

[0070] The following is an example of obtaining the number of three types of heap-related operations after converting C language code to LLVM intermediate language. The left side is C language code, and the right side is the converted LLVM intermediate language. It involves malloc() memory allocation function and free() memory release function, and the corresponding shared memory counter increases by 2; load and store are statements for reading and writing from memory, and the corresponding shared memory counter also increases by 2; it involves two pointer transfers, and the corresponding shared memory counter also increases by 2;

[0071]

[0072] The second step is fuzz testing:

[0073] The initial seed queue is input into the program in this way, and the code coverage and the number of three heap operations generated by each seed can be obtained. At this time, it is in the exploration stage, and there are still unfuzzified seeds in the queue:

[0074] Seed selection: Get the number of three types of heap operations of the current seed, and determine whether the current seed belongs to the non-dominated set through non-dominated sorting. Seed A dominates seed B, which means that in terms of the three types of quantities, A has at least one quantity better than B, and the others are at least the same as B. If the seed is not dominated by other seeds, it can be added to the non-dominated set, otherwise it will be removed.

[0075] Energy scheduling: The annealing energy P of the seed at the current moment is calculated through the simulated annealing algorithm, and combined with the energy Power_factor of the original fuzz test to define the final energy Perf_score:

[0076] Perf_score=Power_factor·2.0(P-0.2)·10

[0077] The seeds in the queue are mutated according to this step until all the seeds in the queue have been fuzz tested and then move to the strengthening stage.

[0078] At this time, we are in the hardening stage, and all the seeds in the queue have been fuzz tested:

[0079] Seed selection: Get the execution frequency of the paths of all seeds in the current seed queue, and select seeds with smaller path frequencies for priority execution.

[0080] Energy scheduling: As in the exploration phase, the final energy of the seed is calculated through the simulated annealing algorithm. If a new seed is generated in the reinforcement phase, it will switch to the exploration phase to continue execution.

[0081] Following the genetic algorithm idea adopted by fuzz testing AFL, high-quality seeds that generate new code coverage are retained in the seed queue to ensure that the next mutation can be executed on seeds with higher code coverage potential, thereby increasing the chance of discovering new vulnerabilities; during fuzz testing, seeds that trigger crashes are retained in the crash queue for subsequent debugging programs to determine the cause of the crash. The test process will continue until the pre-set time or resource limit is reached.

[0082] In summary, the present invention proposes a method that can effectively improve the efficiency and ability of heap vulnerability detection based on the fuzz testing tool AFL (American Fuzzy Lop), including code plugging and fuzz testing parts. The code plugging part collects three types of heap-related operations (heap memory allocation and release operations, memory access operations, pointer alias operations) and code coverage through lightweight plugging; the fuzz testing part is divided into two stages. The exploration stage preferentially selects seeds that can generate more heap-related operations for mutation through non-dominated sorting. In order to prevent the occurrence of local optimality, the exploration stage enters the strengthening stage after the execution of the exploration stage, and the execution frequency of the seeds in the exploration stage is counted, and then the seeds with lower execution frequency are selected for priority mutation. In both stages, more energy and mutation time are allocated to the selected seeds. During the fuzzy test, the above two stages are executed cyclically until the set time is reached; at the same time, the program running status is monitored, and once an abnormality is found, it is immediately recorded and analyzed. The present invention can make full use of the characteristics of fuzzy testing genetic variation, and its detection ability and efficiency are higher than the traditional heap vulnerability detection method.

[0083] It should be noted that the above content only illustrates the technical idea of ​​the present invention and cannot be used to limit the protection scope of the present invention. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications all fall within the protection scope of the claims of the present invention.

Claims

1. A heap vulnerability detection method based on improved fuzz testing, characterized in that: Includes at least code instrumentation and fuzz testing steps; In the code instrumentation step, lightweight instrumentation is performed on key code segments to collect code coverage and the number of heap operations during program execution in real time. The heap operations include heap memory allocation and release operations, memory access operations, and pointer alias operations. The fuzz testing steps include an exploration phase and an enhancement phase in sequence; in the exploration phase, seeds that generate more heap-related operations are selected for mutation through a non-dominated sorting priority algorithm, and then the enhancement phase is entered to count the execution frequency of the seeds in the exploration phase and select seeds with lower execution frequency for priority mutation.

2. A heap vulnerability detection method based on improved fuzzy testing as claimed in claim 1, characterized in that: At least the following steps are included: S1, code instrumentation: instrument the source code of a given program, traverse the LLVM intermediate files corresponding to the target program in turn, determine all basic blocks, instrument before the start of each basic block, and assign an ID for subsequent calculation of code coverage; instrument the three types of heap operations after conversion to LLVM intermediate files; S2, fuzz testing: the code coverage of the current seed obtained in step S1 and the number of three types of heap-related operations are collected through shared memory, and the fuzz test is divided into two stages based on whether the seeds in the queue have been fuzz tested. The fuzz test goes through the exploration stage and the strengthening stage in sequence, and the seeds that generate more heap-related operations and have a lower execution frequency are preferentially selected for mutation; the steps at least include: S21, exploration phase: select seeds that generate more heap-related operations through the non-dominated sorting priority algorithm, allocate more energy to the selected seeds through the simulated annealing algorithm, perform fuzz testing, and record the execution path frequency; S22, strengthening stage: select seeds with lower execution path frequency in the exploration stage of step S21, allocate more energy to them through simulated annealing algorithm, perform fuzz testing, and record the execution path frequency; S23, information feedback: When steps S21 and S22 perform fuzz testing, the seeds that generate new code coverage are saved in the queue and enter the next round of fuzz testing; the seeds that trigger the program crash are recorded in the file for further analysis and verification; in the exploration phase, there are still seeds in the seed queue that have not been fuzz tested, and in the reinforcement phase, all seeds in the seed queue have been tested. Once a new test case is generated in the reinforcement phase, it returns to the exploration phase to continue testing.

3. A heap vulnerability detection method based on improved fuzzy testing as claimed in claim 2, characterized in that: The plugging functions of the three types of heap operations in step S1 are: Heap memory allocation and release classes: "malloc", "valloc", "calloc", "realloc", "safe_malloc", "safemalloc", "safexmalloc", "memalign", "aligned_alloc", "safe_calloc", "safecalloc", "safexcalloc", "\_Znwm", "\_Znam", "\_Znaj", "\_Znwj", "free", "cfree", "safe_cfree", "safefree", "\_ZdaPv", "\_ZdlPv"; Memory access class: Use the APIs mayReadFromMemory() and mayWriteToMemory() provided by LLVM to detect whether the instruction involves reading and writing the heap allocated memory; Pointer alias class: Use LLVM's API GetElementPtr() to determine whether the pointer is passed directly by calling or passed as a function parameter.

4. The method for detecting a heap vulnerability based on improved fuzzy testing according to claim 3, characterized in that: In the exploration phase of step S21, the seed heap operation score heap_s is calculated by using an equal weight method. According to the simulated annealing algorithm, for a given seed and its heap operation score, after reaching thermal equilibrium, the energy P obtained by the seed at the running time t is: P=heap_s·(1.0-T k )+0.5T k Among them, T k The temperature of the seed at running time t calculated by the simulated annealing algorithm.

5. The method for detecting a heap vulnerability based on improved fuzzy testing according to claim 3, characterized in that: In the strengthening stage of step S22, the path frequency of the current seed is normalized to the maximum and minimum to obtain the seed frequency score freq_s. After reaching thermal equilibrium, the energy P obtained by the seed at the running time t is: P=(1-freq_s)·(1.0-T k )+0.5T k Among them, T k The temperature of the seed at running time t calculated by the simulated annealing algorithm.

6. A heap vulnerability detection system based on improved fuzz testing, comprising a computer program, characterized in that: When the computer program is executed by a processor, the steps of any of the above methods are implemented.

Citation Information

Cited By

  • Method and device for using COM (Component Object Model) technical software in fuzzy test

    CN119669092A

  • Method and apparatus for fuzz testing software using COM technology

    CN119669092B