A network protocol software state anomaly detection method based on replay analysis

Through the replay analysis method, combined with static and dynamic analysis technology, the status abnormalities of the network protocol software are detected, and the problem of difficulty in detection in multiple sessions and multi-path scenarios in the existing technology is solved, and the in-depth analysis of the protocol software is realized and automated detection improve vulnerability mining efficiency and security.

CN118677706BActive Publication Date: 2024-11-26MILITARY INTELLIGENCE RES INST OF THE CHINESE PEOPLES LIBERATION ARMY ACAD OF MILITARY SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411157620.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-22
Publication Date
2024-11-26
Estimated Expiration
2044-08-22

AI Technical Summary

Technical Problem

The existing technology is difficult to accurately detect state abnormalities of network protocol software in multiple sessions and multi-path scenarios, and lacks automated analysis methods, resulting in low vulnerability mining efficiency and high resource consumption, making it difficult to find potential logical errors and security in complex states. Hidden danger.

Method used

Using a method based on playback analysis, the execution process of the network protocol software is recorded and played through the PANDA platform, combined with static and dynamic analysis technology, load detection rules, symbolized processing and constraint solution, and automatically detect status abnormalities of the protocol software, supporting Complex execution of multiple sessions and multiple paths.

Benefits of technology

It realizes in-depth analysis of network protocol software, improves automation detection capabilities, and can discover potential state abnormalities in multiple sessions and multiple path scenarios. Auxiliary vulnerability mining tools explore complex state space more efficiently, improving security and efficiency .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118677706B_ABST
    Figure CN118677706B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for detecting abnormal state of network protocol software based on replay analysis, comprising the following steps: S1: preprocessing; obtaining network protocol related knowledge and initializing basic elements of program analysis; S2: recording the communication session of network protocol software; generating snapshots and log files of the current execution trajectory; S3: static analysis; analyzing and obtaining three parts of information according to the data recorded in the previous step; S4: replaying the execution process of the protocol software; S5: dynamic analysis; symbolizing the state variables affected by network input data and performing local symbolic execution; then determining the state space of the state variables through the result of constraint solving, combining its specific value in the current program execution path, and completing the positioning of the abnormal program state. The present invention can realize the detection of abnormal program state and find the abnormality between the program state inside the network protocol software and the protocol state outside.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of cyberspace security technology, and relates to a dynamic and static combined program analysis technology for general network protocol software, and specifically to a network protocol software state anomaly detection method based on replay analysis. Background Art

[0002] With the rapid development of new Internet-based technologies, new businesses, and new ecosystems, the demand for information communication is increasing, and network protocols are increasingly widely used in daily life. Protocols are specifications for communication between network entities, which stipulate the data specifications and transmission standards that each entity participating in the communication should comply with. Among them, most network protocols need to record and maintain information of multiple clients participating in the communication on the server side, and there is a progressive or causal relationship between the context logic of the communication session. Such protocols are called stateful network protocols. Without ambiguity, the network protocols described in this article are all stateful network protocols.

[0003] The software systems implemented by network protocols are becoming increasingly large, and the work of maintaining the consistency of variable states, program states, and protocol states has also become complicated. Compared with ordinary variables, state variables have a more fixed living space (heap, BSS), a longer life cycle (spanning multiple sessions and throughout the entire communication process), and stricter operating procedures. In the process of implementing network protocols, due to the uneven technical levels of program developers and the possible anomalies and accidents in the protocol operating environment, incorrect coding and unreasonable design appear in the implemented software. These factors make it inevitable that there are a certain number of defects in the protocol software, which weakens the robustness and stability of the program and brings security risks. In particular, when there are multiple session interactions, the program may repeatedly enter certain code blocks with specific functions. If the key variables involved in the state are not handled properly, logical confusion will occur. As the protocol continues to operate, logical errors and state anomalies will occur, resulting in software vulnerabilities, causing program crashes or denial of service.

[0004] Current research work still has certain limitations when dealing with this problem. The relevant technology mainly focuses on logical errors in host command line programs. The description and measurement methods used do not take into account the state characteristics of network protocol software, lack knowledge related to protocol software state variables, and cannot accurately capture and analyze the correlation between state variables. When applied to protocol software, the detection effect is relatively limited. Traditional vulnerability mining technology, such as fuzz testing, mainly focuses on exploration and analysis based on path coverage, and cannot fully cover the state of protocol software, especially the complex state of the program under multiple sessions and multiple paths. It needs to be triggered by a series of specific data packets. The test tools guided by path coverage often ignore the code blocks that are re-entered under multiple paths. In recent years, although the academic community has made considerable progress in the perception and identification of protocol states, it is still not enough to discover the hidden logical errors in complex scenarios of multiple sessions and multiple paths. Moreover, due to the particularity of network protocol software, the logical errors caused by abnormal software states may not only cause program crash vulnerabilities, but also may cause information leakage, authentication bypass, command execution and other types of vulnerabilities, which also increase the difficulty of identification and judgment to a certain extent.

[0005] In order to solve the above problems, the challenges faced by network protocol software state anomaly detection technology are mainly in two aspects. The first is that it is difficult to detect. It is necessary to track the changes in variable states and program states in the entire state space of the protocol, and to grasp whether the operation of state variables violates the relevant protocol conditions. For dynamic analysis technology, whether the state anomaly of the protocol software can be detected is essentially a problem about the path and state accessibility of the protocol software. In particular, in concurrent and multi-path scenarios, it is necessary to construct a specific sequence of network messages to prompt the protocol software to enter the required state. In this case, a certain understanding of the protocol software being tested should be possessed, such as the protocol state machine model (the process of state migration), a series of attributes of state variables, etc. If these features are not summarized enough and a deep path cannot be reached, the state anomaly cannot be triggered and the corresponding error cannot be detected.

[0006] The second is the lack of automated methods. Because protocol software status anomalies are difficult to detect and determine, and the calculations are relatively complex, resource consumption is high, and the requirements for the supporting environment are high, there is a lack of effective analysis methods for protocol status. On the basis of combining and utilizing a variety of existing analysis tools, additional work is often required for data collation, scheduling coordination, and inspection and verification, and the degree of automation is not high enough. When in multiple interactive scenarios of protocol sessions, in order to construct and identify specific program logic, it is also necessary to rely on manual knowledge during the test process to appropriately intervene in the generated data packets, so as to more specifically test the various reactions of the protocol software in abnormal states. Summary of the invention

