A network protocol software analysis method based on multi-layer semantic recovery

Through multi-layer semantic recovery technology, combined with deterministic playback and vulnerability model, the fine-grained problem of network protocol software analysis in the existing technology is solved, and efficient vulnerability positioning and analysis of network protocol software is achieved.

CN114860585BActive Publication Date: 2024-11-19NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210428942.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-22
Publication Date
2024-11-19
Estimated Expiration
2042-04-22

AI Technical Summary

Technical Problem

The existing network protocol software analysis methods cannot obtain fine-grained packet processing process information, resulting in inaccurate semantic extraction and lack of a unified vulnerability model for network protocol software, making it difficult to effectively locate and analyze vulnerability trigger points.

Method used

Using a network protocol software analysis method based on multi-layer semantic recovery, by defining the vulnerability model and behavior definition of network protocol software, combining deterministic playback technology, multi-level semantic information is extracted and restored, behavior analysis reports are generated, and based on predefined The vulnerability model determines the vulnerability trigger point.

Benefits of technology

It realizes fine-grained behavior analysis of network protocol software, accurately recovers message processing, locates common vulnerability trigger points and displays vulnerability triggering processes, improves analysis efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114860585B_ABST
    Figure CN114860585B_ABST
Patent Text Reader

Abstract

A network protocol software analysis method based on multi-layer semantic recovery includes: step S1: defining the network protocol software message processing behavior; step S2: defining the vulnerability model of the network protocol software according to the characteristics of various vulnerabilities; step S3: obtaining the execution snapshot and the execution process record by replaying and recording the target network protocol software message processing process; step S4: performing replay analysis; step S5: combining multi-layer behavior semantics, recovering the high-level behavior in the network protocol software message processing process, and generating a network protocol software behavior analysis report; step S6: according to the pre-defined vulnerability model, combined with the extracted multi-layer behavior semantics, determining whether the behavior semantics meets the conditions of any vulnerability in the vulnerability model, if so, locating the vulnerability trigger point and displaying the vulnerability trigger process, and generating a vulnerability analysis report. The present invention has the advantages of simple principle, simple operation, high analysis efficiency, good accuracy, etc.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention mainly relates to the technical field of software analysis, and in particular to a network protocol software analysis method based on multi-layer semantic recovery, and more particularly to functional behavior analysis and vulnerability root cause analysis of network protocol software based on semantic analysis. Background Art

[0002] Program analysis technology based on dynamic analysis is a key technology in malicious code behavior analysis and detection, software behavior understanding, and software vulnerability analysis. Common analysis methods include dynamic taint analysis and dynamic symbolic execution. Program analysis technology based on dynamic analysis is also used for behavioral analysis of network protocol software, and can perform program analysis on the implementation process of network protocols.

[0003] Different from the traditional understanding of message formats based on network traffic, program analysis technology based on dynamic analysis performs program analysis on the implementation of network protocol software, analyzing the functions and behaviors of network protocol software. This is especially true for root cause analysis of binary program vulnerabilities. The existing method is to use dynamic program analysis technology to track the processing of program input, reconstruct the semantic state of the program execution path, determine whether the current program state meets the vulnerability triggering conditions, and locate and analyze the root cause of the vulnerability trigger point.

[0004] Traditional network protocol software analysis methods are mainly based on protocol fuzz testing technology for the protocol to extract the network protocol state machine or obtain the network protocol message format based on protocol reversal. They can restore the network protocol software behavior to a certain extent, but they are all coarse-grained and cannot obtain the fine-grained network protocol software's message processing process, such as the memory address of the credentials used for authentication, the memory resource allocation range and other detailed information.

[0005] When understanding software behavior and analyzing the root causes of vulnerabilities in network protocol software, information extraction and semantic recovery are two important processes. The degree of refinement of program execution path information extraction and the accuracy of semantic recovery directly affect the accuracy and reliability of program semantic analysis. Semantic extraction of program execution paths requires collecting multi-level semantic information related to input data along the program execution path, such as key function calls, memory read and write operations, data flow transmission and other hierarchical information; at the same time, this information needs to be aggregated to form high-level semantics, such as user password identification and verification operation semantics. In the semantic recovery process, the accuracy of semantic recovery of library functions and system calls and the accuracy of semantic recovery of memory read and write operations are two key stages.

