Protocol vulnerability analysis system and method based on state storage / recovery

By building an optimized DFA and using snapshot mechanism and difference analysis algorithm, efficient fuzz testing of closed source protocols in closed systems is achieved, and the problem of insufficient testing efficiency and accuracy in the existing technology is solved, and effective for closed systems is provided. Vulnerability analysis and identification capabilities.

CN119071083APending Publication Date: 2024-12-03SHANGHAI SATELLITE ENG INST

Patent Information

Application Number
CN202411372542.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

Existing fuzz testing tools cannot perform effective testing when facing closed source protocols in closed systems, and the testing efficiency and accuracy are insufficient, especially when the program running status information cannot be obtained.

Method used

Using a protocol vulnerability analysis method based on state saving/recovery, the protocol state is acquired and analyzed by building an optimized deterministic finite automata (DFA). Combining snapshot mechanism and differential analysis algorithm, it automatically identifies potential vulnerabilities and unstable behavior patterns. .

Benefits of technology

It improves the efficiency and accuracy of the fuzz testing of closed source protocols in closed systems, and can conduct in-depth analysis and identification of security vulnerabilities without relying on internal implementation of the protocol, providing effective testing and vulnerability discovery means for closed systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119071083A_ABST
    Figure CN119071083A_ABST
Patent Text Reader

Abstract

The invention provides a protocol vulnerability analysis method and system based on state storage / recovery. The method comprises the following steps: S1, acquiring a protocol state of a protocol with an unknown format; s2, when the protocol state coverage rate meets the preset requirement, the abnormal condition of the protocol is judged according to the state information; and S3, storing, recovering and automatically analyzing the protocol based on the state. According to the method, the efficiency and the accuracy of the fuzzy test are improved, and an effective technical means is provided for finding and repairing security problems in a protocol.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network security, and in particular to a protocol vulnerability analysis system and method based on state preservation / recovery. Background Art

[0002] Fuzz testing is a security testing technology and one of the most effective ways to discover software vulnerabilities. Fuzz testing automatically or semi-automatically generates random inputs according to certain rules and provides them to the test program, and monitors the abnormal behavior of the program to discover software vulnerabilities.

[0003] Fuzz testing usually uses the method of inserting stubs to insert code that reflects the execution status of the program into the program. For open source software, fuzz testing tools can insert stubs into the source code and compile it; for closed source software, the binary file can be disassembled and then inserted.

[0004] For closed-source protocols, it is necessary to detect and construct the protocol transition state, that is, the protocol state automaton. For closed systems where firmware extraction is not possible, it is impossible to obtain sufficient program information, so traditional fuzz testing cannot be effectively tested. It is necessary to use hardware support methods to obtain program running status information to guide fuzz testing.

[0005] Compared with the binary program fuzz testing method based on multi-population genetic algorithm proposed by Luo Senlin et al. in 2018 (CN201810233482.3), the test input generated is improved by evolution generation by generation by simulating the process of natural selection. Although this method can effectively improve the coverage of the program execution path, it will reduce the efficiency of input generation in the process of simulating natural selection; in 2020, Wang Pengfei et al. proposed a guided fuzz testing method for binary code (CN202010717878.2), which disassembles the binary code to obtain the assembly code and then constructs the program control flow graph. The principle of this method is simple and easy to implement, but it is slightly lacking in the effectiveness of fuzz testing; in 2020, Hu Changzhen et al. proposed a fuzz testing method and device based on minimum set coverage (CN202010790762.1), which uses deep neural networks to process target binary programs with structured or unstructured inputs. This method can obtain a smaller set of test cases and more effective test cases, but this method is not suitable for fuzz testing of closed source protocols of closed systems. The advantage of the present invention is that it adopts non-intrusive program operation information acquisition and analysis to realize fuzz testing of closed-source protocols of closed systems, thereby improving the effectiveness of fuzz testing of closed systems. In comparison, in 2018, Peng Chen et al. proposed an efficient fuzz testing tool Angora (Chen P, Chen H. Angora: Efficient fuzzing by principled search [C] / / 2018 IEEE Symposium on Security and Privacy (SP). IEEE, 2018: 711-725.), which was designed to effectively solve path constraints, but was not efficient in fuzz testing; in 2018, Shuitao Gan et al. proposed the CollAFL path-sensitive fuzz testing technology (Gan S, Zhang C, Qin X, et al. Collafl: Path sensitive fuzzing [C] / / 2018 IEEE Symposium on Security and Privacy (SP). IEEE, 2018: 679-696.), which was improved in code coverage and vulnerability discovery compared to AFL, but the fuzz testing efficiency still needs to be improved. The present invention adopts a state preservation / recovery protocol fuzz testing method to improve the efficiency of fuzz testing. Summary of the invention