[0007] In view of the problems existing in the prior art, the purpose of the present invention is to provide a method for detecting abnormality in the state of network protocol software based on replay analysis. The method can not only determine and analyze the state of common network protocol software during execution, but also has good scalability, supports loading corresponding rules and strategies according to different application requirements, realizes the detection of abnormal program state, and can find the anomalies between the program state inside the network protocol software and the protocol state outside. The analysis results can be used to assist in vulnerability mining.

[0008] To achieve the above object, the present invention designs a method for detecting abnormality in network protocol software state based on replay analysis, the method comprising the following steps:

[0009] S1: Preprocessing: Acquire network protocol-related knowledge and initialize basic elements of program analysis. The information involved includes: state machine model of network protocol specifications and program attributes and operation characteristics of protocol software;

[0010] S2: Record the communication session of the network protocol software; configure the server and client of the protocol software in PANDA, start the server and client programs in sequence, and conduct several normal session interactions between the server and the client. PANDA records the behaviors that occur during the program operation and generates a snapshot and log file for the current operation;

[0011] S3: Static analysis: Based on the data recorded in the previous step, three pieces of information are analyzed: first, the conversion process of the network protocol state and the interactive messages between the server and client programs; second, the function call sequence of the program and the time point when the function call occurs during the current operation; third, the function call graph of the program;

[0012] S4: Replay the execution process of the protocol software; replay the snapshots and log records in step S2 through PANDA, analyze the instruction semantics, use the dynamic plugging method, load the probe code, and calculate the basic block state on the program execution path from the variable value with state characteristics, so as to depict the state changes during the program execution process;

[0013] S5: Dynamic analysis; load the proposed detection rules in a plug-in manner, and implement rule pattern matching during the replayed program execution process; symbolize the state variables affected by the network input data and perform local symbolic execution; then determine the state space of the state variables through the results of constraint solving, and combine their specific values ​​in the current program execution path to complete the positioning of the abnormal program state.

[0014] Further, step S1 comprises:

[0015] S1.1. Describe the knowledge related to the target network protocol specification; the processed information includes: protocol state machine, various message structures required in the protocol communication phase, stored in json files;

[0016] S1.2. Obtain the network protocol software to be tested and extract program attributes and operation characteristics;

[0017] S1.3. Prepare data packets that the protocol software can accept. This can be network sniffing data stored in pcap format, or data can be manually organized through program code.

[0018] Further, step S2 comprises:

[0019] S2.1. Configure the virtualization platform PANDA and deploy the server and client of the network protocol software in PANDA;

[0020] S2.2. Start the recording process and start the server and client programs of the protocol software in sequence;

[0021] S2.3. The server and the client communicate and interact, receiving and sending protocol data packets;

[0022] S2.4. End the recording process and save the record file; after the client program is finished running, call the closing interface to stop the recording function of PANDA and generate the operation record and log file.

[0023] Further, step S3 includes:

[0024] S3.1. Record the interactive messages between the server and client programs during this communication process and the semantics of the messages in the protocol;

[0025] S3.2. Generate the state transition sequence of the protocol in this communication process through the network protocol state machine model saved in S1.1, record the timestamp of the state transition, and store it in the memory database in Hash format;

[0026] S3.3. Extract the function call sequence on the execution path from the call stack information of the program execution, and record the timestamp of the function call;

[0027] S3.4. Use static analysis tools to obtain the function export table and loading library information of the network protocol software to form a static function call graph.

[0028] Further, step S4 includes:

[0029] S4.1. Replay the snapshot and log records generated in step S2 in PANDA to reproduce the communication process of the protocol software;

[0030] S4.2. During the replay process, the program execution trace is divided into sub-trajectories belonging to different protocol states;

[0031] S4.3. During the replay process, the network protocol software state variable identification technology is applied to track and analyze the state changes of the state variables in the program;

[0032] S4.4. Extract the data dependency of related state variables and record the impact on the program state when the state variables change;

[0033] S4.5. On the replayed program execution path, calculate the state of the basic block related to the state variable at the corresponding program point;

[0034] S4.6. On the replayed program execution path, calculate the execution status of each basic block.

[0035] Further, step S5 includes:

[0036] S5.1. Implement the formally described state preservation rules, state recovery rules, and state update rules into code and load them during the replay process;

[0037] S5.2. During the replay process, use constraint rules to dynamically detect the specific execution process of the program;

[0038] S5.3. In the analysis step S5.2, if a violation of the constraint rule is detected, the state variables affected by the network input data are symbolized;

[0039] S5.4. For the violation of constraint rules of the state variables located in step S5.3, save the program state and switch to the symbolic execution tool;

[0040] S5.5. Call the symbolic execution engine to carry out local symbolic execution, and obtain a feasible solution through the constraint solver; symbolize the state variables affected by the network input data and violating the specification conditions, call the symbolic execution engine to carry out local symbolic execution on the symbolized state variables, and obtain a feasible solution through the constraint solver;

[0041] S5.6. Determine the specific values ​​of the state variables related to the input data and switch to PANDA to complete the specific execution;

[0042] S5.7. Adjust the network input message, re-run the protocol software, and verify the program state anomaly for the feasible solution found in step S5.5.

[0043] Further, step S1.2 includes:

[0044] S1.2.1. For open source software, compile the source code to generate an executable file; for closed source software, extract the binary executable file from the software distribution package;

[0045] S1.2.2. Extract the basic properties and running characteristics of the executable file, including: file header, size of each section, entry point address, segment base address of each section's initial mapping and / or exported symbol table, and store them in a memory database in hash format.

[0046] Further, step S2.1 includes:

[0047] S2.1.1. Build a virtual machine operating system, compile and install PANDA, and create a Qemu image of the simulated client operating system according to the environment required for the network protocol software to run;

[0048] S2.1.2. Deploy the server and client of the network protocol software to be tested into the client operating system image of PANDA and complete the corresponding software configuration;

[0049] Step S2.2 includes:

[0050] S2.2.1. Call the startup interface to start the recording function of PANDA;

[0051] S2.2.2. Select appropriate parameters as needed and start the server program of the network protocol software;

[0052] S2.2.3. Run the client program of the protocol software.

[0053] Further, step S3.3 includes:

[0054] S3.3.1. Read the function call sequence during program execution through the call stack information;

[0055] S3.3.2. For each function in the calling sequence, record the timestamp of the function call and store it in the database in Hash format.

[0056] Further, step S3.4 includes:

[0057] S3.4.1. Use static analysis technology to analyze the symbols in the network protocol software, obtain the export table and loading library information, and store them in the database in Hash format;

[0058] S3.4.2. Use static analysis technology to generate a global function call graph of the network protocol software and store it in the database.

[0059] Beneficial effects:

[0060] The present invention provides good automated program analysis capabilities for network protocol software. The solution formulates three types of normative constraint rules based on the consistency constraints between the network protocol state, program state, and variable state, and designs an automated detection algorithm, which technically solves the problem of using state constraint rules for pattern analysis.

[0061] The present invention can support in-depth analysis of the complex execution of protocol software in multiple sessions and multiple paths. This solution uses local symbolic execution technology when calculating the state space of state variables, and performs pruning optimization on some irrelevant states and complex program calls, alleviating the risk of state explosion, allowing dynamic analysis to go deeper into program paths and cover more protocol states, achieving the purpose of heuristic detection of whether state variables constitute potential state anomalies.

[0062] The output results of this solution can be used to assist fuzz testing tools to improve the efficiency of vulnerability mining. The technical method involved in the invention does not directly discover vulnerabilities in protocol software, but by discovering program state anomalies, provides information related to potential vulnerabilities, guides and assists fuzz testing and even hybrid testing tools to more smoothly reach deep path branches, and comprehensively explore complex state spaces, thereby more efficiently mining vulnerabilities.

[0063] The present invention makes full use of the characteristics of software virtualization technology and places a virtualization system in the PANDA platform, which can support the environment configuration of most mainstream network protocol software and simulate the communication interaction between the network protocol server and the client in a production environment.

[0064] The present invention supports the recording and replay mechanism of the protocol software execution process. The system state will not be changed during recording, and system-level deterministic sequential reproduction will be performed during replay. The detection rules and analysis logic are loaded in the form of plug-ins. It has good scalability and can support repeated comparative analysis of a specific execution of the program. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 It is a flow chart of a method for detecting abnormality of network protocol software status based on replay analysis of the present invention;

[0066] Figure 2 It is a schematic diagram of the characteristic relationship between the network protocol state, program state and variable state involved in the present invention;

[0067] Figure 3 It is a schematic diagram of causes of abnormal OpenSSL program status in a specific implementation manner of the present invention. DETAILED DESCRIPTION

[0068] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0069] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0070] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0071] The following is combined with Figure 1-Figure 3 The specific embodiments of the present invention are described in detail. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0072] The technical solution adopted by the present invention is to construct a vulnerability model of network protocol software based on the network protocol specification and the operating mechanism of the protocol software, and to define constraint rules in a formalized way. These rules basically cover the changing relationship between the protocol state, software state, and variable state during the program execution process. On this basis, relying on the recorded and replayed program execution trajectory, the dynamic plugging method is used to track the changes in program control flow, data flow, and state, and then the analysis and detection of program state anomalies are realized through heuristic algorithms.

[0073] Network protocol software is a program implementation of the protocol specification, so its state characteristics can be examined from multiple levels. Specifically, Figure 2As shown in the figure, when the protocol software is running normally, it presents significant state changes in the network, that is, the state of the protocol itself, which is an external feature; in the software, it is manifested in the identification of communication entities, storage of session parameters, identification of state information, etc., which is reflected in the state of the software program, which is an internal attribute; further, the macro program state can be further refined into a finite number of micro variable states. Among them, some key variables are closely related to the logic and configuration of the protocol, and such variables are called state variables. From the perspective of the program execution path, when the protocol software receives a data message from the network and sends a response message according to the specification settings, it modifies the values ​​of these state variables at the same time, completes the conversion of the protocol state, and drives the program forward. It can be seen that there is a strong consistency and synchronization between the variable state, program state and protocol state, and the coordination and stability between the three ensure that the protocol software is executed normally and operates smoothly according to the requirements of the protocol design.

[0074] Secure Sockets Layer (SSL) is a common network security protocol that works on top of the reliable transport layer protocol (TCP). After SSL evolved to version 3.0, IETF standardized it (RFC 2246) and renamed it Transport Layer Security (TLS). From a technical point of view, there is no significant difference between TLS 1.0 and SSL 3.0, and there is a certain improvement in security. Therefore, the following text will no longer deliberately distinguish between SSL and TLS, and will uniformly use TLS instead. This section takes a known vulnerability (CVE-2015-0291) of this protocol software as an example to implement program status anomaly detection by recording and replaying the exploitation process of the vulnerability. The technologies and tools involved in the implementation process also include: virtualization environment PANDA, symbolic execution tool angr, root cause analysis prototype tool ARCUS, disassembly tool Capstone, memory database Redis and Python runtime environment.

[0075] like Figure 1 As shown, the network protocol software state anomaly detection method based on replay analysis of the present invention mainly includes the following specific steps:

[0076] S1: Preprocessing. Acquire the knowledge related to network protocols and initialize the basic elements of program analysis. The former mainly covers: the state machine of the protocol, the input message format, the response under a specific state, etc.; the latter covers the binary executable file format of the software, the allocation of virtual memory address space, the symbol table, etc.

[0077] S2: Record the communication session of the protocol software. Virtualization technology facilitates the simulation of network protocols (devices) and operating systems in the form of software, and can use existing platforms to track and intercept access to physical resources. The virtualization platform used in the present invention is PANDA, which is a virtualization analysis environment based on QEMU extension. It can simulate program execution through its own instruction translation module and has a replay function. PANDA is selected as the basic operating platform for recording and replaying the execution trajectory of the protocol software. It can run programs in the system under lightweight load conditions, and then add different levels of monitoring logic during the replay process. It has good scalability and portability.

[0078] Configure the server and client of the protocol software in PANDA, start the server and client programs in sequence, and conduct several normal conversation interactions between the two, or reproduce the exploitation process of known vulnerabilities as needed. During this period, PANDA will completely record the handshake negotiation, message sending and receiving, data processing, system calls, etc. that occur during program operation, and generate snapshots and log files of the current operation for use in replay.

[0079] S3: Static analysis. According to the program execution recorded in the previous step, three pieces of information are analyzed: the first is the transition process of the network protocol state and the interactive messages between the server and client programs, which are arranged in chronological order in the form of tuples; the second is the function call sequence of the program and the time point when the function call occurs during the current operation, which is recorded in the form of hash; the third is the function call graph of the program, which can reflect all the call relationships of the network protocol software, that is, all possible program state transition sets.

[0080] S4: Replay the execution process of the protocol software. Replay the snapshots and log records in the second step through PANDA to reproduce the session process of the protocol software. During this process, the state of the protocol software will change with the input and output of the session message. By parsing the instruction semantics and using the dynamic stub method, the probe code is loaded, and the basic block state on the program execution path is calculated from the variable value with state characteristics, so as to depict the state change during the program execution process.