[0006] The existing method of recovering program semantics of library functions and system call functions is to perform dynamic symbolic tracing along the execution path of network protocol software. However, it has two major disadvantages: it requires summarizing library functions and skipping these function calls during program execution, and it also requires simulating the impact of system calls on memory to skip making system calls. Therefore, this method not only requires additional manual work to implement function abstraction and system call simulation, but also leads to inaccurate extracted program semantics due to the incompleteness of summarization and simulation.

[0007] Tracking memory accesses and extracting information is another major step in dynamic program semantic recovery. The current method for recording memory accesses is to monitor sensitive functions at the function level. This method has two main shortcomings:

[0008] First, the implementation process of a large number of functions involves memory reading and writing. Existing methods often only monitor the memory operations of some functions, so the memory access of other unmonitored functions will inevitably be missed, resulting in incomplete semantic extraction.

[0009] Second, this method also requires manual work to describe the memory access rules of memory operation functions, but the operations on memory by library functions or system calls vary depending on the specific memory objects being operated on. The different granularity of the objects will result in different semantics, making it impossible to make a unified description in advance, resulting in the existing methods being actually inaccurate.

[0010] After accurately restoring the behavior semantics of the network protocol software, it is necessary to locate the vulnerability trigger point and conduct root cause analysis in combination with the corresponding vulnerability model. However, the existing vulnerability models mainly target single-type vulnerabilities, such as authentication bypass, heap overflow, stack overflow, etc. There is still no relatively unified vulnerability model specifically for network protocol software. Summary of the invention

[0011] The technical problem to be solved by the present invention is: in view of the technical problems existing in the prior art, the present invention provides a network protocol software analysis method based on multi-layer semantic recovery which has simple principle, easy operation, high analysis efficiency and good accuracy.

[0012] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0013] A network protocol software analysis method based on multi-layer semantic recovery, comprising:

[0014] Step S1: define the network protocol software message processing behavior;

[0015] Step S2: defining a vulnerability model of network protocol software according to the characteristics of various vulnerabilities;

[0016] Step S3: Obtaining an execution snapshot and an execution process record by replaying and recording the target network protocol software message processing process;

[0017] Step S4: performing replay analysis; according to the behavior definition of the network protocol software message processing process and the vulnerability model of the network protocol software, during the replay of the network protocol software execution, a program semantics extraction tool based on multi-level semantic recovery is used to extract the required program semantics;

[0018] Step S5: combining the multi-level behavior semantics of the network protocol software extracted above, restoring the high-level behavior of the network protocol software in the message processing process, and generating a network protocol software behavior analysis report;

[0019] Step S6: Based on the pre-defined vulnerability model and the extracted multi-level behavioral semantics, determine whether the behavioral semantics meets the conditions of any vulnerability in the vulnerability model. If so, locate the vulnerability trigger point and display the vulnerability trigger process to generate a vulnerability analysis report.

[0020] As a further improvement of the method of the present invention: in step S1, four types of events are concerned, namely, sending and receiving of network messages, calling of key functions, memory access to received messages, and data flow transmission of received messages.

[0021] As a further improvement of the method of the present invention: in step S2, the vulnerabilities include information leakage, command injection, authentication bypass, heap overflow, use after free and double free vulnerabilities.

[0022] As a further improvement of the method of the present invention: the step S2 comprises:

[0023] (a) Define the information leakage vulnerability model; when the network protocol software is executed along the program execution path, the access to memory resources exceeds the boundary of the relevant object, resulting in information leakage vulnerability;

[0024] (b) Define an authentication bypass vulnerability model; when the network protocol software is executed along the program execution path, an error occurs during the user authentication process, resulting in non-authenticated users being able to perform privileged operations that only authenticated users can perform;

[0025] (c) Define the command injection vulnerability model; when the network protocol software is executed along the program execution path, part of the data entered by the user is directly or indirectly passed as a parameter to the relevant function that can execute the command, which triggers the command injection vulnerability;

[0026] (d) Heap overflow vulnerability model definition: When the network protocol software is executed along the program execution path, the write operation to the heap memory space can write too long data, causing the written data to cross the current heap space boundary, thus triggering a heap overflow vulnerability;

