Multi-fuzzer embedded software fuzzing test method based on source code perception
Through a source code-aware multi-fuzzer embedded software fuzz testing method, source code static analysis and symbolic execution technology are used to establish a memory mapped I/O access model, design multiple fuzzers, optimize test inputs, and solve the redundant problems in the existing technology. It implements efficient embedded software fuzz testing and improves vulnerability discovery capabilities.
Patent Information
- Application Number
- CN202410837155.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-10-15
AI Technical Summary
Existing embedded software fuzz testing methods use random input methods, which are prone to produce a large number of redundant and invalid inputs, lack efficient testing methods, and affect security and normal production operations.
Adopt a multi-fuzzer embedded software fuzz testing method based on source code awareness, establish a memory mapped I/O access model through source code static analysis and symbolic execution technology, design a data fuzzer and an execution sequence fuzzer, and generate data for different peripherals and inputs Type of fuzzy data that dynamically updates the coverage bitmap to optimize test input.
It achieves more efficient embedded software fuzz testing, enhances the effectiveness and coverage of test cases, improves the ability to discover potential vulnerabilities, and improves the relevance and effectiveness of testing.
Smart Images

Figure HDA0004913490910000011 
Figure HDA0004913490910000012
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of embedded software fuzz testing, and in particular relates to a multi-fuzzer embedded software fuzz testing method based on source code perception. Background Art
[0002] Embedded software plays a key role in today's society and is widely used in automobiles, medical devices, smart homes, industrial control systems and other fields. However, due to the tight development cycle and large software scale, embedded software may have various potential vulnerabilities and security risks, which directly affect people's life safety and the normal operation of production. Fuzz testing, as an automated software testing technology, has been widely used to discover vulnerabilities and security issues in embedded software, but its random input method is prone to generate a large number of redundant and invalid inputs. At present, there is a lack of efficient embedded software fuzz testing methods. Summary of the invention
[0003] In order to overcome the shortcomings of the prior art, the present invention provides a source code-aware multi-fuzzer embedded software fuzz testing method, which can make full use of source code information and design multiple fuzzers according to the test object type, efficiently generate test cases for embedded software fuzz testing, and realize an efficient embedded software fuzz testing method.
[0004] The above object of the present invention is achieved through the following technical solution: a multi-fuzzer embedded software fuzz testing method based on source code perception, the steps comprising:
[0005] 1. Establish a mapping relationship with the executable code through the source code compilation process, determine the specific location of all "memory mapped I / O (MMIO)" accesses, and model the MMIO access model to prepare the basis for subsequent test input.
[0006] 2. Execute the software under test, i.e. the modeling in step 1, in the simulator. If MMIO access is encountered during the execution, the system will select input data from the corresponding fuzzifier according to the specific type of access, translate the original input into input that conforms to the model according to the model, and hand it over to the simulator for execution. At this stage, set up multiple fuzzifiers to generate fuzzy data for different peripherals and input types.
[0007] 3. The results of step 2 are fed back to the fuzzer, and the coverage bitmap of the fuzzer is updated based on the feedback information. This process is dynamic, and the input generation is optimized by continuously updating the coverage bitmap to reveal more potential errors and vulnerabilities.
[0008] 4. Repeat steps 2 and 3 to continuously optimize and adjust the fuzz testing strategy to achieve more efficient embedded software fuzz testing.
[0009] Furthermore, the step 1 is specifically as follows:
[0010] 1.1. Perform static analysis of the source code to identify all MMIO-related access points. This step includes scanning the source code, marking all code lines and function calls that directly or indirectly interact with MMIO, and ensuring that each access point is accurately recorded.
[0011] 1.2. For each identified MMIO access point, a detailed context model is constructed. This includes recording the specific location of the access point, the MMIO address, the MMIO access size, and the associated code environment. The purpose of this model is to capture the different logical paths and conditions that the access point may follow when executing, providing the necessary context for subsequent symbolic execution.
[0012] 1.3. Use symbolic execution technology to explore different execution paths. Symbolic execution will use the MMIO access context model established in step 1.2 to simulate the program execution path under various input conditions to build an accurate access model.
[0013] Furthermore, the access model categories described in step 1.3 include data models, configuration models, and branch decision models.
[0014] The data model is suitable for situations where the values assigned to hardware generation are not considered to affect the firmware state. In this model, MMIO accesses are treated as regular memory accesses and do not involve any modification to the hardware state or operation.
[0015] The configuration model is for MMIO accesses that use specific constants as part of the comparison. This model emphasizes the firmware's reliance on hardware-generated values, using specific constants as part of the comparison to ensure smooth execution.
[0016] The branch decision model is applicable to situations where the value generated by the hardware is compared with different predefined values to determine the control flow. The original input of the fuzz test will be interpreted in this model as a choice among different options for each individual access. Further, the category impression is a representative sample of the training data obtained by the memory of the mining model, which is used to simulate the actual data sample of the underlying distribution.
[0017] Furthermore, the multiple fuzzifiers established in step 2 include a data fuzzifier and an execution sequence fuzzifier.
[0018] Data fuzzers are used to process peripherals that require a large amount of data input. They selectively generate data that may cause boundary condition errors during data generation and mutation, such as array out-of-bounds and values exceeding their representation range.
[0019] The execution sequence fuzzer focuses on generating inputs that directly affect the program execution path, especially those involving the peripheral ready status bits. This includes changing the value of the waiting peripheral ready status bit to test the software's reaction and processing capabilities to these state changes, ensuring that the software can correctly handle these state changes and execute the corresponding logic when receiving various different state signals.
[0020] The beneficial effects of the present invention compared with the prior art are:
[0021] This application uses a source code-aware method to accurately model peripheral access and software behavior. By using the information in the source code, it is possible to guide fuzz testing to find more practical test cases, thereby enhancing the effectiveness of fuzz testing.
[0022] Through the design of multiple fuzzers, this application can use specialized fuzzers to mutate different types of objects, effectively improving the relevance and effectiveness of test inputs, thereby expanding the coverage of tests and improving the ability to discover potential software vulnerabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0024] Figure 1 This is a flow chart of the source code-aware multi-fuzzer embedded software fuzz testing method;
[0025] Figure 2 This is a flow chart of the source code perception method. DETAILED DESCRIPTION
[0026] The present invention is described in detail below by specific examples, but the protection scope of the present invention is not limited. Unless otherwise specified, the experimental methods used in the present invention are all conventional methods, and the experimental equipment, materials, reagents, etc. used can be obtained from commercial channels.
[0027] Example 1
[0028] A source code-aware multi-fuzzer embedded software fuzz testing method, such as Figure 1 The detailed implementation steps are as follows:
[0029] S1, compile the source code and form a mapping relationship between the source code and the executable code, then scan the executable file to obtain the locations of all MMIO accesses and model their access patterns. The specific process is as follows Figure 2As shown, the system first compiles the source code and chooses to retain the debugging information, disassembles the executable file with debugging information to generate an assembly file with source code annotations for mapping, and then configures the MMIO address area and determines its access context based on the mapping information, then uses symbolic execution technology within the context to explore the constraint set, and then establishes the access model based on the constraint set.
[0030] S2, the embedded software under test will be executed in the simulator, and the interrupt control in the simulation is controlled by the interrupt management. During the execution of the software, once an MMIO access is encountered, the system selects the corresponding fuzzer input according to the access type, and converts the original input into the input of the adaptation model according to the preset model, and then inputs it into the simulator for processing. The new coverage information generated by the simulator is then used to update the coverage bitmap of the fuzzer to optimize the subsequent test input generation.
[0031] S3, in order to effectively generate various test inputs, multiple fuzzers are configured to collaboratively generate fuzzy data. For example, the data fuzzer can select data that is more likely to generate array out-of-bounds and value-exceeding-range type errors for mutation during the mutation process. In addition, for inputs that directly affect the program execution path, such as the status bit of waiting for peripherals to be ready, the execution sequence fuzzer is used to process such inputs.
[0032] The foregoing description of specific exemplary embodiments of the present invention is for the purpose of illustration and demonstration. These descriptions are not intended to limit the present invention to the precise form disclosed, and it is clear that many changes and variations can be made based on the above teachings. The purpose of selecting and describing the exemplary embodiments is to explain the specific principles of the present invention and its practical application, so that those skilled in the art can realize and utilize various different exemplary embodiments of the present invention and various different selections and changes. The scope of the present invention is intended to be limited by the claims and their equivalents.
Claims
1. A source code-aware multi-fuzzer embedded software fuzz testing method, It is characterized in that the steps include: S1. Establish a mapping relationship with the executable code through the source code compilation process, determine the specific location of all MMIO accesses, and model the MMIO access model to prepare the basis for subsequent test input; S2. Execute the tested software, i.e., the modeling in step S1, in the simulator. If MMIO access is encountered during the execution, the system will select input data from the corresponding fuzzifier according to the specific type of access, translate the original input into input that conforms to the model according to the model, and hand it over to the simulator for execution. In this stage, multiple fuzzifiers are set up to generate fuzzy data for different peripherals and input types. S3. The results of step S2 are fed back to the fuzzer, and the coverage bitmap of the fuzzer is updated based on the feedback information. This process is dynamic, and the input generation is optimized by continuously updating the coverage bitmap to reveal more potential errors and vulnerabilities; S4. Repeat steps S2 and S3 to continuously optimize and adjust the fuzz testing strategy to achieve more efficient embedded software fuzz testing.
2. The multi-fuzzer embedded software fuzz testing method based on source code perception according to claim 1, It is characterized in that The step S1 is specifically as follows: S1.
1. Perform static analysis of the source code to identify all MMIO-related access points. This step includes scanning the source code and identifying all code lines and function calls that directly or indirectly interact with MMIO, ensuring that each access point is accurately recorded. S1.
2. For each identified MMIO access point, a detailed context model is constructed, which includes recording the specific location of the access point, the MMIO address, the MMIO access size, and the related code environment. The purpose of this model is to capture the different logical paths and conditions that the access point may follow when executing, and provide the necessary context for subsequent symbolic execution; S1.
3. Use symbolic execution technology to explore different execution paths. Symbolic execution will use the MMIO access context model established in step S1.2 to simulate the program execution path under various input conditions to build an accurate access model.
3. The multi-fuzzer embedded software fuzz testing method based on source code perception according to claim 2, It is characterized in that The access model categories described in step 1.3 include data models, configuration models, and branch decision models.
4. The multi-fuzzer embedded software fuzz testing method based on source code perception according to claim 1, It is characterized in that The multiple fuzzers established in step 2 include a data fuzzer and an execution sequence fuzzer.