[0081] S5: Dynamic analysis. Implement the network state anomaly detection algorithm. Load the proposed detection rules as a plug-in, and implement rule pattern matching during the replayed program execution process; symbolize the state variables affected by the network input data and perform local symbolic execution; then determine the state space of the state variables through the results of constraint solving, and combine its specific value in the current program execution path to complete the abnormal program state location.

[0082] The method implemented by the present invention can automatically analyze and detect program state anomalies from the program execution trajectory of the network protocol software, thereby assisting the fuzz testing tool to more efficiently discover and locate potential vulnerabilities, and helping to further carry out root cause analysis and security protection of software vulnerabilities. From the perspective of practical application, in order to analyze the state changes of the protocol software during the communication process, especially the state anomalies of the program in multiple sessions and multiple paths, the key points to be grasped are: first, the system-level recording and replay of the program execution process, so that the changes in the program state can be repeatedly compared and analyzed, and the anomalies of the program state can be found in the deterministic replay to obtain reliable results; second, the determination of the state, by capturing the events of the protocol software receiving and sending data packets to judge the protocol state, tracking the full life cycle of the state variable generation, reference, transfer and recovery in the software to measure the program state, so as to perform state constraint analysis in the complex execution path of multiple interactions, and detect the program state anomalies caused by the misuse of state variables.

[0083] The specific steps are as follows:

[0084] S1: Preprocessing. It includes the following sub-steps:

[0085] S1.1. Describe the knowledge related to the TLS protocol specification. The information processed includes: the state machine of the TLS protocol (in the form of a directed graph), the data message structure that can be accepted during the TLS protocol handshake negotiation phase related to the CVE-2015-0291 vulnerability (ClientHello, ClientCertificate, ClientKeyExchange and other messages, in Hash format), and the response messages under different state conditions during the TLS protocol handshake negotiation phase (ServerHello, ServerCertificate, ServerKeyExchange and other messages, in Hash format). The above information is stored in a json file. Specifically including:

[0086] S1.1.1. The state machine of the protocol is stored in a json file in the form of a directed graph.

[0087] S1.1.2. The data message format accepted (input) by the network protocol is stored in a json file.

[0088] S1.1.3. The response (output) of the network protocol in a specific state is stored in a json file.

[0089] S1.2. Obtain the network protocol software to be tested and extract relevant operating characteristics. The OpenSSL software affected by CVE-2015-0291 is a version before 1.0.2a. Here, 1.0.2 is used as an example to compile and generate an executable file. The basic information of the binary file is obtained through the disassembly tool Capstone, including: file header, size of each section, entry point address, segment base address of each section initial mapping, exported symbol table, etc. Specifically including:

[0090] S1.2.1. The binary executable file format, including the file header, the size of each section, etc., is stored in the Redis memory database in Hash format.

[0091] S1.2.2. The allocation of executable files in the virtual memory address space, including: entry point address, segment base address of each section's initial mapping, exported symbol table, etc.) is stored in the Redis memory database in hash format. This information will be continuously updated as the program is executed.

[0092] S1.3. In this example, the PoC program for CVE-2015-0291 written in Python is used directly to send data packets to OpenSSL.

[0093] Step S2: Record the communication session of the network protocol software. Specifically including:

[0094] S2.1. Configure the virtualization platform PANDA and deploy the server and client of the network protocol software in PANDA. Install the Ubuntu virtual machine in VMware Workstation and then install the PANDA environment; or directly pull the pandare image from the Internet through Docker to build the virtualization platform. Step S2.1 specifically includes:

[0095] S2.1.1. Build a virtual machine operating system, compile and install PANDA, and create a Qemu image of the simulated client operating system based on the environment required for the network protocol software to run.

[0096] S2.1.2. Deploy the server and client of the network protocol software to be tested into the client operating system image of PANDA and complete the corresponding software configuration.

[0097] S2.2. Start the recording process and start the server and client programs of the protocol software in turn. According to the environment required for OpenSSL to run and the Python version that the program depends on, create a client operating system based on the Qemu image of Ubuntu 18.04 LTS. Deploy the compiled OpenSSL 1.0.2 (server) and the PoC of CVE-2015-0291 (client) to the prepared client operating system image, generate the authentication certificate to be used, and complete the corresponding software configuration. Step S2.2 specifically includes:

[0098] S2.2.1. Call the startup interface to start the recording function of PANDA.

[0099] S2.2.2. Select appropriate parameters as needed and start the server program of the network protocol software.

[0100] S2.2.3. Run the client program of the protocol software.

[0101] S2.3. The server and client communicate with each other, receiving and sending protocol data packets. Call PANDA's run_serial_cmd function to start testing and recording. Start OpenSSL 1.0.2 with parameters (openssl s_server -port 4433 -key server.pem -cert server.pem), and then run the PoC program of CVE-2015-0291. Figure 3 As shown in the figure, the program simulates the client sending two ClientHello messages to the server. The first one is data that can be used for normal handshake negotiation. During this process, a pair of state variables shared_sigalgs and shared_sigalgslen in the data structure used by OpenSSL to save TLS protocol session information are normally assigned in the same code basic block of the function tls1_set_shared_sigalgs(); the second time is to send malicious attack data. After receiving the message, OpenSSL should restore the status of the above two state variables (clear their assignments), but in fact only cleared shared_sigalgs and retained the old value of shared_sigalgslen, and the two states are inconsistent; when the program continues to execute to the function tls1_process_sigalgs(), in the same code basic block, shared_sigalgs is accessed according to the value of shared_sigalgslen, so a null pointer dereference error occurs, causing the OpenSSL server program to crash.

[0102] S2.4. End the recording process and save the recording file. After the client program is finished running, call the shutdown interface to stop PANDA's recording function and generate the running record and log file. After the vulnerability exploitation program is executed and OpenSSL crashes with an error, call PANDA's run_monitor_cmd function to stop recording. At this time, two files, *. recording-rr-snp and *.log, related to this execution process will be generated in the current working directory.

[0103] Step S3: Static analysis. Specifically including:

[0104] S3.1. Record the interactive messages between the server and client programs during this communication process and the semantics of the messages in the protocol. During the communication process, record the messages that the server responds to after the client sends data; and identify the semantics of the data messages according to the network protocol specifications. Including:

[0105] a) The client sends: ClientHello (normal data message);

[0106] b) Server response: ServerHello, ServerCertificate, ServerKeyExchange, ServerHelloDone;

[0107] c) The client sends: ClientHello (a message containing malicious data).

[0108] S3.2. Generate the state transition sequence of the protocol in the handshake negotiation phase through the TLS protocol state machine model saved in S1.1, record the timestamp of the state transition, and store it in the Redis memory database in Hash format. According to the TLS protocol state machine model, analyze the transition sequence of the protocol state during the communication process of step 2.3, and store the timestamp of the state transition in the database in Hash format.