[0027] (e) Define a use-after-free vulnerability model; when the network protocol software is executed along the program execution path, it reads and writes memory to the released memory space, resulting in a use-after-free vulnerability;

[0028] (f) Definition of double-free vulnerability model: When the network protocol software is executed along the program execution path, the memory space that has been released can still be released again, resulting in a double-free vulnerability.

[0029] As a further improvement of the method of the present invention: in step S3, by utilizing existing snapshots and deterministic replay tools, the target network protocol software message processing process is replayed to obtain execution snapshots and execution process records, thereby preparing for semantic extraction and recovery of the deterministic replay of the network protocol software message processing process.

[0030] As a further improvement of the method of the present invention: in step S4, the multi-level semantics are divided into instruction layer semantics, function layer semantics, data flow layer and control flow layer semantics, and storage space boundary constraint layer semantics.

[0031] As a further improvement of the method of the present invention: the step S4 comprises:

[0032] (a) At the instruction layer, monitor the instructions related to memory access, obtain the memory access information of the instruction layer based on the instructions, and extract the high-level memory access semantics using the high-level memory access semantics extraction algorithm based on the collected instruction layer memory access semantics;

[0033] (b), at the function level, monitor the calls of key functions;

[0034] (c) At the control flow layer, focus on the context of key events;

[0035] (d) At the data flow layer, pay attention to the parameter source of key functions and obtain the data flow transmission status of received messages;

[0036] (e) At the memory space boundary constraint layer, the constraint attributes of key objects are extracted as the basis for determining whether the heap space access is abnormal.

[0037] As a further improvement of the method of the present invention: the step S4 comprises:

[0038] Step S401: Determine whether the multi-level semantics meets the information leakage vulnerability triggering condition: when the network protocol software is executed along the program execution path, the access to the memory resource exceeds the boundary of the related object, resulting in an information leakage vulnerability;

[0039] Step S402: Determine whether the multi-level semantics meets the authentication bypass vulnerability triggering condition: when the network protocol software is executed along the program execution path, an error occurs during the user authentication process, resulting in a non-authenticated user being able to perform privileged operations that can only be performed by an authenticated user;

[0040] Step S403: Determine whether the multi-level semantics meets the command injection vulnerability triggering condition: when the network protocol software is executed along the program execution path, part of the data input by the user can be directly or indirectly passed as a parameter to the relevant function that can execute the command;

[0041] Step S404: determining whether the multi-level semantics meets the triggering condition of the heap overflow vulnerability: when the network protocol software is executed along the program execution path, the write operation to the heap memory space can write too long data, causing the written data to cross the current heap space boundary;

[0042] Step S405: Determine whether the multi-level semantics meets the use-after-free vulnerability triggering condition: when the network protocol software is executed along the program execution path, it can still read and write memory to the released memory space, resulting in a use-after-free vulnerability;

[0043] Step S406: Determine whether the multi-level semantics meets the double-free vulnerability triggering condition: when the network protocol software is executed along the program execution path, the memory space that has been released can still be released again, resulting in a double-free vulnerability.

[0044] As a further improvement of the method of the present invention: the step S4 comprises:

[0045] Step S4011: ReadCache indicates the five most recently accessed memory blocks, CurrentMerge indicates the fusion flag of the current memory access unit, CurrentUnit indicates the memory space currently being accessed, PreUnit indicates the fusion flag of the last memory access unit, PreUnit indicates the last accessed memory space, and ReadUnit indicates the currently accessed memory unit captured at the instruction layer, including the access address, the access memory length, and the current time;

[0046] Step S4012: after the ReadUnit is monitored at the instruction layer, it is determined whether it can be merged with any memory block in the ReadCache. If it can be merged, it is merged and CurrentMerge is set to True; an attempt is made to merge the memory blocks in the ReadCache with each other; in this process, the assignment of CurrentUnit is completed;

[0047] Step S4013: If the CurrentUnit flag is True, it means that the current ReadUnit has been processed and merged, and no further processing is performed; if the CurrentUnit is False, it means that the current ReadUnit cannot be merged and has not been processed, so it is directly inserted into the ReadCache for caching. If the ReadCache is full, the memory block with the earliest access time is deleted, and the CurrentUnit points to the ReadUnit;