[0006] In view of the defects in the prior art, the object of the present invention is to provide a protocol vulnerability analysis system and method based on state preservation / recovery.

[0007] A protocol vulnerability analysis method based on state preservation / recovery provided by the present invention includes:

[0008] Step S1: Obtaining the protocol status of the protocol with unknown format;

[0009] Step S2: When the protocol status coverage meets the preset requirements, the abnormal situation of the protocol is determined according to the status information;

[0010] Step S3: Save, restore and automatically analyze the state-based protocol.

[0011] Preferably, the step S1 comprises:

[0012] Use the optimized DFA to describe the protocol with unknown format and construct the state to obtain the protocol state;

[0013] The optimized DFA includes: adding resource consumption for each protocol state transition based on the DFA; when the protocol transitions from one state to another, consuming corresponding resources according to preset rules;

[0014] Certain states of the protocol will trigger corresponding operations, which are embedded in the corresponding state nodes. When the protocol is in a certain state, the check and update of the corresponding variables in the state node are triggered.

[0015] The transitions in DFA are called network transactions, which include data forwarding, resource consumption, and checking and updating of corresponding variables triggered by the protocol in certain states.

[0016] Preferably, step S2 comprises:

[0017] Step S2.1: compile the source code of the target program and collect the protocol state coverage by detecting the source code;

[0018] Step S2.2: When the protocol state coverage meets the preset requirements, the fuzzer is used to simulate the TCP / IP message exchange between the client and the server, and the state information of the protocol when processing each test case is recorded;

[0019] Step S2.3: Determine the abnormality of the protocol based on the status information.

[0020] Preferably, step S3 comprises:

[0021] Step S3.1: Use a snapshot mechanism to save the state of the protocol under various operations, the snapshot mechanism includes memory image, register state and network state;

[0022] Step S3.2: Use a difference analysis algorithm to compare the differences between every two snapshots to determine the input that causes the state transition and identify potential vulnerabilities or unstable behavior patterns; the differences between every two snapshots include memory differences, register differences, and network state differences; at the same time, record the coverage of each input and optimize as needed.

[0023] Preferably, the step S3.1 includes: using incremental snapshot recording technology to record the modification status.

[0024] Preferably, the step S3.1 comprises: restoring the protocol state based on the saved snapshot, and verifying whether the protocol is accurately returned to the original state.

[0025] Preferably, in step S3.2, when a potential vulnerability or unstable behavior pattern is identified, generation of a report is triggered, and the report includes the type of vulnerability, triggering conditions and impact scope.

[0026] A protocol vulnerability analysis system based on state preservation / recovery is provided according to the present invention, comprising:

[0027] Module M1: Get the protocol status of the protocol with unknown format;

[0028] Module M2: When the protocol status coverage meets the preset requirements, the abnormal situation of the protocol is judged according to the status information;

[0029] Module M3: Saving, restoring and automatic analysis of state-based protocols.

[0030] Preferably, the module M1 comprises:

[0031] Use the optimized DFA to describe the protocol with unknown format and construct the state to obtain the protocol state;

[0032] The optimized DFA includes: adding resource consumption for each protocol state transition based on the DFA; when the protocol transitions from one state to another, consuming corresponding resources according to preset rules;