[0109] S3.3. Extract the function call sequence on the execution path from the call stack information of the program execution, and record the timestamp of the function call. Step S3.3 specifically includes:

[0110] S3.3.1 Read the function call sequence during program execution through the call stack information.

[0111] S3.3.2 For each function in the calling sequence, record the timestamp of the function call and store it in the database in Hash format.

[0112] The output information of this embodiment is as follows:

[0113] #0 tls1_process_sigalgs at t1_lib.c:3713

[0114] #1 tls1_set_server_sigalgs at t1_lib.c:2977

[0115] #2 ssl3_get_client_hello at s3_srvr.c:1343

[0116] #3 ssl3_accept at s3_srvr.c:357

[0117] #4 ssl3_read_bytes at s3_pkt.c:1536

[0118] #5 ssl3_read_internal at s3_lib.c:4416

[0119] #6 ssl3_read at s3_lib.c:4440

[0120] #7 SSL_read at ssl_lib.c:1018

[0121] #8 sv_body at s_server.c:2483

[0122] #9 do_server at s_socket.c:317

[0123] #10 s_server_main at s_server.c:2031

[0124] #11 do_cmd at openssl.c:477

[0125] #12 main at openssl.c:371

[0126] S3.4. Use static analysis tools to obtain the function export table and loading library information of the network protocol software to form a static function call graph. Use static analysis tools to analyze the symbols in OpenSSL, obtain the function export table and loading library information, and then generate the global function call graph of the program and store it in the Redis memory database. Since the OpenSSL program is relatively complex, the number of exported functions is large, and the global function call graph is also of a certain scale, it is not listed one by one in this article. Step S3.4 specifically includes:

[0127] S3.4.1. Use static analysis technology to analyze the symbols in the network protocol software, obtain the export table and load library information, and store them in the database in a list format.

[0128] S3.4.2. Use static analysis techniques to generate a global function call graph of the network protocol software and store it in a database.

[0129] The execution process of the step S4 replay protocol software is as follows:

[0130] S4.1. Replay the snapshot and log records generated in the second step in PANDA to reproduce the communication process of the protocol software. Call PANDA's replay interface to replay the recorded file. During the replay process, the entire process of loading and starting the protocol software and communicating with the client will be reproduced. In a specific embodiment, call PANDA's run_replay function to replay the *. recording-rr-snp obtained in step S2. During the replay process, the entire process of loading and starting OpenSSL and communicating with the client will be reproduced.

[0131] S4.2. During the replay process, the program execution track is divided into sub-tracks belonging to different protocol states. According to the description of the network protocol state machine, when the protocol software receives and sends data packets, it often corresponds to the conversion of the protocol state. Based on this feature of the protocol software, the reception and transmission events of the message are monitored to locate the message processing code of the session interaction; the several protocol states obtained in the previous step are identified during the program execution process. In a specific embodiment, the corresponding PID and ASID are obtained through the process name of the OpenSSL protocol software, and the class and data structure related to the OpenSSL process are established to save: process name, process ID, start time, parent process, child process and other information. After the establishment is completed, the address mapping relationship of each area in the process virtual address space can be tracked and obtained through the PID, and the Redis memory database is updated. Monitor the events of OpenSSL receiving and sending data packets. Since TLS works on the TCP protocol, OpenSSL uses write and read system calls respectively in the process of sending and receiving data packets. Based on this property, when the OpenSSL program returns from the write and read calls, the events of on_sys_write_return and on_sys_read_return are dynamically instrumented, and the logic code for processing data is added in the event response process to record the timestamp of the event occurrence and the storage location, size, and sequence number of the current data message. Then, with the event of receiving / sending data messages as a reference, combined with the protocol state transition timestamp recorded in the third step, the timeline of the program execution trajectory is marked and the sub-trajectories corresponding to different protocol states are divided.

[0132] Step S4.2 specifically includes:

[0133] S4.2.1. Monitor the events of the protocol software receiving and sending data packets, and use dynamic instrumentation technology to locate the message processing code of the session interaction.

[0134] S4.2.2. According to the protocol state transition sequence obtained in step S3.2, mark it on the timeline of the program execution trajectory and divide the sub-trajectories corresponding to different protocol states.

[0135] S4.3. During the replay process, the network protocol software state variable identification technology is applied to track and analyze the state changes of the state variables in the program. Using the network protocol software state variable identification method, the value changes of the state variables throughout the life cycle are recorded, and the read and write events of the corresponding memory area are tracked to obtain the "definition-use" chain of the state variables. In a specific embodiment, during the replay process, the network protocol software state variables are identified using existing technology, and it is preliminarily determined that there are 713 potential state variables in OpenSSL. Monitor the read and write events in the libc library, add the stub analysis code as needed, record the current program pc, the read or write operation on the address where the state variable is located, and the timestamp of the operation, thereby forming the state changes of the program variables throughout the life cycle.

[0136] Step S4.3 specifically includes:

[0137] S4.3.1. Use existing technologies to identify the state variables of the network protocol software, track the read and write events of the memory area where the variables are located, and record the value changes of the state variables throughout the life cycle.

[0138] S4.3.2. Obtain the “definition-use” chain of state variables by analyzing the operations on state variables during program execution.

[0139] S4.4. Extract the data dependencies of related state variables, and record the impact on the program state when the state variables change state. According to the "define-use" chain of the state variables, find the basic blocks related to the operation instructions of the state variables, extract the data dependencies therebetween, and record the time node when the state variables change state and the bit sequence of the session in which the current data message is located. In a specific embodiment, according to the operation of the state variables in the above execution process, the "define-use" chain of the state variables is obtained, and the data dependencies of the related state variables can be further extracted. In this example, it can be found that in the data structure s that saves the TLS protocol session information, there is a pointer variable s->cert, which points to a structure that stores the authentication data that needs to be negotiated for the TLS session. Some state variables in the structure have a significant correlation, such as:

[0140] 00000270 shared_sigalgs; offset

[0141] 00000278 shared_sigalgslen

[0142] The length constraint relationship is reflected between this group of variables. By recording the time node when the state variable changes and the bit sequence of the session in which the current data message is located, the basic block currently using the state variable is identified, so that the corresponding impact of the basic block state (i.e., program state) when these state variables change can be determined.

[0143] Step S4.4 specifically includes:

[0144] S4.4.1. According to the “define-use” chain of the state variable, record the basic blocks related to the operation instructions of the state variable and extract the data dependency;