[0048] Step S4014: After the extraction of continuous memory access information is completed, the memory access is checked immediately; if CurrentMerge is False, it means that the current memory unit is not merged, that is, the current memory access unit is not continuous, then CurrentUnit is checked, and if PreMerge is True, it means that the last access memory unit has been merged, but the continuous reading and writing has ended so far, and the memory access check is performed on the PreUnit memory block;

[0049] Step S4015: If CurrentMege is True, it means that the current memory unit has been merged, that is, the current memory access unit is continuous, and there is no need to check CurrentUnit; if PreMerge is also True, but PreUnit and CurrentUnit are not continuous with each other, it means that the memory block accessed last time was continuous, but is no longer continuous so far, and a memory access check is performed on the PreUnit memory block;

[0050] Step S4016: The high-level semantic recovery of memory access and the check of vulnerability model have been completed, and the first and last work is performed, specifically:

[0051] PreUnit=CurrentUnit, PreMerge=CurrentMerge, CurrentMerge=False.

[0052] Compared with the prior art, the advantages of the present invention are:

[0053] 1. The network protocol software analysis method based on multi-layer semantic recovery of the present invention focuses on the processing process of fine-grained network protocol software messages, aims at four types of representative events that can describe the network protocol software message processing process, and restores the associated behaviors of elements such as memory access, key function calls, data flow transmission, and memory resource boundary attributes in the message processing process according to the proposed behavior definition of the network protocol software, so as to restore the message processing process of the network protocol software.

[0054] 2. The network protocol software analysis method based on multi-layer semantic recovery of the present invention proposes a relatively comprehensive vulnerability model covering vulnerabilities specifically for network protocol software, which can help locate the vulnerability trigger points of the six common vulnerabilities in network protocol software and display the vulnerability triggering process.

[0055] 3. The network protocol software analysis method based on multi-layer semantic recovery of the present invention is based on deterministic replay and adopts a program semantics extraction method based on multi-layer semantic recovery to extract the cross-layer semantics of network protocol software, and can comprehensively and accurately provide the semantics of each layer required by the network protocol software behavior model.

[0056] 4. The network protocol software analysis method based on multi-layer semantic recovery of the present invention performs multi-level semantic extraction and recovery according to the behavioral model of the network protocol software, and recovers the associated behaviors of elements such as memory access, key function calls, data flow transmission, and memory resource boundary attributes in the message processing process. It can not only draw a flowchart of the network protocol software message processing process, but also based on a pre-defined vulnerability model, it can recover the triggering behavior of the network protocol vulnerability and display the triggering process of the vulnerability. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION

[0058] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0059] The present invention proposes an analysis method for network protocol software behavior, which mainly considers two aspects: one is the behavior model guiding the semantic extraction of network protocol software, that is, the behavior guidance in the process of analyzing network protocol software; the other is the specific method of program semantic extraction and recovery, that is, the semantic information extraction and recovery method involved in the network protocol software analysis.

[0060] Specifically, the behavior model guiding the semantic extraction of network protocol software is mainly divided into two parts. The first part is the behavior definition of the network protocol software message processing process, which mainly focuses on four types of events, namely, the reception and transmission of messages, memory access to received messages, data flow transmission of received messages, and key function calls. The second part is the vulnerability model for network protocol software, which covers the six common vulnerability types in network protocol software, namely, authentication bypass, information leakage, command injection, heap overflow, use after free, and double free vulnerabilities.

[0061] Specifically, the specific method of program semantics extraction is to use a deterministic replay-based method to perform extraction and multi-level semantic recovery, and to extract and recover the behavioral semantics of network protocol software at the instruction layer, function layer, data flow and control flow layer, and memory space boundary constraint layer: monitor the memory access address and memory access length at the instruction layer to extract memory access information; monitor the key function calls at the function layer to obtain the execution status and call sequence of key functions during program execution; obtain data flow and control flow information during program execution at the data flow and control flow layer; obtain the constraint attributes of key objects in the program analysis process at the memory space boundary constraint layer, mainly the boundary attributes of heap resources.

[0062] like Figure 1 As shown, a network protocol software analysis method based on multi-layer semantic recovery of the present invention comprises the following steps:

[0063] Step S1: define the network protocol software message processing behavior;

[0064] Step S2: defining a vulnerability model of network protocol software according to the characteristics of various vulnerabilities;

[0065] Step S3: Obtaining an execution snapshot and an execution process record by replaying and recording the target network protocol software message processing process;

[0066] Step S4: performing replay analysis; according to the behavior definition of the network protocol software message processing process and the vulnerability model of the network protocol software, during the replay of the network protocol software execution, a program semantics extraction tool based on multi-level semantic recovery is used to extract the required program semantics;

[0067] Step S5: combining the multi-level behavior semantics of the network protocol software extracted above, restoring the high-level behavior of the network protocol software in the message processing process, and generating a network protocol software behavior analysis report;

[0068] Step S6: Based on the pre-defined vulnerability model and the extracted multi-level behavioral semantics, determine whether the behavioral semantics meets the conditions of any vulnerability in the vulnerability model. If so, locate the vulnerability trigger point and display the vulnerability trigger process to generate a vulnerability analysis report.

[0069] In a specific application example, in step S1, four types of events are specifically focused on, namely, sending and receiving network messages, calling of key functions, memory access to received messages, and data flow transmission of received messages.

[0070] In a specific application example, the vulnerabilities described in step S2 include information leakage, command injection, authentication bypass, heap overflow, use after free, and double free vulnerabilities.

[0071] In a specific application example, in step S3, according to actual needs, existing snapshots and deterministic replay tools can be used to replay and record the target network protocol software message processing process, obtain execution snapshots and execution process records, and prepare for the next step of deterministic replay of the network protocol software message processing process for semantic extraction and recovery.

[0072] In a specific application example, in step S4, the multi-level semantics are specifically divided into instruction level semantics, function level semantics, data flow level and control flow level semantics, and memory space boundary constraint level semantics.

[0073] In a specific application example, the step S2 may include:

[0074] (a),Information leakage vulnerability model definition;

[0075] According to actual needs, it can be as follows: when the network protocol software is executed along the program execution path, the access to memory resources exceeds the boundary of the related objects, resulting in an information leakage vulnerability.

[0076] (b),Authentication bypass vulnerability model definition;

[0077] According to actual needs, it can be as follows: when the network protocol software is executed along the program execution path, an error occurs in the user authentication process, resulting in a non-authenticated user being able to perform privileged operations that can only be performed by authenticated users.

[0078] (c),Command injection vulnerability model definition;

[0079] According to actual needs, it can be as follows: when the network protocol software is executed along the program execution path, due to the lack of strict checks, part of the data entered by the user can be passed directly or indirectly as parameters to related functions that can execute commands, including execve, system, etc., which triggers a command injection vulnerability.

[0080] (d),Heap overflow vulnerability model definition;

[0081] According to actual needs, it can be as follows: when the network protocol software is executed along the program execution path, the write operation to the heap memory space can write too long data, causing the written data to cross the current heap space boundary, triggering a heap overflow vulnerability.

[0082] (e),Definition of use-after-free vulnerability model;

[0083] According to actual needs, it can be as follows: when the network protocol software is executed along the program execution path, it can still read and write memory to the released memory space, resulting in a use-after-free vulnerability.

[0084] (f),Double-release vulnerability model definition;

[0085] According to actual needs, it can be as follows: when the network protocol software is executed along the program execution path, the memory space that has been released can still be released again, resulting in a double release vulnerability.

[0086] In a specific application example, the step S4 may include:

[0087] (a) At the instruction level, we mainly monitor the instructions related to memory access, and obtain the memory access information of the instruction level based on this. Based on the collected instruction level memory access semantics, we use the advanced memory access semantics extraction algorithm to extract the advanced memory access semantics. The specific method for extracting advanced semantics for memory read operations is as follows:

[0088] (b) At the function layer, the main focus is on monitoring the calls of key functions, specifically, functions involving the reception and sending of messages, the application and release of resources, and command execution.

[0089] (c) At the control flow layer, the focus is on the causal relationship of key events, including whether the required authentication process is completed before executing privileged operations, the order of sending and receiving messages, etc. At the data flow layer, the focus is on the parameter source of key functions, including whether the parameter source of execve is related to user input, etc., and obtaining the data flow transmission status of the received message.