[0033] Certain states of the protocol will trigger corresponding operations, which are embedded in the corresponding state nodes. When the protocol is in a certain state, the check and update of the corresponding variables in the state node are triggered.

[0034] The transitions in DFA are called network transactions, which include data forwarding, resource consumption, and checking and updating of corresponding variables triggered by the protocol in certain states.

[0035] Preferably, the module M2 comprises:

[0036] Module M2.1: compile the source code of the target program and collect the protocol state coverage by checking the source code;

[0037] Module M2.2: When the protocol state coverage meets the preset requirements, the fuzzer is used to simulate the TCP / IP message exchange between the client and the server, and the state information of the protocol when processing each test case is recorded;

[0038] Module M2.3: Determine the abnormality of the protocol based on the status information;

[0039] The module M3 comprises:

[0040] Module M3.1: Use snapshot mechanism to save the state of the protocol under various operations, including memory image, register state and network state;

[0041] Module M3.2: Use a difference analysis algorithm to compare the differences between each two snapshots to determine the input that causes the state transition and identify potential vulnerabilities or unstable behavior patterns; the differences between each two snapshots include memory differences, register differences, and network state differences; at the same time, record the coverage of each input and optimize as needed;

[0042] The module M3.1 includes: recording the modification using incremental snapshot recording technology;

[0043] The module M3.1 includes: restoring the protocol state based on the saved snapshot and verifying whether the protocol has accurately returned to the original state;

[0044] The module M3.2: when a potential vulnerability or unstable behavior pattern is identified, a report is generated, and the report includes the type of vulnerability, triggering conditions and impact scope.

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

[0046] 1. This invention specifically addresses the problem that existing fuzz testing tools cannot effectively test closed-source protocols in closed systems, and proposes an innovative protocol vulnerability analysis system based on state preservation and recovery. This system achieves in-depth analysis and testing of closed-source protocols by building a carefully designed protocol state machine and combining dynamic debugging methods to obtain key information during program runtime. In addition, this invention also uses advanced fuzz testing technology to effectively explore and identify new protocol states by simulating various network requests and system states, thereby improving the accuracy and efficiency of fuzz testing of closed-source protocols.

[0047] 2. The main advantage of the present invention over existing fuzz testing tools is that it can effectively test closed-source protocols in closed systems. By building a protocol state machine and adopting a black box testing method, the present invention can simulate and detect the protocol state, and then use state preservation and recovery technology to automatically identify and analyze potential vulnerabilities. This method improves the accuracy of the test and does not rely on the understanding of the internal implementation of the protocol, making the testing process more efficient and comprehensive.

[0048] 3. The principle of the present invention is to simulate and analyze the behavior of the protocol in different states by constructing a protocol state machine. Using black box testing technology, the present invention can detect unknown states of the protocol through network-level interactions without direct access to the source code, and record its response to various inputs. In addition, through the state preservation and recovery mechanism, the present invention can reproduce specific test scenarios and conduct in-depth difference analysis to identify new state transitions and potential security vulnerabilities. This method improves the efficiency and accuracy of fuzz testing and provides an effective technical means for discovering and repairing security issues in protocols. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0050] Figure 1 It is a schematic diagram of the construction of a protocol state machine model designed based on a general description language in an embodiment of the present invention.

[0051] Figure 2 Schematic diagram of satellite protocol vulnerability mining framework in an embodiment of the present invention.

[0052] Figure 3 The following is a flowchart of a protocol vulnerability analysis based on state preservation / recovery in an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0054] Example 1

[0055] According to the protocol vulnerability analysis method based on state preservation / recovery provided by the present invention, Figures 1 to 3 As shown, including:

[0056] Step 1: Describe the protocol in a language and construct its state;

[0057] Unlike the traditional open source TCP / IP protocol stack, many current protocols are not clearly formatted and cannot be directly obtained for security reasons. Therefore, vulnerability analysis and mining of protocols with unclear formats requires the research and design of a general protocol description language, and the construction of a state machine to accurately express the protocol state and the transition relationship between states.