[0145] S4.4.2. Record the time node when the state variable changes and the bit sequence of the session in which the current data message is located, and identify the basic block currently using the state variable.

[0146] S4.5. On the replayed program execution path, calculate the status of the basic blocks related to the state variables at the corresponding program points. According to the "definition-use" relationship of the state variables, summarize the identified basic blocks. For the identified basic blocks on the program execution path, calculate the set of current values ​​of the state variables defined and used in the block, which represents the status of the basic block at the current program point and is stored in the database in a hash format. In this embodiment, the state variable shared_sigalgs is 0x00d062e0 when the normal ClientHello is received for the first time (program point 0x48e751), which is a pointer to the first address of the heap memory block; the state of shared_sigalgslen is 32.

[0147] Step S4.5 specifically includes:

[0148] S4.5.1. According to the “definition-use” relationship of the state variables, the identified basic blocks are summarized, and the correspondence between the state variables and the basic block arrays is stored in the database in a hash format.

[0149] S4.5.2. On the replayed program execution path, for each identified basic block, calculate the set of current values ​​of the state variables defined and used in the block, representing the state of the basic block at the current program point, and store it in the database in Hash format.

[0150] S4.6. On the replayed program execution path, calculate the execution state of each basic block. For each basic block on the program execution path, calculate the set of current values ​​of the state variables defined or used in the block to represent the state of the basic block. Then, the union of the state of the basic block entry point and the state of the exit point on the program execution path is used as the execution state of the basic block. The basic block execution state is related to the specific value of the variable on the program execution path, and is suitable for calculating and determining the state constraint conditions in the subsequent pattern analysis. In a specific embodiment, on the replayed program execution path, for each accessed basic block, calculate the union of its entry point state and exit point state as the execution state of the basic block, and integrate the calculation result with the basic block state when the state variable is affected, and store it in the Redis memory database in Hash format. In this example, the basic blocks that use the state variables shared_sigalgs and shared_sigalgslen are calculated one by one at the entry point and exit point, and the situation where its state is affected by the state variables is added to form a sequence of state evolution.

[0151] Step S4.6 specifically includes:

[0152] S4.6.1 On the replayed program execution path, for each basic block accessed, the union of its entry point state and exit point state is calculated as the execution state of the basic block and stored in the database in hash format.

[0153] S4.6.2. Integrate the basic block status affected by the state variables obtained in step S4.5.2 with the basic block execution status and update the database.

[0154] S5: Dynamic analysis. Specifically including:

[0155] S5.1. Implement the state preservation rules, state recovery rules and state update rules described formally into code and load them during the replay process. According to the internal and external consistency of the network protocol state and the software program state, formulate the state preservation rules, state recovery rules and state update rules, and use Python code to implement the above three types of rules, and load them in the form of plug-ins during the PANDA replay process. The environment selected in this embodiment is Python 3.8.10. Step S5.1 specifically includes:

[0156] S5.1.1. Based on the consistency requirements of the external state and internal characteristics of the network protocol software, formally define the constraint rules for program state anomaly detection.

[0157] S5.1.2. Implement the constraint rules formulated in step S5.1.1 with Python code and load it during the replay process.

[0158] S5.2. During the replay process, the constraint rules are used to dynamically detect the specific execution process of the program. Based on the open source tool ARCUS, the Detectors mechanism is used to realize the dynamic detection of constraint rules under the specific execution of the program. During the specific execution of the replayed program, the program state calculated in the previous step is matched with the sessions in the identified sub-trajectory in chronological order; then the Detectors mechanism in the open source tool ARCUS is used to perform matching detection of constraint rules.

[0159] Step S5.2 specifically includes:

[0160] S5.2.1. On the replayed program execution path, analyze the specific execution process of the program and correspond the program state calculated in the fourth step to the session in the identified sub-trace in chronological order.

[0161] S5.2.2. Use the Detectors mechanism of the open source tool ARCUS and apply constraint rules for dynamic detection.

[0162] S5.3. If a violation of the constraint rules is detected in the analysis step S5.2, the state variables affected by the network input data are symbolized. For the violation of the constraint rules found by dynamic detection, it is determined whether the program point uses the state variables affected by the network input data. The state variables involved in this embodiment are: shared_sigalgs and shared_sigalgslen. To this end, the memory area where the group of state variables is located (0x270 offset of the s->cert structure) is symbolized with a length of 8 bytes.

[0163] Step S5.3 specifically includes:

[0164] S5.3.1. When a violation of a constraint rule is found, determine whether the program point uses state variables that are affected by network input data.

[0165] S5.3.2. If a state variable affected by network input data is used, the memory area where the state variable is located is symbolized; if no state variable is involved, no further analysis is performed.

[0166] S5.4. For the situation where the state variable violates the constraint rule in step S5.3, the program state is saved and the symbolic execution tool is switched. In the specific operation, the program state when OpenSSL is executed to the state variable violates the constraint rule is saved, including the current values ​​of the general registers and program variables. Subsequently, the saved program state and the OpenSSL program are imported into the symbolic execution tool angr.

[0167] Step S5.4 specifically includes:

[0168] S5.4.1. In the case where the state variables violate the constraint rules, save the state when the program is executed to the point where the constraint is violated.

[0169] S5.4.2. Import the saved program state and the subsequently executed code into the symbolic execution tool.

[0170] S5.5. Call the symbolic execution engine to carry out local symbolic execution, and obtain a feasible solution through the constraint solver. Symbolize the state variables that are affected by the network input data and violate the specification conditions, call the symbolic execution engine to carry out local symbolic execution on the symbolized state variables, and obtain a feasible solution through the constraint solver. In the specific operation, start the symbolic execution tool angr, start from the saved PC address (that is, the program point with abnormal state, 0x48e75d in tls1_process_sigalgs (s=0x22a0ee0) at t1_lib.c), and enter the local symbolic execution. When the local symbolic execution is completed, call the Z3 constraint solver to obtain a feasible solution for the symbolic value. In this example, the state variables shared_sigalgs=0x00 and shared_sigalgslen=0 are a set of feasible solutions. Step S5.5 specifically includes:

[0171] S5.5.1. Start the symbolic execution tool. In this solution, angr is used. Start from the program point with abnormal status and perform local symbolic execution.

[0172] S5.5.2. After symbolic execution is completed, call the Z3 constraint solver to find a feasible solution for the symbolic value.

