A fuzz testing method and device for bypassing Windows program graphical interface
Through dynamic binary instrumentation and static analysis technology, it bypasses the Windows platform user graphical interface and generates a fuzz test driver, which solves the problems of low fuzz testing efficiency and limited coverage in the existing technology, and achieves efficient vulnerability discovery and automation. Build.
Patent Information
- Application Number
- CN202111491030.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-08
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-12-08
AI Technical Summary
The existing technology is difficult to effectively fuzz test Windows platform user graphical interface applications, resulting in low fuzz testing efficiency and difficulty in vulnerability discovery. In particular, it relies on open source header files and source code, and cannot be applied to closed source programs without source code.
Dynamic binary instrumentation tools are used to track function call relationships, and static analysis tools are combined for function prototype inference and reconstruction to generate fuzz test drivers, bypassing the user graphical interface, and realizing automated fuzz test driver construction.
It has significantly improved the efficiency and coverage of fuzz testing, discovered new undisclosed vulnerabilities, and is suitable for Windows platform applications without source code. Compared with manual writing, the driver coverage and the number of crash discoveries have been improved.
Smart Images

Figure CN114416520B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network security, and in particular relates to a fuzzy testing method and device for bypassing a Windows program graphical interface. Background Art
[0002] Fuzz testing is an automated software testing technology that provides maliciously constructed data as input to the test program and monitors whether the program is abnormal. Due to its simplicity and high efficiency, it has been applied by major software manufacturers to software development testing to ensure the quality of their key products and has discovered a large number of security vulnerabilities.
[0003] However, most automated fuzz testing focuses on Linux systems, while largely ignoring Windows fuzz testing; as of 2021, Windows systems still account for approximately 73% of the market share, and because it is the system that end users directly contact, it remains an important target for attackers, but Windows applications rely heavily on the Graphical User Interface (GUI) to interact with end users, which poses a major obstacle to fuzz testing.
[0004] In order to further reduce this obstacle, researchers have combined the fuzz testing process with three methods: writing behavior replay scripts to simulate human operations, using patches to eliminate GUI element codes that require user interaction, and writing fuzz test drivers to promote integrated testing. However, behavior replay is limited by the low speed of script execution, which greatly reduces the efficiency of fuzz testing; patch-based testing is difficult to implement due to its high requirements for security personnel's reverse analysis capabilities; and finally writing fuzz test drivers has become the mainstream method, but manual writing of drivers is still very cumbersome. In order to realize the automated construction of fuzz test drivers, researchers have proposed a series of new technologies and methods, but most of the existing automated construction methods require access to source code and cannot easily handle closed-source programs. It is time-consuming and laborious to rely solely on manual fuzz test driver construction, so there is an urgent need for an automated framework to assist in the process of building fuzz test drivers for Windows platform user graphical interface programs.
[0005] Among the current fuzz driver automatic generation technologies, FUDGE [D.Babic, S.Bucur, Y.Chen, F.Ivan, T.King, M.Kusano, C.Lemieux, L.Szekeres, and W.Wang, "FUDGE: Fuzz Driver Generation At Scale," in Proceedings of the 2019 27th ACM Joint Meeting onEuropean Software Engineering Conference and Symposium on the Foundations ofSoftware Engineering.ACM, 2019, pp.975–985.] aims to use ClangMR to slice the target source code, extract the API call sequence and context to create a fuzz driver, and use dynamic analysis for testing; FuzzGen [KK Ispoglou, D.Austin, V.Mohan, and M.Payer, "FuzzGen: Automatic Fuzzer Generation," in Proceedings of the 29th USENIX Security Symposium (Security), Boston, MA, USA, Aug. 2020.] uses the target source code to infer the function call relationship, and uses it to build an abstract API function call dependency graph (A2DG), and finally synthesizes a fuzz test driver based on A2DG; IntelliGen [Zhang M, Liu J, Ma F, et al. IntelliGen: Automatic Driver Synthesis for Fuzz Testing [C] / / 2021 IEEE / ACM 43rd International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP). IEEE, 2021: 318-327.] proposes to generate a fuzz driver for the selected entry function through hierarchical parameter replacement and type inference for fuzz testing; Autoharness uses codeql to generate a control flow graph for the source code, and makes educated guesses about the generation of the driver based on this. The above methods all require the target program to be open source to obtain the function relationship. For applications without source code on the Windows platform, the above methods are not applicable. Summary of the invention
[0006] Aiming at the problem that the user graphical interface hinders the fuzz testing process, the present invention proposes a fuzz testing method and device for bypassing the graphical interface of Windows programs, uses a dynamic binary instrumentation (analysis) tool to replace the traditional open source header file to extract relationships, and uses a function relationship extraction algorithm to screen the dependency relationships, and restores and reconstructs them with the help of a static analysis method. The present invention is more suitable for source code-free applications on the Windows platform, and the problem that the user graphical interface hinders the fuzz testing process can be solved by combining the dynamic and static methods.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions:
[0008] On one hand, the present invention provides a fuzz testing method for bypassing a Windows program graphical interface, comprising:
[0009] Step 1: For the graphical user interface application to be analyzed, the execution path of the application is tracked by the dynamic binary instrumentation tool, and the thread ID, function caller, call address, symbol and parameters of the execution process are extracted and recorded to obtain the original function trajectory projection sequence;
[0010] Step 2: According to the original function trajectory projection sequence, the dynamic trajectory function call relationship extraction algorithm is used to extract the pointer type and data dependency relationship;
[0011] Step 3: Analyze the original function trajectory projection sequence processed in step 2 with the help of static analysis tools, and infer and reconstruct the function prototype in the sequence;
[0012] Step 4: Fill the content of the fuzz test driver framework with the reconstructed function information and sequence order;
[0013] Step 5: Synthesize the fuzz test driver and test whether it runs normally, and finally generate a fuzz test driver that meets the actual requirements for vulnerability mining.
[0014] Furthermore, the dynamic binary instrumentation tool is DynamoRIO.
[0015] Furthermore, the step 2 comprises:
[0016] A preliminary type judgment is performed on the original function trajectory projection sequence extracted by the dynamic binary instrumentation tool, and the corresponding function and pointer data information are stored in the temporary array D; then, for any two representative functions F in D, α With F γ , if its production data source matches the consumption data source type and satisfies (F α .in∩F γ.out)∪(F γ .in∩F α .out)≠0, it is stored in the data dependency set S after the final parsing is completed; where F α .in represents function F α The input, i.e. the consumption data source, F γ .out represents function F α The output, i.e. the production data source, F γ .in represents function F γ The input, i.e. the consumption data source, F α .out represents function F γ The output of, that is, the production data source.
[0017] Another aspect of the present invention provides a fuzzy testing device for bypassing a Windows program graphical interface, comprising:
[0018] The trace extraction module is used to track the execution path of the user graphical interface application to be analyzed through the dynamic binary instrumentation tool, extract and record the thread ID, function caller, call address, symbols and parameters during the execution process, so as to obtain the original function trace projection sequence;
[0019] The dynamic function relationship extraction module is used to extract the pointer type and data dependency relationship based on the original function trajectory projection sequence using the dynamic trajectory function call relationship extraction algorithm;
[0020] The static analysis module is used to analyze the original function trajectory projection sequence processed by the dynamic trajectory function call extraction module in combination with the static analysis tool, and to infer and reconstruct the function prototype in the sequence;
[0021] The fuzz test driver framework filling module is used to fill the content of the fuzz test driver framework through the reconstructed function information and sequence order;
[0022] The fuzz test driver synthesis module is used to synthesize the fuzz test driver and test whether it runs normally, and finally generate a fuzz test driver that meets the actual requirements for vulnerability mining.
[0023] Furthermore, the dynamic binary instrumentation tool is DynamoRIO.
[0024] Furthermore, the dynamic function relationship extraction module is specifically used for:
[0025] A preliminary type judgment is performed on the original function trajectory projection sequence extracted by the dynamic binary instrumentation tool, and the corresponding function and pointer data information are stored in the temporary array D; then, for any two representative functions F in D,α With F γ , if its production data source matches the consumption data source type and satisfies (F α .in∩F γ .out)∪(F γ .in∩F α .out)≠0, it is stored in the data dependency set S after the final parsing is completed; where F α .in represents function F α The input, i.e. the consumption data source, F γ .out represents function F α The output, i.e. the production data source, F γ .in represents function F γ The input, i.e. the consumption data source, F α .out represents function F γ The output of, that is, the production data source.
[0026] Compared with the prior art, the present invention has the following beneficial effects:
[0027] Starting from the working mechanism of dynamic binary instrumentation, based on control flow analysis and data flow analysis, this paper proposes a fuzz testing method and device for bypassing the graphical interface of Windows programs, which effectively solves the problem that the user graphical interface application program hinders the fuzz testing process. Compared with manually written drivers, the target coverage rate and the number of crashes found in this paper are significantly improved, and new undisclosed vulnerabilities are discovered, which has good applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is one of the flow charts of a fuzzy testing method for bypassing a Windows program graphical interface according to an embodiment of the present invention;
[0029] Figure 2 This is a second flowchart of a fuzzy testing method for bypassing a Windows program graphical interface according to an embodiment of the present invention;
[0030] Figure 3 This is a comparison result of the coverage of a fuzzy testing method for bypassing the graphical interface of a Windows program and a manually written driver in an embodiment of the present invention;
[0031] Figure 4 This is a comparison result of the number of crashes of a fuzzy testing method for bypassing the graphical interface of a Windows program and a manually written driver in an embodiment of the present invention. DETAILED DESCRIPTION
[0032] The present invention will be further explained below with reference to the accompanying drawings and specific embodiments:
[0033] like Figure 1 , Figure 2 As shown, a fuzz testing method for bypassing the graphical interface of Windows programs is mainly composed of three stages: dynamic path tracing framework, function call relationship identification and extraction, and call relationship recovery and reconstruction. The identification and extraction of function call relationships is the core. Specifically, the program and the program input given by the user are executed in the instrumentation monitoring environment, and the path information of the program execution process is extracted through the dynamic path tracing framework, which mainly includes key calling functions, parameters, and return values between the functional module and the main program. The function call relationship extraction algorithm is used to further determine the dependency relationship between the pointer type and the function, collect the dependency information and use it to recover and reconstruct the call relationship, and finally generate a driver that can run without relying on the user graphical interface for fuzz testing; specifically including:
[0034] Step 1: For the graphical user interface application to be analyzed, the execution path of the application is tracked by the dynamic binary instrumentation tool, and the thread ID, function caller, call address, symbol and parameters of the execution process are extracted and recorded to obtain the original function trajectory projection sequence;
[0035] Step 2: According to the original function trajectory projection sequence, the dynamic trajectory function call relationship extraction algorithm is used to extract the pointer type and data dependency relationship;
[0036] Step 3: Use the binary static analysis tool IDA to analyze the original function trajectory projection sequence processed in step 2, and infer and reconstruct the function prototype in the sequence;
[0037] Step 4: Fill the content of the fuzz test driver framework with the reconstructed function information and sequence order;
[0038] Step 5: Synthesize the fuzz test driver and test whether it runs normally, and finally generate a fuzz test driver that meets the actual requirements for vulnerability mining.
[0039] Among them, step 1 belongs to the dynamic path tracing framework stage, step 2 belongs to the function call relationship identification and extraction stage, and steps 3, 4, and 5 belong to the call relationship recovery and reconstruction stage.
[0040] Furthermore, the dynamic binary instrumentation tool is DynamoRIO.
[0041] Specifically, in order to describe the dynamic trajectory function call relationship extraction algorithm, it is necessary to define the data source, dependency relationship, and nested relationship of functions:
[0042] Definition 1. Data source. For any objective function F, its input is set to F.in and its output is set to F.out, which are respectively represented as the consumption data source and production data source of the objective function F.
[0043] Definition 2. Data dependency. If an input parameter of the objective function is the output return value of another function, or an input parameter of another function is the output return value of the objective function, then there is a data dependency relationship between the two. If the two functions are set to α and γ, and the conditional judgment relationship (F α .in∩F γ .out)∪(F γ .in∩F α .out)≠0, it can be written as (F α ,F γ ) indicates that there is a dependency relationship between the two functions.
[0044] Definition 3. State trajectory projection. Let the state trajectory of the program P with respect to the input I be an ordered pair T = <(ρ 1 ,σ 1 ),(ρ 2 ,σ 2 ),…,(ρ k ,σ k )>, then ρ i ∈N(1≤i≤k),<ρ 1 ,ρ 2 ,…,ρ k > is the path of the trajectory, and σ i (1≤i≤k) is called the transition from program variable to ρ i Executes the function mapping of the previous value.
[0045] In addition, the present invention has found through experiments that the dynamic binary instrumentation tool has the following characteristics when extracting program traces:
[0046] (1) There may be potential parameter information in the CPU registers and stack.
[0047] For each call and jump of the control flow between functions in different modules in the application, the dynamic binary instrumentation tool will record the current thread ID, caller, call address, symbols and parameters, etc.; but if there is no prototype information of the function, it will conservatively choose to treat the information in all CPU registers and the upper stack as potential parameters, which need further identification and screening.
[0048] (2) For values in accessible memory areas, they are dumped as pointers by default.
[0049] During the dynamic execution of an application, if any value falls into an accessible memory area, the dynamic binary instrumentation tool will conservatively treat it as a pointer and dump the memory it references for further analysis; for relationships of multi-level pointer types such as double pointers, the dynamic binary instrumentation tool will recursively repeat this process to obtain information.
[0050] According to the above definition and the characteristics of program trace extraction, the dynamic trace function call relationship extraction algorithm is implemented on the dynamic binary program instrumentation tool DynamoRIO as shown in Algorithm 1.
[0051]
[0052] The algorithm shown is an algorithm for extracting dynamic trace function call relations. In the initialization stage, the dependency set S after the final analysis and the temporary array D after the original relation sequence function is extracted are initialized to empty; then the algorithm will perform preliminary type judgment on the original function trace projection sequence extracted by the dynamic binary instrumentation tool, and store the corresponding function and pointer data information in the temporary array D. Then, for any two representative functions F in D, α With F γ If the production data of its data source matches the consumption data type and meets the judgment conditions for the data dependency in the definition, it will be stored in the data dependency set S after the final parsing is completed, providing relevant dependency data information for further fuzz test driven reconstruction.
[0053] In the call relationship recovery and reconstruction phase, the trace is searched for function calls related to the fuzz target. This patent puts the call function sequence into the fuzz test driver framework, which is a series of simple API calls; then the trace is analyzed to infer the prototype of each function in the call sequence; the trace contains detailed information about the API between the main binary file and the library, such as parameters and return values, and a simple test is performed on the fuzz test driver after recovery and reconstruction.
[0054] Compared with the manually written driver (Manually), the fuzzy test driver (DriverGen) generated by the method of the present invention can cover more blocks than the manually written driver, such as Figure 3 , Figure 4 As shown, Figure 3 IranView, Acrobat, Format Factory and Xvideo are commonly used image analysis, document rendering, format conversion and video playback software on Windows platform. Figure 3(a), (b), (c), and (d) respectively show the changes in the number of basic blocks covered by IranView, Acrobat, Format Factory, and Xvideo during the fuzz testing process. Figure 4 In the figure, a and b refer to the number of crashes generated by IrfanView and Format Factory in a specific time, respectively. This is because the coverage of the fuzz test driver corresponding to each application has a theoretical upper limit: the manually written driver is limited by incomplete information acquisition and low level of called function relationship, and cannot cover many basic blocks; while the driver generated by the method of the present invention takes into account the dependent nested relationship between functions when extracting trajectory information, and gives priority to function calls with high levels and more behavioral characteristics, which can cover more basic blocks after running for a period of time; and the number of function call relationships contained in the generated fuzz test driver is much larger than that of manually written ones. The method of the present invention discovers clearer dependency relationships and expands the search space of program paths. Compared with the manually written test driver, it contains more function calls, which means that more basic blocks, loops and calls can be reached during the fuzz testing process, and the probability of discovering vulnerabilities is correspondingly increased.
[0055] Based on the above embodiments, the present invention further proposes a fuzzy testing device for bypassing a Windows program graphical interface, comprising:
[0056] The trace extraction module is used to track the execution path of the user graphical interface application to be analyzed through the dynamic binary instrumentation tool, extract and record the thread ID, function caller, call address, symbols and parameters during the execution process, so as to obtain the original function trace projection sequence;
[0057] The dynamic function relationship extraction module is used to extract the pointer type and data dependency relationship based on the original function trajectory projection sequence using the dynamic trajectory function call relationship extraction algorithm;
[0058] The static analysis module is used to analyze the original function trajectory projection sequence processed by the dynamic trajectory function call extraction module in combination with the static analysis tool, and to infer and reconstruct the function prototype in the sequence;
[0059] The fuzz test driver framework filling module is used to fill the content of the fuzz test driver framework through the reconstructed function information and sequence order;
[0060] The fuzz test driver synthesis module is used to synthesize the fuzz test driver and test whether it runs normally, and finally generate a fuzz test driver that meets the actual requirements for vulnerability mining.
[0061] Furthermore, the dynamic binary instrumentation tool is DynamoRIO.
[0062] Furthermore, the dynamic function relationship extraction module is specifically used for:
[0063] A preliminary type judgment is performed on the original function trajectory projection sequence extracted by the dynamic binary instrumentation tool, and the corresponding function and pointer data information are stored in the temporary array D; then, for any two representative functions F in D, α With F γ , if its production data source matches the consumption data source type and satisfies (F α .in∩F γ .out)∪(F γ .in∩F α .out)≠0, it is stored in the data dependency set S after the final parsing is completed; where F α .in represents function F α The input, i.e. the consumption data source, F γ .out represents function F α The output, i.e. the production data source, F γ .in represents function F γ The input, i.e. the consumption data source, F α .out represents function F γ The output of, that is, the production data source.
[0064] In summary, the present invention is different from the traditional fuzz test driver automatic generation technology. It proposes the concept of using dynamic trajectory function call relationship extraction, uses the control flow and data flow extracted by the binary plugging tool, collects dependency information and uses it to restore and rebuild the call relationship, and finally generates a driver that can run without relying on the user graphical interface for fuzz testing, solving the problem that the user graphical interface hinders the fuzz testing process. Compared with manually written drivers, the present invention has significantly improved its target coverage and the number of crash discoveries, and has discovered new undisclosed vulnerabilities, and has good applicability.
[0065] The above is only a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A fuzz testing method for bypassing Windows program graphical interface, characterized in that: include: Step 1: For the graphical user interface application to be analyzed, the execution path of the application is tracked by the dynamic binary instrumentation tool, and the thread ID, function caller, call address, symbol and parameters of the execution process are extracted and recorded to obtain the original function trajectory projection sequence; Step 2: According to the original function trajectory projection sequence, the dynamic trajectory function call relationship extraction algorithm is used to extract the pointer type and data dependency relationship; Step 3: Analyze the original function trajectory projection sequence processed in step 2 with the help of static analysis tools, and infer and reconstruct the function prototype in the sequence; Step 4: Fill the content of the fuzz test driver framework with the reconstructed function information and sequence order; Step 5: Synthesize the fuzz test driver and test whether it runs normally, and finally generate a fuzz test driver that meets the actual requirements for vulnerability mining; The step 2 comprises: A preliminary type judgment is performed on the original function trajectory projection sequence extracted by the dynamic binary instrumentation tool, and the corresponding function and pointer data information are stored in the temporary array D; then, for any two representative functions F in D, α With F γ , if its production data source matches the consumption data source type and satisfies (F α .in∩F γ .out)∪(F γ .in∩F α .out)≠0, it is stored in the data dependency set S after the final parsing is completed; where F α .in represents function F α The input, i.e. the consumption data source, F γ .out represents function F α The output, i.e. the production data source, F γ .in represents function F γ The input, i.e. the consumption data source, F α .out represents function F γ The output of, that is, the production data source.
2. A fuzz testing method for bypassing Windows program graphical interface according to claim 1, characterized in that: The dynamic binary instrumentation tool is DynamoRIO.
3. A fuzzy testing device for bypassing Windows program graphical interface, characterized in that: include: The trace extraction module is used to track the execution path of the graphical user interface application to be analyzed through the dynamic binary instrumentation tool, extract and record the thread ID, function caller, call address, symbol and parameters during the execution process, so as to obtain the original function trace projection sequence; The dynamic function relationship extraction module is used to extract the pointer type and data dependency relationship based on the original function trajectory projection sequence using the dynamic trajectory function call relationship extraction algorithm; The static analysis module is used to analyze the original function trajectory projection sequence processed by the dynamic trajectory function call extraction module in combination with the static analysis tool, and to infer and reconstruct the function prototype in the sequence; The fuzz test driver framework filling module is used to fill the content of the fuzz test driver framework through the reconstructed function information and sequence order; The fuzz test driver synthesis module is used to synthesize the fuzz test driver and test whether it is running normally, and finally generate a fuzz test driver that meets the actual requirements for vulnerability mining; The dynamic function relationship extraction module is specifically used for: A preliminary type judgment is performed on the original function trajectory projection sequence extracted by the dynamic binary instrumentation tool, and the corresponding function and pointer data information are stored in the temporary array D; then, for any two representative functions F in D, α With F γ , if its production data source matches the consumption data source type and satisfies (F α .in∩F γ .out)∪(F γ .in∩F α .out)≠0, it is stored in the data dependency set S after the final parsing is completed; where F α .in represents function F α The input, i.e. the consumption data source, F γ .out represents function F α The output, i.e. the production data source, F γ .in represents function F γ The input, i.e. the consumption data source, F α .out represents function F γ The output of, that is, the production data source.
4. A fuzzy testing device for bypassing Windows program graphical interface according to claim 3, characterized in that: The dynamic binary instrumentation tool is DynamoRIO.