[0058] The specific process of the general protocol description language and state conversion designed in this embodiment is as follows:

[0059] First, a deterministic finite automaton (DFA) is used as the basic framework because it can clearly represent the state transition of the protocol. DFA consists of a set of states, a set of input symbols, a transition function, a start state, and a set of accepting states. In this embodiment, each state represents a specific stage of the protocol, the input symbols represent possible protocol operations or messages, and the transition function defines the transition rules from one state to another.

[0060] Secondly, in order to more accurately simulate the actual protocol behavior, the concept of resource constraints is introduced. On the basis of DFA, resource consumption actions such as bandwidth, memory, etc. are added to each state transition. In this way, every time the protocol transitions from one state to another, the corresponding resources will be consumed according to the defined rules. (Limit resource consumption)

[0061] Next, certain states of the protocol may require specific actions to be performed, such as checking specific conditions or updating internal variables. These actions are embedded in the corresponding state nodes, indicating that whenever the protocol is in that state, the relevant variable check or update operation will also be performed. (Detecting the state of the protocol)

[0062] Then, in order to be closer to the actual network protocol operation, the transitions in DFA are called network transactions. A network transaction is a set of atomic operations, including data forwarding, resource consumption, and variable checking and updating. In this way, the behavior of the protocol can be simulated more accurately and provide accurate guidance for subsequent fuzz testing.

[0063] Finally, the correctness of the state machine is verified by simulating different protocol operations and inputs. In addition, the state machine is optimized to ensure that it can efficiently handle various protocol operations and accurately express the state transitions of the protocol.

[0064] Step 2: Black-box testing of protocols without physical contact. After constructing the protocol state machine, considering that satellites are different from other devices with unknown protocol formats but can obtain client information, in certain scenarios, satellite clients and running programs cannot be obtained. It is not possible to fully obtain all states simply by constructing a state machine. Therefore, only black-box testing can be performed to discover previously unknown protocol states. When performing black-box testing, relevant strategies are needed to guide the construction of inputs, which requires studying these protocols without physical contact. Therefore, the above black-box testing can only be completed through the only way of network requests.

[0065] In this embodiment, the purpose of black box testing is to explore and verify the behavior of satellite protocols under various unknown or abnormal inputs to discover previously unknown protocol states. These newly discovered states will provide key data for subsequent state preservation / recovery testing and differential analysis to help identify potential vulnerabilities. The specific process is as follows:

[0066] First, by compiling the source code of the target program, compile-time instrumentation technology is applied to introduce additional code into the binary executable file generated by the compiler, and feedback on the protocol state coverage is collected by instrumenting the added code.

[0067] Secondly, after collecting enough coverage data, the fuzzer launches the binary to run the target server. The fuzzer simulates the TCP / IP message exchange between the client and the server, managing the input as a sequence of request messages. For each request message, the fuzzer sends it through TCP / IP and waits for the server's reply message before continuing to send the next request message. Closely observe the behavior and state changes of the protocol. Use tools such as logging, network monitoring tools, and debuggers to record detailed state information of the protocol when processing each test case. This information includes the protocol's response time, error codes, memory usage, etc.

[0068] Finally, during testing, pay special attention to inputs that cause unusual behavior or unexpected responses. These inputs may reveal previously unknown protocol states. Once such a state is discovered, further verify its behavior to ensure it is not the product of a misconfiguration of the test environment or tool.

[0069] Step 3: Save, restore and automatically analyze the state-based protocol. The protocol is state-based, that is, the execution of the protocol depends on the current state to determine the next state. The method proposed in the present invention can save, restore and replay the protocol to automatically discover the loopholes of the protocol and accurately locate the loopholes.

[0070] In this embodiment, a new fuzz testing method is proposed, which saves, restores and automatically analyzes the state-based satellite protocol. The purpose of this step is to use the previously constructed protocol state machine and the new state discovered through black box testing to further verify the behavior of the protocol and automatically detect possible security vulnerabilities. The specific process is as follows:

[0071] First, a snapshot mechanism is used to save the state of the protocol under various operations. These snapshots include but are not limited to key information such as memory images, register states, and network states. In this way, the protocol can be restored to a specific state at any time to reproduce a specific test scenario or analyze a specific behavior. At the same time, in order to reduce the overhead of snapshot recording, this method uses incremental snapshot recording technology. For example, by recording the modification of each memory page and only recording the modified pages. This can greatly reduce the overhead of snapshot recording.

[0072] Secondly, the method uses a differential analysis algorithm to compare the differences between each two snapshots, including memory differences, register differences, and network state differences. By identifying these differences, it is possible to determine which inputs will lead to new state transitions, thereby identifying potential vulnerabilities or unstable behavior patterns. At the same time, the method records the coverage of each input (code coverage, branch coverage, function coverage, etc.) and optimizes as needed.

[0073] Then, to ensure the accuracy of state preservation and restoration, a series of state recovery tests were performed. In these tests, the protocol state was restored from the saved snapshot and it was verified that the protocol could accurately return to its original state. This verification process is critical to ensure the reliability of the test.

[0074] Finally, the approach continuously monitors for abnormal behaviors, such as crashes, unusual responses, or unexpected state transitions, and automatically flags these behaviors as potential vulnerabilities. Once a potential vulnerability is detected, the system generates a detailed report including the type of vulnerability, triggering conditions, and impact scope.

[0075] The present invention also provides a state preservation / recovery-based protocol vulnerability analysis system, which can be implemented by executing the process steps of the state preservation / recovery-based protocol vulnerability analysis method, that is, those skilled in the art can understand the state preservation / recovery-based protocol vulnerability analysis method as a preferred implementation of the state preservation / recovery-based protocol vulnerability analysis system.

[0076] In general, the present invention is an efficient and flexible fuzz testing method that can effectively save, restore, and discover new state transitions and vulnerabilities by using snapshot recording, difference analysis, coverage analysis and other technologies. It has shown significant performance improvement in actual network service testing and has some unique characteristics and advantages.

[0077] Those skilled in the art know that, in addition to realizing the system and its various devices, modules, and units provided by the present invention in a purely computer-readable program code, it is entirely possible to realize the same functions in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system and its various devices, modules, and units provided by the present invention can be considered as a hardware component, and the devices, modules, and units included therein for realizing various functions can also be regarded as structures within the hardware component; the devices, modules, and units for realizing various functions can also be regarded as both software modules for realizing the method and structures within the hardware component.

[0078] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A protocol vulnerability analysis method based on state preservation / recovery, characterized in that: include: Step S1: Obtaining the protocol status of the protocol with unknown format; Step S2: When the protocol status coverage meets the preset requirements, the abnormal situation of the protocol is determined according to the status information; Step S3: Save, restore and automatically analyze the state-based protocol.

2. The method for analyzing protocol vulnerabilities based on state preservation / recovery according to claim 1, characterized in that: The step S1 comprises: Use the optimized DFA to describe the protocol with unknown format and construct the state to obtain the protocol state; The optimized DFA includes: adding resource consumption for each protocol state transition based on the DFA; when the protocol transitions from one state to another, consuming corresponding resources according to preset rules; Certain states of the protocol will trigger corresponding operations, which are embedded in the corresponding state nodes. When the protocol is in a certain state, the check and update of the corresponding variables in the state node are triggered. The transitions in DFA are called network transactions, which include data forwarding, resource consumption, and checking and updating of corresponding variables triggered by the protocol in certain states.

3. The method for analyzing protocol vulnerabilities based on state preservation / recovery according to claim 1, characterized in that: The step S2 comprises: Step S2.1: compile the source code of the target program and collect the protocol state coverage by detecting the source code; Step S2.2: When the protocol state coverage meets the preset requirements, the fuzzer is used to simulate the TCP / IP message exchange between the client and the server, and the state information of the protocol when processing each test case is recorded; Step S2.3: Determine the abnormality of the protocol based on the status information.