[0173] S5.6. Determine the specific value of the state variable related to the input data, and switch to PANDA to complete the specific execution. According to the output of symbolic execution, combined with the instruction of the abnormal state and the current protocol state, determine the network input related to the state variable. In the specific operation, according to the result of symbolic execution output, combined with the instruction of the abnormal state (0x48e77c<tls1_process_sigalgs+43> : mov $0x0, %eax) and the current protocol state (TLS Handshake: ServerHello), determine the specific value of the state variable related to the input data (that is, set shared_sigalgs to the identifier corresponding to the signature algorithm supported by the TLS protocol). Then, restore the program state, replace the symbolic value of the state variable with the specific value, and continue to execute OpenSSL with the specific value in PANDA. Step S5.6 specifically includes:

[0174] S5.6.1. Based on the output of symbolic execution, combined with the instructions of the abnormal state and the current protocol state, determine the specific values ​​of the state variables related to the input data.

[0175] S5.6.2. Restore the program state, replace the symbolic value of the state variable with the specific value, and continue to execute the program with the specific value in PANDA.

[0176] S5.7. Adjust the network input message, re-run the protocol software, and verify the program status anomaly detected in step S5.3. Adjust the network input message, re-run the protocol software, and manually verify the program status anomaly found by dynamic detection. Verify the program status anomaly output in the previous step by means of manual inspection.

[0177] Step S5.7 specifically includes:

[0178] S5.7.1. Re-run the protocol software using the network input message with the correct value.

[0179] S5.7.2. Verify program status anomalies found by dynamic step detection through manual inspection.

[0180] Further, step S5.1.1 includes three types of rules, as follows:

[0181] 1. State retention rules

[0182] This rule can be expressed as: a group of state variables that have a certain logical association relationship should meet operational consistency when they undergo state transitions, that is, they should follow the constraints of simultaneous assignment, simultaneous access, and simultaneous release. Here, "simultaneous" means that the operations that cause the state changes of related variables are all completed in the same code basic block. The specific constraints are as follows:

[0183] R1-simultaneous assignment constraint. This relationship defines the conditions for the state variables with association in the network protocol software to perform assignment operations and cause state transitions; its practical significance is to grasp whether the state variables maintain the consistency of the association relationship when entering a new state after the assignment operation in application detection from the basic block level.

[0184] R2-simultaneous access constraint. This relationship defines the conditions for the associated state variables in the network protocol software to be accessed and read, and to form a state to be transmitted outward; its practical significance is to grasp from the basic block level in application detection whether the state of the state variable transmitted outward after being read and used as a source operand is consistent with the state of the original associated state variable.

[0185] R3-Simultaneous release constraint. Defines the conditions for state variables with associations in network protocol software to be written to 0 or released; its practical significance is to grasp whether the associations between state variables have changed synchronously after the original state is cleared from the basic block level in application detection.

[0186] Therefore, for a set of associated state variables, the operation timing on them is recorded in the program execution path. Then, based on the characteristics described by the above three constraint relationships, tuples are used to identify the temporal logic values ​​of the three relationships. The analysis method of truth value reasoning is used to determine whether the operation timing of the associated state variables satisfies the constraints of the state preservation rules.

[0187] 2. Status recovery rules

[0188] This rule can be expressed as: the state transition of the network protocol follows the protocol state machine model. Therefore, during a communication session, when the network protocol software is restored to a previous state or initial state, the variables related to the protocol state in the program should also be restored to the corresponding state synchronously.

[0189] This rule defines the conditions under which the program state of the protocol software changes when the network protocol state jumps to a previously existing state, reflecting the relationship between the protocol state and the program state. Its practical significance is that in application detection, the execution state of the basic block is used to determine whether the program state is restored to the same state as the previous protocol state.

[0190] 3. Status Update Rules

[0191] This rule can be expressed as follows: Since state variables store information related to the protocol state, session parameters, protocol configuration and other data, their values ​​will change to a certain extent during the process of network protocol state conversion. By tracking the execution process of the protocol software, the value range (value domain) of the state variables corresponding to the correct protocol state can be maintained. When the protocol state is converted again, the value change of the state variable should be within the corresponding reasonable range.

[0192] This rule defines the dynamic change process of the variable state space from the execution path level, reflecting the relationship between the program state and the variable state. Its practical significance is that in application detection, by tracking the value range of the state variable, we can grasp the range of the value that the variable can reach when the state changes, thereby determining whether the value of the state variable meets the value range constraint.

[0193] Any process or method description in the flowchart of the present invention or described in other ways herein can be understood as a module, segment or part of a code including one or more executable instructions for implementing the steps of a specific logical function or process, which can be implemented in any computer-readable medium for use by an instruction execution system, device or equipment, and the computer-readable medium can be any medium containing storage, communication, propagation or transmission programs for use by execution systems, devices or equipment, including read-only memories, magnetic disks or optical disks, etc.

[0194] In the description of this specification, the description with reference to the terms "embodiment", "example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. In addition, those skilled in the art can combine or combine different embodiments or examples described in this specification and the features therein without causing any contradiction.

[0195] Although the above content has shown and described the embodiments of the present invention, it can be understood that the above embodiments are exemplary and cannot be understood as limitations of the present invention. Ordinary technicians in the field can change, modify, replace, modify and other update operations on the above embodiments within the scope of the present invention.

Claims

1. A method for detecting abnormality in network protocol software status based on replay analysis, characterized in that: The method comprises the following steps: S1: Preprocessing: Acquire network protocol-related knowledge and initialize basic elements of program analysis. The information involved includes: state machine model of network protocol specifications and program attributes and operation characteristics of protocol software; S2: Record the communication session of the network protocol software; configure the server and client of the protocol software in PANDA, start the server and client programs in sequence, and conduct several normal session interactions between the server and the client. PANDA records the behavior that occurs when the program is running and generates a snapshot and log file for the current operation; S3: Static analysis: Based on the data recorded in the previous step, three pieces of information are analyzed: first, the conversion process of the network protocol state and the interactive messages between the server and client programs; second, the function call sequence of the program and the time point when the function call occurs during the current operation; third, the function call graph of the program; S4: Replay the execution process of the protocol software; replay the snapshots and log records in step S2 through PANDA, analyze the instruction semantics, use the dynamic plugging method, load the probe code, and calculate the basic block state on the program execution path from the variable value with state characteristics, so as to depict the state changes during the program execution process; S5: Dynamic analysis: Load the proposed detection rules in a plug-in manner, and implement rule pattern matching during the replayed program execution process; symbolize the state variables affected by the network input data and perform local symbolic execution; then determine the state space of the state variables through the results of constraint solving, and combine their specific values ​​in the current program execution path to complete the abnormal program state location; Among them, step S5 includes three types of rules: 1) State retention rules A set of state variables that are logically associated should meet operational consistency when they undergo state transitions, that is, they should follow the constraints of simultaneous assignment, simultaneous access, and simultaneous release. The specific constraints are as follows: R1-simultaneous assignment constraint: In application detection, it is necessary to check from the basic block level whether the state variables maintain the consistency of the association relationship when entering a new state after the assignment operation; R2-simultaneous access constraint: In application detection, it is necessary to check from the basic block level whether the state variables transmitted to the outside are consistent with the state variables with which they are originally associated after being read and used as source operands. R3-Release constraints simultaneously: In application detection, it is necessary to check from the basic block level whether the correlation between state variables has changed synchronously after the original state is cleared; 2) State recovery rules During a communication session, when the network protocol software is restored to a previous state or initial state, the variables related to the protocol state in the program should also be restored to the corresponding state synchronously; In application detection, the execution status of the basic block is used to determine whether the program state is restored to be consistent with the previous protocol state; 3) Status update rules Since the state variables store information related to the protocol state, session parameters, and protocol configuration, their values ​​will change during the process of network protocol state conversion. By tracking the execution process of the protocol software, the value range of the state variables corresponding to the correct protocol state is maintained. When the protocol state is converted again, the value change of the state variables should be within a corresponding reasonable range. In application detection, by tracking the value range of state variables, we can understand the range of values ​​that can be reached when the variable state changes, thereby determining whether the value of the state variable meets the value range constraint.