[0090] (d) In the memory space boundary constraint layer, the constraint attributes of key objects are mainly extracted, mainly the boundary constraint attributes of the heap space, which serve as the basis for determining whether the heap space access is abnormal.

[0091] In a specific application example, step S4 includes the following specific steps:

[0092] Step S401: Determine whether the multi-level semantics meets the information leakage vulnerability triggering condition: when the network protocol software is executed along the program execution path, the access to the memory resources exceeds the boundary of the related objects, resulting in an information leakage vulnerability.

[0093] Step S402: Determine whether the multi-level semantics meets the authentication bypass vulnerability triggering condition: when the network protocol software is executed along the program execution path, an error occurs during the user authentication process, resulting in a non-authenticated user being able to perform privileged operations that can only be performed by an authenticated user.

[0094] Step S403: Determine whether the multi-level semantics meets the command injection vulnerability triggering conditions: When the network protocol software is executed along the program execution path, due to the lack of strict checks, part of the user input data can be passed as parameters directly or indirectly to related functions that can execute commands, including execve, system, etc., which triggers the command injection vulnerability.

[0095] Step S404: Determine whether the multi-level semantics meets the heap overflow vulnerability triggering condition: when the network protocol software is executed along the program execution path, the write operation to the heap memory space can write too long data, causing the written data to cross the current heap space boundary.

[0096] Step S405: Determine whether the multi-level semantics meets the use-after-free vulnerability triggering condition: when the network protocol software is executed along the program execution path, it can still read and write memory to the released memory space, resulting in a use-after-free vulnerability.

[0097] Step S406: Determine whether the multi-level semantics meets the double-free vulnerability triggering condition: when the network protocol software is executed along the program execution path, the memory space that has been released can still be released again, resulting in a double-free vulnerability.

[0098] Specifically, in specific applications, the following process can be used:

[0099] Step S401: ReadCache represents the five most recently accessed memory blocks, CurrentMerge represents the fusion flag of the current memory access unit, CurrentUnit represents the memory space currently being accessed, PreUnit represents the fusion flag of the last memory access unit, PreUnit represents the memory space last accessed, and ReadUnit represents the currently accessed memory unit captured at the instruction layer, including the access address, access memory length and current time.

[0100] Step S402: After the ReadUnit is monitored at the instruction layer, it is determined whether it can be merged with any memory block in the ReadCache. If it can be merged, it is merged and CurrentMerge is set to True; then the memory blocks in the ReadCache are tried to be merged with each other. In this process, the assignment of CurrentUnit is completed.

[0101] Step S403: If the CurrentUnit flag is True, it means that the current ReadUnit has been processed and merged, and no further processing is performed; if the CurrentUnit is False, it means that the current ReadUnit cannot be merged and has not been processed, so it is directly inserted into the ReadCache for caching. If the ReadCache is full, the memory block with the earliest access time is deleted, and the CurrentUnit points to the ReadUnit.

[0102] Step S404: The above steps complete the recovery of high-level semantics. In the vulnerability model, it is also necessary to perform vulnerability determination on high-level memory access semantics. After the extraction of continuous memory access information is completed, the memory access check needs to be performed immediately. If CurrentMerge is False, it means that the current memory unit is not fused, that is, the current memory access unit is not continuous, then the CurrentUnit is checked, and if PreMerge is True, it means that the last access memory unit has been fused, but the continuous reading and writing has ended so far, and the PreUnit memory block needs to be checked for memory access.

[0103] Step S405: If CurrentMege is True, it means that the current memory unit has been merged, that is, the current memory access unit is continuous, and there is no need to check CurrentUnit; if PreMerge is also True, but PreUnit and CurrentUnit are not continuous with each other, it means that the memory block accessed last time was continuous, but is no longer continuous so far, and a memory access check needs to be performed on the PreUnit memory block.

[0104] Step S406: The high-level semantic recovery of memory access and the check of vulnerability model have been completed, and the following work needs to be done:

[0105] PreUnit=CurrentUnit, PreMerge=CurrentMerge, CurrentMerge=False.