4. The method for analyzing protocol vulnerabilities based on state preservation / recovery according to claim 1, characterized in that: The step S3 comprises: Step S3.1: Use a snapshot mechanism to save the state of the protocol under various operations, the snapshot mechanism includes memory image, register state and network state; Step S3.2: Use a difference analysis algorithm to compare the differences between every two snapshots to determine the input that causes the state transition and identify potential vulnerabilities or unstable behavior patterns; the differences between every two snapshots include memory differences, register differences, and network state differences; at the same time, record the coverage of each input and optimize as needed.

5. The method for analyzing protocol vulnerabilities based on state preservation / recovery according to claim 4, characterized in that: The step S3.1 includes: using incremental snapshot recording technology to record the modification status.

6. The method for analyzing protocol vulnerabilities based on state preservation / recovery according to claim 4, characterized in that: The step S3.1 includes: restoring the protocol state based on the saved snapshot, and verifying whether the protocol has accurately returned to the original state.

7. The method for analyzing protocol vulnerabilities based on state preservation / recovery according to claim 4, characterized in that: The step S3.2: when a potential vulnerability or unstable behavior pattern is identified, a report is generated, which includes the type of vulnerability, triggering conditions and impact scope.

8. A protocol vulnerability analysis system based on state preservation / recovery, characterized in that: include: Module M1: Get the protocol status of the protocol with unknown format; Module M2: When the protocol status coverage meets the preset requirements, the abnormal situation of the protocol is judged according to the status information; Module M3: Saving, restoring and automatic analysis of state-based protocols.

9. The protocol vulnerability analysis system based on state preservation / recovery according to claim 8, characterized in that: The module M1 comprises: Use the optimized DFA to describe the protocol with unknown format and construct the state to obtain the protocol state; The optimized DFA includes: adding resource consumption for each protocol state transition based on the DFA; when the protocol transitions from one state to another, consuming corresponding resources according to preset rules; Certain states of the protocol will trigger corresponding operations, which are embedded in the corresponding state nodes. When the protocol is in a certain state, the check and update of the corresponding variables in the state node are triggered. The transitions in DFA are called network transactions, which include data forwarding, resource consumption, and checking and updating of corresponding variables triggered by the protocol in certain states.

10. The protocol vulnerability analysis system based on state preservation / recovery according to claim 8, characterized in that: The module M2 comprises: Module M2.1: compile the source code of the target program and collect the protocol state coverage by checking the source code; Module M2.2: When the protocol state coverage meets the preset requirements, the fuzzer is used to simulate the TCP / IP message exchange between the client and the server, and the state information of the protocol when processing each test case is recorded; Module M2.3: Determine the abnormality of the protocol based on the status information; The module M3 comprises: Module M3.1: Use snapshot mechanism to save the state of the protocol under various operations, including memory image, register state and network state; Module M3.2: Use a difference analysis algorithm to compare the differences between each two snapshots to determine the input that causes the state transition and identify potential vulnerabilities or unstable behavior patterns; the differences between each two snapshots include memory differences, register differences, and network state differences; at the same time, record the coverage of each input and optimize as needed; The module M3.1 includes: recording the modification using incremental snapshot recording technology; The module M3.1 includes: restoring the protocol state based on the saved snapshot and verifying whether the protocol has accurately returned to the original state; The module M3.2: when a potential vulnerability or unstable behavior pattern is identified, a report is generated, and the report includes the type of vulnerability, triggering conditions and impact scope.

Citation Information

Patent Citations

  • A Binary Program Fuzzy Testing Method Based on Multi-Population Genetic Algorithm

    CN108427643B

  • A binary code-oriented guided fuzzing method

    CN111858358B

  • Fuzzy test method and device based on minimum set coverage

    CN111897733A

Cited By

  • Vulnerability detection method and device, equipment, medium and product

    CN119995954A

  • Vulnerability detection method, device, equipment, medium and product

    CN119995954B

  • Hypertext transfer protocol analysis ambiguity vulnerability detection method and device

    CN120434059A