2. The method for detecting abnormality of network protocol software status based on replay analysis according to claim 1, characterized in that: Step S1 includes: S1.

1. Describe the knowledge related to the target network protocol specification; the processed information includes: protocol state machine, stored in json file; various message structures required in the protocol communication stage, stored in json file; S1.

2. Obtain the network protocol software to be tested and extract program attributes and operation characteristics; S1.

3. Prepare data packets that the protocol software can accept, such as network sniffing data stored in pcap format, or manually organize data through program code.

3. The method for detecting abnormality of network protocol software status based on replay analysis according to claim 1, characterized in that: Step S2 includes: S2.

1. Configure the virtualization platform PANDA and deploy the server and client of the network protocol software in PANDA; S2.

2. Start the recording process and start the server and client programs of the protocol software in sequence; S2.

3. The server and the client communicate and interact, receiving and sending protocol data packets; S2.

4. End the recording process and save the record file; after the client program is finished running, call the closing interface to stop the recording function of PANDA and generate the operation record and log file.

4. The method for detecting abnormality of network protocol software status based on replay analysis according to claim 1, characterized in that: Step S3 includes: S3.

1. Record the interactive messages between the server and client programs during this communication process and the semantics of the messages in the protocol; S3.

2. Generate the state transition sequence of the protocol in the handshake negotiation phase through the network protocol state machine model saved in S1.1, record the timestamp of the state transition, and store it in the memory database in Hash format; S3.

3. Extract the function call sequence on the execution path from the call stack information of the program execution, and record the timestamp of the function call; S3.

4. Use static analysis tools to obtain the function export table and loading library information of the network protocol software to form a static function call graph.

5. The method for detecting abnormality of network protocol software status based on replay analysis according to claim 1, characterized in that: Step S4 includes: S4.

1. Replay the snapshot and log records generated in step S2 in PANDA to reproduce the communication process of the protocol software; S4.

2. During the replay process, the program execution trace is divided into sub-trajectories belonging to different protocol states; S4.

3. During the replay process, the network protocol software state variable identification technology is applied to track and analyze the state changes of the state variables in the program; S4.

4. Extract the data dependency of related state variables, determine whether the change of the state variable affects the program state, and mark the affected program points; S4.

5. On the replayed program execution path, record the basic block where the program point associated with the state variable is located; S4.

6. Calculate the entry point state and exit point state of the basic block found in step S4.5, and take the union of the two as the execution state of the basic block.

6. The method for detecting abnormality of network protocol software status based on replay analysis according to claim 1, characterized in that: Step S5 includes: S5.

1. Implement the formally described state preservation rules, state recovery rules, and state update rules into code and load them during the replay process; S5.

2. During the replay process, use constraint rules to dynamically detect the specific execution process of the program; S5.

3. In the analysis step S5.2, if a violation of the constraint rule is detected, the state variables affected by the network input data are symbolized; S5.

4. For the violation of constraint rules of the state variables located in step S5.3, save the program state and switch to the symbolic execution tool; S5.

5. Call the symbolic execution engine to carry out local symbolic execution, and obtain a feasible solution through the constraint solver; symbolize the state variables affected by the network input data and violating the specification conditions, call the symbolic execution engine to carry out local symbolic execution on the symbolized state variables, and obtain a feasible solution through the constraint solver; S5.

6. Determine the specific values ​​of the state variables related to the input data and switch to PANDA to complete the specific execution; S5.

7. Adjust the network input message, re-run the protocol software, and verify the program state anomaly for the feasible solution found in step S5.

5.

7. The method for detecting abnormality of network protocol software status based on replay analysis according to claim 2, characterized in that: Step S1.2 specifically includes: S1.2.

1. For open source software, compile the source code to generate an executable file; for closed source software, extract the binary executable file from the software distribution package; S1.2.

2. Extract the basic properties and running characteristics of the executable file, including: file header, size of each section, entry point address, segment base address of each section's initial mapping and / or exported symbol table, and store them in a memory database in hash format.

8. The method for detecting abnormality of network protocol software status based on replay analysis according to claim 3, characterized in that: Step S2.1 specifically includes: S2.1.

1. Build a virtual machine operating system, compile and install PANDA, and create a Qemu image of the simulated client operating system according to the environment required for the network protocol software to run; S2.1.

2. Deploy the server and client of the network protocol software to be tested into the client operating system image of PANDA and complete the corresponding software configuration; Step S2.2 specifically includes: S2.2.

1. Call the startup interface to start the recording function of PANDA; S2.2.

2. Select appropriate parameters as needed and start the server program of the network protocol software; S2.2.

3. Run the client program of the protocol software.

9. The method for detecting abnormality of network protocol software status based on replay analysis according to claim 4, characterized in that: Step S3.3 specifically includes: S3.3.

1. Read the function call sequence during program execution through the call stack information; S3.3.

2. For each function in the calling sequence, record the timestamp of the function call and store it in the database in Hash format.

10. The method for detecting abnormality of network protocol software status based on replay analysis according to claim 4, characterized in that: Step S3.4 specifically includes: S3.4.

1. Use static analysis technology to analyze the symbols in the network protocol software, obtain the export table and loading library information, and store them in the database in Hash format; S3.4.

2. Use static analysis technology to generate a global function call graph of the network protocol software and store it in the database.