[0106] Based on the above method, the present invention effectively restores the associated behaviors of elements such as memory access, key function calls, data flow transmission, memory resource boundary attributes, etc. in the network protocol software message processing process, and generates a network protocol software behavior analysis report; it can successfully locate the vulnerability trigger points of the six common vulnerabilities in the network protocol software and display the vulnerability triggering process, and generate a vulnerability analysis report.

[0107] In a specific application example, four network protocol software, OpenSSL, OpenSSH, libSSH, libSSH2, and six real-world vulnerabilities were used to evaluate the effect of this invention. The experimental results show that the present invention can effectively restore the network protocol software message processing behavior, successfully locate the real-world vulnerability trigger point and show the vulnerability trigger process. In addition, this method can analyze the execution number of up to 135,785,163 network protocol software compiled from up to 4,335,000 lines of C / C++ code, and each test case involves an average of 4,703,311 memory accesses, indicating that the present invention can be used for behavior analysis and vulnerability analysis of complex network protocol software in the real world.

[0108] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.

Claims

1. A network protocol software analysis method based on multi-layer semantic recovery, characterized in that: include: Step S1: define the network protocol software message processing behavior; Step S2: defining a vulnerability model of network protocol software according to the characteristics of various vulnerabilities; Step S3: Obtaining an execution snapshot and an execution process record by replaying and recording the target network protocol software message processing process; Step S4: performing replay analysis; according to the behavior definition of the network protocol software message processing process and the vulnerability model of the network protocol software, during the replay of the network protocol software execution, a program semantics extraction tool based on multi-level semantic recovery is used to extract the required program semantics; Step S5: combining the multi-level behavior semantics of the network protocol software extracted above, restoring the high-level behavior of the network protocol software in the message processing process, and generating a network protocol software behavior analysis report; Step S6: According to the pre-defined vulnerability model, combined with the extracted multi-level behavior semantics, determine whether the behavior semantics meets the conditions of any vulnerability in the vulnerability model. If so, locate the vulnerability trigger point and display the vulnerability trigger process, and generate a vulnerability analysis report; In step S4, the multi-level semantics are divided into instruction level semantics, function level semantics, data flow level and control flow level semantics, and storage space boundary constraint level semantics; The step S4 includes: (a) At the instruction level, monitor the instructions related to memory access, obtain the memory access information of the instruction level based on the instructions, and extract the high-level memory access semantics using the high-level memory access semantics extraction algorithm based on the collected instruction level memory access semantics; (b) At the function level, monitor the calls of key functions; (c) At the control flow layer, pay attention to the context of key events; (d) At the data flow layer, pay attention to the parameter source of key functions and obtain the data flow transmission status of received messages; (e) At the memory space boundary constraint layer, the constraint attributes of key objects are extracted as the basis for determining whether the heap space access is abnormal.

2. The network protocol software analysis method based on multi-layer semantic recovery according to claim 1 is characterized in that: In step S1, four types of events are concerned, namely, the sending and receiving of network messages, the calling of key functions, the memory access to the received messages, and the data flow transmission of the received messages.

3. The network protocol software analysis method based on multi-layer semantic recovery according to claim 1 is characterized in that: In step S2, the vulnerabilities include information leakage, command injection, authentication bypass, heap overflow, use after free and double free vulnerabilities.

4. The network protocol software analysis method based on multi-layer semantic recovery according to claim 3 is characterized in that: The step S2 includes: (a) Define the information leakage vulnerability model; when the network protocol software is executed along the program execution path, the access to memory resources exceeds the boundary of the relevant object, resulting in information leakage vulnerability; (b) Define an authentication bypass vulnerability model; when the network protocol software is executed along the program execution path, an error occurs during the user authentication process, causing non-authenticated users to perform privileged operations that can only be performed by authenticated users; (c) Define the command injection vulnerability model; when the network protocol software is executed along the program execution path, part of the data entered by the user is directly or indirectly passed as a parameter to the relevant function that can execute the command, which triggers the command injection vulnerability; (d) Heap overflow vulnerability model definition: When the network protocol software is executed along the program execution path, the write operation to the heap memory space can write too long data, causing the written data to cross the current heap space boundary, thus triggering a heap overflow vulnerability; (e) Define a use-after-free vulnerability model; when the network protocol software is executed along the program execution path, it reads and writes memory to the released memory space, resulting in a use-after-free vulnerability; (f) Double release vulnerability model definition: When the network protocol software is executed along the program execution path, the memory space that has been released can still be released again, resulting in a double release vulnerability.

