Firmware anomaly detection method, system, equipment and medium
By constructing abnormal data and gray box fuzz testing, combined with code coverage and design dissatisfaction numbers, the firmware abnormal location is automatically located, solving the problems of interactive logic anomalies and low detection efficiency in firmware detection, and improving detection accuracy and efficiency.
Patent Information
- Application Number
- CN202410927385.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-10-01
AI Technical Summary
Existing technology cannot fully cover firmware interaction logic anomalies and has low detection efficiency, resulting in insufficient firmware anomaly detection accuracy and efficiency, and increasing repair costs and risks.
By constructing abnormal data, perform gray box fuzz testing, combine code coverage and design dissatisfaction numbers, calculate impact values, automatically locate abnormal locations, and improve detection efficiency and accuracy.
It achieves comprehensive verification of the reliability of the interaction between BMC and BIOS, ensures the adequacy of abnormal scenario testing, reduces labor costs, and improves the accuracy and rigor of detection.
Smart Images

Figure CN118733470A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a firmware anomaly detection method, system, device and medium. Background Art
[0002] As a critical information infrastructure, the interactive reliability of the core system firmware of the server is crucial. Firmware is a key part of server startup and is responsible for the underlying code of the hardware and operating system. The interactive reliability of the firmware directly affects the reliability of the server's power on and off, after entering the operation stage, and the long-term operation availability index. In the firmware anomaly detection method of the related technology, black box testing focuses on the functional requirements of the test software. The interaction between BMC (Baseboard Management Controller) and BIOS (Basic Input / Output System) is mainly covered indirectly through the stability of power on and off. For the interactive API (Application Programming Interface) command unit test, it is usually used to verify the basic functions and correctness of the code module. However, if only the test of normal functions is focused on, then when the code module encounters an abnormal situation, its behavior may be unknown or uncontrolled, that is, the related technology cannot cover all interactive scenarios and abnormal situations. In addition, the firmware anomaly detection method of the related technology requires testers to manually write test cases, observe system behavior and analyze results, which is labor-intensive and error-prone, resulting in delayed discovery of vulnerabilities and abnormal problems, and increasing the cost and risk of repair.
[0003] Therefore, there is an urgent need to propose a firmware anomaly detection method, system, device and medium to overcome the above-mentioned defects in order to improve the accuracy and efficiency of firmware anomaly detection. Summary of the invention
[0004] In view of this, the present invention proposes a firmware anomaly detection method, system, computer device and computer-readable medium, which solve the problems of inability to cover interactive logic anomalies and low detection efficiency in the firmware anomaly detection process, release the productivity of testers, and improve the efficiency and accuracy of firmware anomaly detection.
[0005] Based on the above purpose, an embodiment of the present invention provides a firmware anomaly detection method, which specifically includes the following steps: Construct abnormal data based on all preset interaction scenarios of the firmware under test; Testing the firmware under test based on the abnormal data to obtain the number of test failures, code coverage, and the number of design dissatisfactions corresponding to each preset interaction scenario; Determining an impact value according to the number of test failures, the code coverage, and the number of each design failure; Based on the impact value, an abnormal position of the tested firmware is located.
[0006] In some implementations, the step of determining the impact value according to the number of test failures, the code coverage, and the number of each design non-satisfaction includes: According to each of the preset interaction scenarios, determine a weight factor corresponding to the number of unsatisfied designs; The impact value is calculated based on a preset model, the number of test failures, the code coverage, the number of design failures, and the corresponding weight factors. The expression of the preset model is: ; Wherein, i represents the scene identifier of the preset interaction scene.
[0007] In some implementations, the step of constructing abnormal data according to all preset interaction scenarios of the tested firmware includes: Obtaining a target file of the tested firmware, and building a corpus based on the target file, wherein the target file includes an image file, a configuration file, a log file, and a background process file of the tested firmware; Setting a mutation strategy corresponding to each of the preset interaction scenarios; Based on the corpus and the mutation strategy, a number of test cases are determined, and each of the test cases is used as an abnormal data.
[0008] In some implementations, the step of testing the firmware under test based on the abnormal data to obtain the number of test failures, code coverage, and the number of design non-satisfactions corresponding to each preset interaction scenario includes: Inputting the abnormal data into a preset program to test the firmware under test; Collecting code coverage in the preset program; In response to detecting the end of the test, a first number corresponding to the abnormal data of the test failure is obtained, and the first number is used as the test failure number; a second number corresponding to the abnormal data whose test results do not reach the preset target in each of the preset interaction scenarios is obtained, and the second number is used as the design dissatisfaction number.
[0009] In some implementations, the firmware anomaly detection method further includes: Determine whether the code coverage reaches a preset target coverage; If the code coverage rate does not reach the preset target coverage rate, the abnormal data is deleted, and after adjusting the mutation strategy, the step of constructing abnormal data according to all preset interaction scenarios is returned until the code coverage rate reaches the preset target coverage rate.
[0010] In some implementations, the step of locating the abnormal position of the tested firmware based on the impact value includes: Evaluating the reliability level of the tested firmware based on the impact value, and determining whether the reliability level is higher than a threshold; If the reliability level is not higher than the threshold, obtaining the target preset interaction scenario in which the design does not meet the number that is not zero, and obtaining the test failure log information corresponding to the test failure number; The abnormal location is determined according to the target preset interaction scenario and the log information.
[0011] In some embodiments, the method further includes: setting a different first weight for each of the preset interaction scenarios according to the influence degree corresponding to each of the preset interaction scenarios; The step of determining the weight factor corresponding to each of the design non-satisfaction numbers according to each of the preset interaction scenarios includes: determining the weight factor of the design non-satisfaction number corresponding to each of the preset interaction scenarios according to each of the first weights.
[0012] Another aspect of the embodiment of the present invention further provides a firmware anomaly detection system, which specifically includes: A construction unit configured to construct abnormal data according to all preset interaction scenarios of the firmware under test; A testing unit configured to test the firmware under test based on the abnormal data to obtain the number of test failures, code coverage, and the number of design dissatisfactions corresponding to each preset interaction scenario; A determination unit configured to determine an impact value according to the number of test failures, the code coverage, and the number of each design non-satisfaction; A positioning unit is configured to locate the abnormal position of the tested firmware based on the impact value.
[0013] According to another aspect of an embodiment of the present invention, a computer device is provided, comprising: at least one processor; and a memory, wherein the memory stores a computer program executable on the processor, and the computer program implements the steps of the above method when executed by the processor.
[0014] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, which stores a computer program that implements the above method steps when executed by a processor.
[0015] The present invention has at least the following beneficial technical effects: The firmware anomaly detection method of the present invention completes the verification of the interaction reliability between BMC and BIOS through automated gray box fuzz testing, ensures the adequacy of the abnormal interaction scenario test by constructing a test case set including complete abnormal data, designs an automated testing process to improve the testing efficiency, performs a composite comprehensive evaluation on the code coverage rate in combination with the number of test failures and the number of design non-satisfactions corresponding to each preset interaction scenario, forms a preset model, and finally gives an impact value representing the reliability of the tested firmware interaction, solves the problem that the interaction logic anomaly cannot be covered and the firmware interaction reliability evaluation is missing in the firmware detection process of the related art, and ensures the accuracy and rigor of the evaluation through a multi-dimensional preset model. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A block diagram of an embodiment of a firmware anomaly detection method provided by the present invention; Figure 2 A schematic diagram of a flow chart of an embodiment of evaluating firmware reliability provided by the present invention; Figure 3 A schematic diagram of an embodiment of a post-test interface provided by the present invention; Figure 4 A schematic diagram of an embodiment of the overall test progress and results provided by the present invention; Figure 5 A schematic diagram of an embodiment of the statistical display of the code coverage intermediate execution process provided by the present invention; Figure 6 A schematic diagram of an embodiment of a firmware anomaly detection system provided by the present invention; Figure 7 A schematic diagram of the structure of an embodiment of a computer device provided by the present invention; Figure 8 A schematic diagram of the structure of an embodiment of a computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION
[0018] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0019] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. The subsequent embodiments will not explain this one by one.
[0020] As the core system firmware of the server, BIOS is responsible for hardware initialization, self-test, boot sequence setting and power management. It provides a low-level interactive interface with hardware devices to ensure the normal startup and operation of the server. BMC is the external management system of the server, responsible for monitoring, managing and controlling various hardware and system functions of the server, such as remote management, fault diagnosis, power control and sensor monitoring. BMC is closely integrated with BIOS, and the reliability of the interaction between the two is crucial in the server, which directly affects the reliability of the server's start-up and shutdown and after entering the operation stage and the long-term operation availability indicators.
[0021] At present, the interaction test between BMC and BIOS mainly focuses on the functional aspects, covering the functional implementation of normal scenarios. In the related art, the interaction between BMC and BIOS is mainly covered indirectly through the stability of server power on and off, and the interactive API command unit test is also mainly for the test of normal functions. From the code coverage point of view, the code coverage for abnormal scenarios is low, lacking a complete test for abnormal interaction scenarios, and unable to fully evaluate the reliability of the interaction between BMC and BIOS. At the same time, most of the related art evaluates the availability of hardware configuration and board design, lacking a dedicated evaluation of the availability of server firmware. At present, the evaluation of firmware availability is mainly through static code scanning and identifying defects in code design, but static code scanning has its limitations, especially when it faces complex interactive logic, static scanning may not be able to find logical errors or anomalies triggered by specific interactive conditions, and often can only find potential vulnerabilities and problems in the production environment. The delay in the discovery of vulnerabilities and problems leads to increased costs and risks of repair.
[0022] In order to solve the above defects, the first aspect of the embodiments of the present invention provides an embodiment of a firmware abnormality detection method. Figure 1 As shown, it includes the following steps: Step S100, constructing abnormal data according to all preset interaction scenarios of the firmware under test; Step S200, testing the firmware under test based on the abnormal data to obtain the number of test failures, code coverage, and the number of design dissatisfactions corresponding to each preset interaction scenario; Step S300, determining the impact value according to the number of test failures, code coverage and the number of design failures; Step S400: locating the abnormal position of the tested firmware based on the impact value.
[0023] In some embodiments, the firmware under test is BMC and BIOS. The test in the present invention refers to gray box fuzz testing, which combines white box testing and black box testing. Gray box fuzz testing triggers potential vulnerabilities or abnormal behaviors by inputting random, invalid or abnormal data into the target program. The interaction between BMC and BIOS is to realize information transmission including reading data, writing data or adding and deleting data through various API interfaces. The interaction scenarios between BMC and BIOS include asset information, status monitoring and remote management, etc. The interaction between BMC and BIOS runs through the server's boot process and operation stage. Code coverage is an indicator to measure whether the test is comprehensive, which indicates the proportion of the code being executed in the tested code. If the code coverage of the abnormal scenario is low, it means that the test lacks the processing and verification of abnormal situations, which may cause the system to behave unstable or unpredictably when encountering problems in actual use. Based on the interactive API list and the input and output parameter list between BMC and BIOS, the present invention constructs abnormal data that can traverse all APIs through gray box fuzz testing, and triggers abnormal scenarios through abnormal data. In interactive APIs, in addition to basic functional testing, it is also necessary to test the system's response under different conditions, especially when abnormal scenarios such as errors, network failures, timeouts, data corruption, etc. occur. If these abnormal scenarios are not fully tested, the reliability and availability of the system may be affected.
[0024] In some embodiments, Figure 2A flowchart of an embodiment of the firmware reliability evaluation provided by the present invention. First, it is necessary to understand the interaction interfaces, commands and corresponding interaction scenarios of BMC and BIOS, create a checklist containing all interaction interfaces, commands and interaction scenarios, assign a unique identifier (ID) to each interface and command in the checklist, determine the required number of interactions and parameters for each interface and command, and provide a basis for the subsequent construction of abnormal data. The interaction scenarios corresponding to each interface and command are shown in Table 1, wherein the specific number of interactions and parameters are configured according to a separate interaction specification definition document, and are not specifically limited in Table 1. The FRU (Field Replace Unit) information in Table 1 records the serial number, server model, motherboard model and asset number of the server. BIOS option settings include system time, date, language, hardware configuration, boot sequence, security settings or power management, etc. The standard information of BMC includes server self-test information and BMC version information. The WDT (Watch Dog Timer) timer setting is used to prevent the program from having dead loops and other phenomena. When the program cannot work normally as expected, the WDT timer can force the system to reset, thereby restoring the normal operation of the system. PCIe (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard) is mainly used to expand the data throughput of the computer system bus and improve the communication speed of devices. The CPU (Central Processing Unit) is responsible for performing various arithmetic and logical operations, controlling other hardware devices, and processing data. The basic structure of the CPU includes the control unit (CU), arithmetic logic unit (ALU), and register files.
[0025] Table 1
[0026] In some embodiments, the interaction scenarios in Table 1 (i.e., preset interaction scenarios) are assigned different first weights according to the degree of influence. Taking the highest weight value of 5 as an example, core asset information, startup configuration information, start-stop configuration information, sensor information, power control information, power on / off status, and monitoring information are critical information in the interaction between BMC and BIOS. The interaction scenarios corresponding to these critical information have a greater degree of influence, and the value of their first weight is set to 5. Time configuration information, user information, and non-core asset information are generally important information in the interaction between BMC and BIOS. The interaction scenarios corresponding to these generally important information have a medium degree of influence, and the value of their first weight is set to 3. Display information, general log information, and customized information are relatively unimportant information in the interaction between BMC and BIOS. The interaction scenarios corresponding to these relatively unimportant information have a smaller degree of influence, and the value of their first weight is set to 1.
[0027] In some embodiments, the interface or command under the preset interaction scenario is used as the test target, and the number of samples of the test target is determined according to the gray box fuzz testing process to build a corpus. The corpus should include various types of files to cover different aspects of BMC and BIOS. In one example, the associated files such as BMC and BIOS image files, configuration files, log files and background processes are collected and organized into a corpus. Image files and configuration files can store multiple versions and configuration options of BMC and BIOS to generate different test scenarios during the gray box fuzz testing process. The log file will collect samples of different error and event types to simulate various possible abnormal behaviors during the test process.
[0028] In some embodiments, the mutation strategy is determined in combination with the interaction scenarios of the interface and commands between the BMC and the BIOS. On the basis of building a corpus, a fuzz testing tool or a custom script is used to generate fuzzy test data (i.e., abnormal data). These fuzzy test data are based on the mutated version of the original data in the corpus, and are intended to trigger potential errors or vulnerabilities in the BMC and BIOS. For firmware images and configuration files, mutation strategies can be used to generate abnormal data that does not meet the specifications. For log files, error events or abnormal behaviors can be simulated to generate abnormal data. The mutation strategies used in AFL are divided into deterministic strategies and random strategies. Deterministic strategies include bit flipping, mutation through calculation, file replacement, token replacement, etc. Random strategies include flipping through random algorithms, random numbers, random parameter lengths, randomly generated content, etc. In one example, mutation strategies can include the following three categories: (1) Bit flipping, empty parameters, parameter variable mutation, parameter length mutation, and parameter type mutation; (2) Customize the AFL (American Fuzzy Lop, a fuzz testing tool) code to construct mutation strategies. When the standard AFL mutation strategy is not sufficient to cover all situations in a specific interaction scenario, the AFL code can be customized to construct specific mutations. (3) AFL mutation strategy. AFL itself provides a variety of mutation strategies, which can be used alone or in combination to generate diverse test cases.
[0029] In some embodiments, when performing gray box fuzz testing, the original file data in the corpus is input to AFL, and these files are placed in an input queue by AFL. AFL takes a file from the input queue and performs various mutation operations on it according to the mutation strategy, and provides the mutated file (i.e., mutation data) to BMC and BIOS for execution, so as to perform gray box fuzz testing on the interface or instruction of BMC and BIOS, and monitor the test results. The test results include the direct results of the test and the redundant function complexity evaluation results and reliability design complexity evaluation results obtained by automatic analysis based on the direct results. The direct results include the number of test failures, code coverage, and the number of design dissatisfactions corresponding to each preset interaction scenario. The number of test failures refers to the number of test case failures (i.e., the first number) caused by the failure of the tested firmware to correctly handle abnormal data during the gray box fuzz testing process. Code coverage is an important indicator for measuring the integrity of gray box fuzz testing, which indicates the proportion of the tested code executed during the test execution process. The number of design dissatisfactions refers to the number of problems (i.e., the second number) found during the mutation test process that fail to achieve the expected set goals due to design defects or deficiencies. These problems may include functional defects, performance bottlenecks, security vulnerabilities, etc. The interaction reliability impact value is calculated by using the overall evaluation weighted model (i.e., the preset model) combined with the direct test results. The larger the impact value, the lower the reliability. The impact value reflects the evaluation of the code's exception handling capability, redundant design, and the composite aspects of reliability design. When the firmware reliability is insufficient based on the impact value, the abnormal location is located and corresponding measures are taken to improve and optimize according to the interaction scenarios where the test cases fail and the interaction scenarios that the design does not meet, so as to improve the overall reliability of BMC and BIOS. The firmware anomaly detection method of the present invention completes the verification of the interaction reliability between BMC and BIOS through automated gray box fuzz testing, ensures the adequacy of the abnormal interaction scenario test by constructing a test case set including complete abnormal data, designs an automated testing process to improve the testing efficiency, performs a composite comprehensive evaluation on the code coverage rate in combination with the number of test failures and the number of design non-satisfactions corresponding to each preset interaction scenario, forms a preset model, and finally gives an impact value representing the reliability of the tested firmware interaction, solves the problem that the interaction logic anomalies cannot be covered and the firmware interaction reliability evaluation is missing in the firmware detection process of the related technology, ensures the accuracy and rigor of the evaluation through a multi-dimensional preset model, and effectively reduces the labor cost.
[0030] In some embodiments, the step of determining the impact value according to the number of test failures, code coverage, and the number of designs not satisfied includes: determining the weight factor corresponding to the number of designs not satisfied according to each preset interaction scenario; calculating the impact value based on a preset model, the number of test failures, code coverage, the number of designs not satisfied, and the corresponding weight factor, wherein the expression of the preset model is: ; Wherein, i represents the scene identifier (ID) of the preset interaction scene.
[0031] In some embodiments, the code coverage reflects the degree of testing. The lower the code coverage, the more it affects the reliability, making the impact value larger, reflecting an inverse proportional relationship. The weight factor has a greater impact on the redundant design, and the number of design non-satisfactions has a greater impact on the reliability. The positive proportional relationship reflects the abnormal robustness and reliability based on the overall code coverage. In one example, the evaluation criteria for evaluating the reliability level of the tested firmware based on the impact value can be: when the impact value is less than or equal to 30, the evaluated reliability level is a high reliability level, that is, the interaction between BMC and BIOS has high reliability; when the impact value is between 30-80, the evaluated reliability level is a general reliability level, that is, the reliability of the interaction between BMC and BIOS is relatively general; when the impact value is greater than or equal to 80, the evaluated reliability level is a low reliability level, that is, the reliability of the interaction between BMC and BIOS is low.
[0032] The firmware anomaly detection method of the present invention ensures the effectiveness and adequacy of the test through code coverage, combines the compliance assessment of redundant design and reliability design to form an evaluation algorithm, and gives an evaluation conclusion of the firmware interaction reliability based on the impact value, which makes up for the current lack of evaluation of firmware interaction reliability, and at the same time ensures the accuracy of the evaluation through a multi-dimensional evaluation algorithm.
[0033] In some embodiments, the step of constructing abnormal data according to all preset interaction scenarios of the firmware under test includes: obtaining a target file of the firmware under test, and constructing a corpus based on the target file, the target file including an image file, a configuration file, a log file, and a background process file of the firmware under test; setting a mutation strategy corresponding to each preset interaction scenario; and determining a number of test cases based on the corpus and the mutation strategy, and treating each test case as an abnormal data.
[0034] The firmware anomaly detection method of the present invention completes the verification of the reliability of the interaction between BMC and BIOS through automated gray box fuzz testing, ensures the adequacy of the abnormal scenario verification based on the completeness of the test case set, and improves the rigor and accuracy of the test evaluation.
[0035] In some embodiments, the steps of testing the firmware under test based on the abnormal data to obtain the number of test failures, code coverage, and the number of design dissatisfactions corresponding to each preset interaction scenario include: inputting the abnormal data into a preset program to test the firmware under test; collecting the code coverage in the preset program; in response to detecting the end of the test, obtaining a first number corresponding to the abnormal data of the test failure, using the first number as the number of test failures, obtaining a second number corresponding to the abnormal data whose test results under each preset interaction scenario do not reach the preset target, and using the second number as the number of design dissatisfactions. In one embodiment, the preset coverage tool can be integrated into the aforementioned preset program, so that when it is detected that the test is triggered, the code coverage in the preset program is collected based on the preset coverage tool.
[0036] In some embodiments, the firmware anomaly detection method of the present invention also includes: determining whether the code coverage reaches a preset target coverage; if the code coverage does not reach the preset target coverage, deleting the abnormal data, and adjusting the mutation strategy and returning to the step of constructing abnormal data according to all preset interaction scenarios until the code coverage reaches the preset target coverage.
[0037] In some embodiments, specific code, called "insertion stubs", is inserted when the BMC and BIOS source code are compiled. It is used to collect execution information during program execution to count code coverage. In actual testing, the LLVM (LowLevel Virtual Machine, a compiler) mode is used for insertion to improve the efficiency of fuzz testing. The code coverage statistics use the edge coverage of AFL. Edge refers to the jump between two basic blocks (Basic Block) in the program. By tracking the number of executions of these edges, AFL can identify which code paths have not been fully tested. The number of executions of statements and branches is also counted, because edge jumps are often associated with the execution of specific statements or branches. By combining LLVM insertion stubs with AFL, more fine-grained coverage statistics can be achieved. After the data preparation for the gray box fuzz test is completed, the automated gray box fuzz test is performed. Fuzzing (fuzz testing) is started by configuring the call to the AFL driver. After execution, the interface is displayed as follows Figure 3 shown. Figure 4 A schematic diagram of an embodiment of the overall test progress and results provided by the present invention. Figure 4 Here, Overall results refers to the overall evaluation progress and results, cycles done refers to the number of completed cycles, total paths refers to the total paths, uniq crashes refers to the number of crashes, and uniq hangs refers to the number of hangs. Figure 3 Other parts of the test include configuration parameters and execution strategies. Based on the actual test results, you can see the traversal of the BMC and BIOS interaction interfaces. Combined with the code coverage, you can see the coverage of interface-related codes. Figure 5 A schematic diagram of an embodiment of the statistical display of the intermediate execution process of the code coverage provided by the present invention, which automatically identifies the overall line coverage (code coverage) during testing to ensure that the code coverage meets the target coverage, for example, the code coverage meets 100%.
[0038] In some implementations, if a crash occurs during testing or a new execution path is discovered (through code coverage analysis), which improves code coverage, AFL will save the mutation data and add it to the input queue for subsequent mutations and continued testing until code coverage reaches 100%. If code coverage is not improved, the corpus will be automatically adjusted to delete abnormal data that does not improve coverage. It should be noted that not all code requires 100% coverage. Some code may be redundant, unreachable, or executed only under certain conditions. Therefore, a whitelist or blacklist can be set to exclude or include specific code segments.
[0039] The firmware anomaly detection method of the present invention can, after analyzing the code coverage data, write an algorithm to intelligently screen and delete seeds that do not improve coverage to obtain higher code coverage. It can also customize the AFL mutation strategy and dynamically adjust these mutation strategies through code coverage analysis to balance the variation range of test cases and test efficiency, achieve the effect of automated testing, improve test efficiency, and reduce manpower consumption.
[0040] In some embodiments, the step of locating the abnormal position of the tested firmware based on the impact value includes: evaluating the reliability level of the tested firmware based on the impact value, and determining whether the reliability level is higher than a threshold, for example, whether it is the highest reliability level; if the reliability level is not higher than the threshold, obtaining a target preset interaction scenario in which the design does not meet the number of non-zero values, and obtaining log information of test failures corresponding to the number of test failures; and determining the abnormal position according to the target preset interaction scenario and the log information.
[0041] The firmware anomaly detection method of the present invention can identify the abnormal position that specifically affects the reliability and identify the specific improvement points of the abnormal position according to the interaction scenarios where the test cases fail and the interaction scenarios that the designs do not meet when the reliability level is a general reliability level or a low reliability level, and plays a significant role in improving the overall reliability of the BMC and BIOS, and makes up for the lack of evaluation of the firmware interaction reliability.
[0042] In some embodiments, the method further includes: setting different first weights for each of the preset interaction scenarios according to the degree of influence corresponding to each of the preset interaction scenarios. The step of determining the weight factor corresponding to each number of design dissatisfactions according to each of the preset interaction scenarios includes: determining the weight factor of the number of design dissatisfactions corresponding to each of the preset interaction scenarios according to each of the first weights.
[0043] The firmware anomaly detection method of the present invention forms a preset model by combining code coverage with the number of test failures and the number of design non-satisfactions corresponding to each preset interaction scenario through a composite comprehensive evaluation, and assigns corresponding weights to different interaction scenarios to effectively balance the redundant design in the code and provide an accurate impact value.
[0044] In some embodiments, black box fuzz testing is used in related technologies, mainly targeting common protocols such as SSH (Secure Shell), HTTP (Hypertext Transfer Protocol), SNMP (Simple Network Management Protocol), TCP / IP (Transmission Control Protocol / Internet Protocol), and proprietary protocols such as IPMI (Intelligent Platform Management Interface) and PLDM (Platform Level Data Model, a communication protocol based on a standard data model) are rarely covered. In actual BMC and BIOS interaction, the main monitoring and management protocol specifications are IPMI and PLDM. Black box fuzz testing cannot find problems in a targeted manner, and the use of debugging tools at the R&D end cannot guarantee comprehensive coverage and more sufficient verification of abnormal scenarios. The present invention constructs IPMI / PLDM protocol interaction command calls for IPMI and PLDM to achieve targeted discovery and problem solving, and improve the comprehensiveness and accuracy of detection.
[0045] In some implementations, taking a certain model as an example, its redundancy design complexity and reliability design complexity are shown in Table 2, wherein the redundancy design complexity and reliability design complexity are derived from the evaluation of the gray box fuzzy test results.
[0046] Table 2
[0047] In some implementations, taking Table 2 as an example, assuming that the number of test failures is 16, the code coverage is 98%, and the number of design dissatisfactions is 11, the weight factors corresponding to the number of design dissatisfactions in Table 2 are determined, and the weight factors correspond to the first weights defined in the preset interaction scenarios in Table 1. The impact value calculated using the preset model is 65.3, which belongs to the general reliability level, and then the abnormal position that specifically affects the reliability is identified according to the interaction scenarios where the test cases fail and the interaction scenarios where the designs are not satisfied, and the specific improvement points of the abnormal position are identified for repair.
[0048] The firmware anomaly detection method of the present invention completes the verification of the interaction reliability between BMC and BIOS through automated gray box fuzz testing, ensures the adequacy of the abnormal interaction scenario test by constructing a test case set including complete abnormal data, designs an automated testing process to improve the testing efficiency, performs a composite comprehensive evaluation on the code coverage rate in combination with the number of test failures and the number of design non-satisfactions corresponding to each preset interaction scenario, forms a preset model, and finally gives an impact value representing the reliability of the tested firmware interaction, solves the problem that the interaction logic anomaly cannot be covered and the firmware interaction reliability evaluation is missing in the firmware detection process of the related art, and ensures the accuracy and rigor of the evaluation through a multi-dimensional preset model.
[0049] Based on the same inventive concept, according to another aspect of the present invention, Figure 6 As shown, an embodiment of the present invention further provides a firmware anomaly detection system, and the firmware anomaly detection system specifically includes: A construction unit 110, configured to construct abnormal data according to all preset interaction scenarios of the firmware under test; The testing unit 120 is configured to test the firmware under test based on the abnormal data to obtain the number of test failures, code coverage, and the number of design non-satisfactions corresponding to each preset interaction scenario; A determination unit 130, configured to determine an impact value according to the number of test failures, the code coverage, and the number of non-satisfactions of each design; The positioning unit 140 is configured to locate the abnormal position of the tested firmware based on the impact value.
[0050] The firmware anomaly detection system of the present invention completes the verification of the interaction reliability between BMC and BIOS through automated gray box fuzz testing, ensures the adequacy of the abnormal interaction scenario test by constructing a test case set including complete abnormal data, designs an automated testing process to improve the testing efficiency, performs a composite comprehensive evaluation on the code coverage rate in combination with the number of test failures and the number of design non-satisfactions corresponding to each preset interaction scenario, forms a preset model, and finally gives an impact value representing the reliability of the tested firmware interaction, solves the problem that the interaction logic anomaly cannot be covered and the firmware interaction reliability evaluation is missing in the firmware detection process of the related art, and ensures the accuracy and rigor of the evaluation through a multi-dimensional preset model.
[0051] Based on the same inventive concept, according to another aspect of the present invention, Figure 7 As shown, an embodiment of the present invention further provides a computer device 30, which includes a processor 310 and a memory 320. The memory 320 stores a computer program 321 that can be run on the processor. When the processor 310 executes the program, the steps of the above method are performed.
[0052] Based on the same inventive concept, according to another aspect of the present invention, Figure 8 As shown, an embodiment of the present invention further provides a computer-readable storage medium 40, which stores a computer program 410 for executing the above method when executed by a processor.
[0053] Finally, it should be noted that a person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium of the program can be a disk, an optical disk, a read-only storage memory (ROM) or a random access memory (RAM), etc. The above-mentioned computer program embodiments can achieve the same or similar effects as the corresponding above-mentioned any method embodiments.
[0054] It will also be appreciated by those skilled in the art that various exemplary logic blocks, modules, circuits and algorithm steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, a general description has been given to the functions of various schematic components, blocks, modules, circuits and steps. Whether this function is implemented as software or hardware depends on specific applications and the design constraints imposed on the entire system. Those skilled in the art can implement the function in various ways for each specific application, but this implementation decision should not be interpreted as causing a departure from the disclosed scope of the embodiments of the present invention.
[0055] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope of the embodiments disclosed in the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. The serial numbers of the embodiments disclosed in the above embodiments of the present invention are for description only and do not represent the advantages and disadvantages of the embodiments. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.
[0056] It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations including one or more of the associated listed items.
[0057] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the above embodiments of the present invention, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.
Claims
1. A firmware anomaly detection method, characterized in that: include: Construct abnormal data based on all preset interaction scenarios of the firmware under test; Testing the firmware under test based on the abnormal data to obtain the number of test failures, code coverage, and the number of design dissatisfactions corresponding to each preset interaction scenario; Determining an impact value according to the number of test failures, the code coverage, and the number of each design failure; Based on the impact value, an abnormal position of the tested firmware is located.
2. The firmware anomaly detection method according to claim 1, characterized in that: The step of determining the impact value according to the number of test failures, the code coverage and the number of each design non-satisfaction includes: According to each of the preset interaction scenarios, determine a weight factor corresponding to the number of unsatisfied designs; The impact value is calculated based on a preset model, the number of test failures, the code coverage, the number of design failures, and the corresponding weight factors. The expression of the preset model is: ; Wherein, i represents the scene identifier of the preset interaction scene.
3. The firmware anomaly detection method according to claim 1, characterized in that: The step of constructing abnormal data according to all preset interaction scenarios of the tested firmware includes: Obtaining a target file of the tested firmware, and building a corpus based on the target file, wherein the target file includes an image file, a configuration file, a log file, and a background process file of the tested firmware; Setting a mutation strategy corresponding to each of the preset interaction scenarios; Based on the corpus and the mutation strategy, a number of test cases are determined, and each of the test cases is used as an abnormal data.
4. The firmware anomaly detection method according to claim 1, characterized in that: The step of testing the firmware under test based on the abnormal data to obtain the number of test failures, code coverage, and the number of design non-satisfactions corresponding to each preset interaction scenario includes: Inputting the abnormal data into a preset program to test the firmware under test; Collecting code coverage in the preset program; In response to detecting the end of the test, a first number corresponding to the abnormal data of the test failure is obtained, and the first number is used as the test failure number, and a second number corresponding to the abnormal data whose test results do not reach the preset target in each of the preset interaction scenarios is obtained, and the second number is used as the design dissatisfaction number.
5. The firmware anomaly detection method according to claim 4, characterized in that: Also includes: Determine whether the code coverage reaches a preset target coverage; If the code coverage does not reach the preset target coverage, the abnormal data is deleted, and the mutation strategy is adjusted and the step of constructing abnormal data according to all preset interaction scenarios is returned until the code coverage reaches the preset target coverage.
6. The firmware anomaly detection method according to claim 1, characterized in that: The step of locating the abnormal position of the tested firmware based on the impact value includes: Evaluating the reliability level of the tested firmware based on the impact value, and determining whether the reliability level is higher than a threshold; If the reliability level is not higher than the threshold, obtaining the target preset interaction scenario in which the design does not meet the number that is not zero, and obtaining the test failure log information corresponding to the test failure number; The abnormal location is determined according to the target preset interaction scenario and the log information.
7. The firmware anomaly detection method according to claim 2, characterized in that: Also includes: According to the influence degree corresponding to each of the preset interaction scenarios, respectively set a different first weight for each of the preset interaction scenarios; The step of determining the weight factor corresponding to each of the design non-satisfaction numbers according to each of the preset interaction scenarios includes: determining the weight factor of the design non-satisfaction number corresponding to each of the preset interaction scenarios according to each of the first weights.
8. A firmware anomaly detection system, characterized in that: include: A construction unit configured to construct abnormal data according to all preset interaction scenarios of the firmware under test; A testing unit configured to test the firmware under test based on the abnormal data to obtain the number of test failures, code coverage, and the number of design dissatisfactions corresponding to each preset interaction scenario; A determination unit configured to determine an impact value according to the number of test failures, the code coverage, and the number of each design non-satisfaction; A positioning unit is configured to locate the abnormal position of the tested firmware based on the impact value.
9. A computer device comprising: at least one processor; as well as A memory storing a computer program executable on the processor, wherein the processor executes the steps of the method according to any one of claims 1 to 7 when executing the program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are performed.