5. The network protocol software analysis method based on multi-layer semantic recovery according to claim 1 is characterized in that: In step S3, using existing snapshots and deterministic replay tools, the target network protocol software message processing process is replayed to obtain execution snapshots and execution process records, in preparation for semantic extraction and recovery of the deterministic replay of the network protocol software message processing process.

6. The network protocol software analysis method based on multi-layer semantic recovery according to claim 1 is characterized in that: The step S4 comprises: Step S401: Determine whether the multi-level semantics meets the information leakage vulnerability triggering condition: when the network protocol software is executed along the program execution path, the access to the memory resource exceeds the boundary of the related object, resulting in an information leakage vulnerability; Step S402: Determine whether the multi-level semantics meets the authentication bypass vulnerability triggering condition: when the network protocol software is executed along the program execution path, an error occurs during the user authentication process, resulting in a non-authenticated user being able to perform privileged operations that can only be performed by an authenticated user; Step S403: Determine whether the multi-level semantics meets the command injection vulnerability triggering condition: when the network protocol software is executed along the program execution path, part of the data input by the user can be directly or indirectly passed as a parameter to the relevant function that can execute the command; Step S404: determining whether the multi-level semantics meets the triggering condition of the heap overflow vulnerability: when the network protocol software is executed along the program execution path, the write operation to the heap memory space can write too long data, causing the written data to cross the current heap space boundary; Step S405: Determine whether the multi-level semantics meets the use-after-free vulnerability triggering condition: when the network protocol software is executed along the program execution path, it can still read and write memory to the released memory space, resulting in a use-after-free vulnerability; Step S406: Determine whether the multi-level semantics meets the double-free vulnerability triggering condition: when the network protocol software is executed along the program execution path, the memory space that has been released can still be released again, resulting in a double-free vulnerability.

7. The network protocol software analysis method based on multi-layer semantic recovery according to claim 1 is characterized in that: The step S4 comprises: Step S4011: ReadCache indicates the five most recently accessed memory blocks, CurrentMerge indicates the fusion flag of the current memory access unit, CurrentUnit indicates the memory space currently being accessed, PreUnit indicates the fusion flag of the last memory access unit, PreUnit indicates the last accessed memory space, and ReadUnit indicates the currently accessed memory unit captured at the instruction layer, including the access address, the access memory length, and the current time; Step S4012: after the ReadUnit is monitored at the instruction layer, it is determined whether it can be merged with any memory block in the ReadCache. If it can be merged, it is merged and CurrentMerge is set to True; an attempt is made to merge the memory blocks in the ReadCache with each other; in this process, the assignment of CurrentUnit is completed; Step S4013: If the CurrentUnit flag is True, it means that the current ReadUnit has been processed and merged, and no further processing is performed; if the CurrentUnit is False, it means that the current ReadUnit cannot be merged and has not been processed, so it is directly inserted into the ReadCache for caching. If the ReadCache is full, the memory block with the earliest access time is deleted, and the CurrentUnit points to the ReadUnit; Step S4014: After the extraction of continuous memory access information is completed, the memory access is checked immediately; if CurrentMerge is False, it means that the current memory unit is not merged, that is, the current memory access unit is not continuous, then CurrentUnit is checked, and if PreMerge is True, it means that the last access memory unit has been merged, but the continuous reading and writing has ended so far, and the memory access check is performed on the PreUnit memory block; Step S4015: If CurrentMege is True, it means that the current memory unit has been merged, that is, the current memory access unit is continuous, and there is no need to check CurrentUnit; If PreMerge is also True, but PreUnit and CurrentUnit are not continuous with each other, it means that the memory block accessed last time was continuous, but is no longer continuous so far, and a memory access check is performed on the PreUnit memory block; Step S4016: The high-level semantic recovery of memory access and the check of vulnerability model have been completed, and the first and last work is performed, specifically: PreUnit = CurrentUnit, PreMerge = CurrentMerge, CurrentMerge = False.