IKE protocol fuzz testing method based on state guidance

By actively learning to infer the IKE protocol state machine and booting fuzz testing, the problem that traditional fuzz testing is difficult to detect deep vulnerabilities in the IKE protocol is solved, and efficient vulnerability detection effect is achieved.

CN119652801APending Publication Date: 2025-03-18SOUTHEAST UNIV

Patent Information

Application Number
CN202411853230.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

It is difficult for the prior art to effectively discover program vulnerabilities deep in the IKE protocol state machine through fuzzy testing, and traditional randomly generated test cases are not effective.

Method used

The state-guided IKE fuzz testing method is adopted to actively learn the protocol state machine of the target system, and use this state machine to guide fuzz testing to achieve efficient vulnerability detection.

Benefits of technology

Effectively detecting the deep protocol implementation vulnerabilities of the target system, making up for the flaws that traditional fuzz testing is too blind to the IKE protocol program, and can detect vulnerabilities in non-encrypted packets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119652801A_ABST
    Figure CN119652801A_ABST
Patent Text Reader

Abstract

The invention discloses an IKE (Internet Key Exchange) protocol fuzzy testing method based on state guidance, which is characterized in that an IKE session is established and interacted with a target system based on an active learning algorithm in model learning, and a state learning module deduces a state machine model when the target system realizes an IKE protocol in a member query and equivalent query mode; and meanwhile, the fuzzy test module takes the deduced state machine model as guidance, extracts a preorder guidance message sequence and a tested message of each state, carries out a black box-based fuzzy test on each state, and mines deep program vulnerabilities related to the IKE protocol.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of network security, and in particular relates to a fuzzy testing method for exploring the internal state of an encryption protocol IKE. Background Art

[0002] Virtual Private Network (VPN) is a type of service widely used in remote office scenarios. Its function is to establish a private network on the public network and provide external network access services based on encrypted tunnels. Compared with other enterprise business services, VPN remote access services are more open. For external visitors, VPN services may be the only entry point to access the internal network of an enterprise or organization. In recent years, attacks on VPN services of network devices have emerged in an endless stream. Therefore, security analysis of VPN services can help to pre-fix security vulnerabilities and prevent attacks before they occur.

[0003] Internet Key Exchange (IKE) is the most widely used encryption network protocol in VPN services. It is a protocol suite that includes multiple types of protocols, such as key exchange protocols IKEv1 and IKEv2, as well as secure communication protocols AH (Authentication Header) and ESP (Encapsulating Secure Payload). Its encryption and authentication logic is complex: Taking the IKEv2 protocol as an example, its authentication message involves four message types: IKE_SA_INIT, IKE_AUTH, CREATE_CHILD_SA, INFORMATIONAL. Each message type carries different payloads according to the way it establishes a secure association. In addition to IKE_INIT_SA, almost all messages and payloads in IKEv2 need to be authenticated by both parties of the communication, otherwise the responding end will consider the message as an invalid message and directly discard it. Due to this feature, the state machine corresponding to the IKE protocol implementation is complicated, and an effective method is needed to trigger a deeper level of protocol implementation logic through the encryption protocol handshake and authentication phases. In addition, there are significant differences in the structure and size of the devices that carry the IKE protocol: the functions of IoT devices are relatively simple, and the device hardware performance and operating system structure are relatively simple. Enterprise-level network equipment usually undertakes network traffic throughput, forwarding, access control, protection and other functions, so it requires high-performance hardware support and the equipment is usually large. At the same time, in order to adapt to the general trend of IP-based networks of operators in the new era and meet the growing reliability needs of operators, the system structure of enterprise-level network equipment has become increasingly complex and customized based on dedicated operating systems.

[0004] Fuzz testing is the most popular automated vulnerability discovery technology in recent years. Its main idea is to send automatically randomly generated test cases to the program under test, observe program anomalies, and discover possible program errors.

[0005] However, the effect of using traditional, randomly generated test cases to fuzz test the IKE protocol program is not ideal, and it is difficult to find program vulnerabilities hidden deep in the IKE protocol state machine. This is because the IKE protocol usually involves multiple complex steps such as key (re)negotiation, identity authentication, encryption and decryption, and integrity verification, and its protocol state and transfer logic are relatively complex. Therefore, for the complex IKE protocol, it is very necessary to conduct fuzz testing in combination with the network protocol state machine of the target system.

[0006] Based on the above research background and problems, the present invention adopts the following technologies to explore the deep-level and post-authentication protocol implementation vulnerabilities of the IKE protocol:

[0007] Mealy state machine: represented by a 6-tuple (S, S0, Σ, Λ, T, G):

[0008] Finite set of states (S)

[0009] The starting (initial) state (S0), which is an element of a finite set (S)

[0010] Finite set of input alphabets (Σ)

[0011] A finite set of output alphabets (Λ)

[0012] State transition function (T: S×Σ→S)

[0013] Output function (G: S×Σ→Λ)

[0014] From the above definition, it can be seen that the state transition of the Mealy state machine depends on the current state and input, that is, the next state of the system is determined by the current state and input. At the same time, the output of the Mealy state machine is also determined by the current state and input. This behavior is highly similar to the network protocol. In the network protocol, the next state of the system and the response returned to the sender depend on the content of the received message and the current state. Therefore, the network protocol can be represented by a Mealy type finite state machine.

[0015] Active Learning: The solution of inferring the network protocol state machine based on the active learning algorithm needs to interact with the target system during learning to ensure that the inferred state machine is minimal and correct. It learns the implementation state machine of the target system through the Learner-Teacher model. The algorithm assumes that there is a learner role, which has no prior knowledge of the target system; at the same time, there is a teacher role, which knows all the information of the target system and is used to answer all questions raised by the learner. During the learning process, the learner keeps asking the teacher whether a sentence belongs to a regular language. The Teacher will return a "yes" or "no" result to the Learner. This process is called a member query. When the Learner believes that it has learned a regular language through a member query Corresponding state machine model , the Learner will ask the Teacher to find out Is it the correct model? This process is called equivalence query. When the Teacher finds a counterexample through continuous testing, Accepted but If rejected, the counterexample is returned to the Learner to start a new round of learning. Consider the target regular language Equivalent deterministic finite automaton (DFA) model.

[0016] In summary, the present invention uses the state-guided IKE fuzzy testing technology to explore the state machine of the target system through active learning, and thereby guides the fuzzy test to run efficiently. Summary of the invention

[0017] In view of the above problems, the present invention proposes a state-guided IKE protocol fuzz testing method, which learns the internal protocol implementation state machine of the target system and uses state-guided technology to implement fuzz testing based on the state machine to achieve efficient fuzz testing. The core of the invention is the state inference technology based on active learning.

[0018] To achieve the purpose of the present invention, the technical solution of the present invention is as follows: a state-guided IKE protocol fuzz testing method, which uses active learning to infer the protocol state machine of the target system and uses this as the coverage of the fuzz test to guide the fuzz test. The method includes the following steps:

[0019] (1) The user determines the basic configuration information for this state learning;

[0020] (2) Use active learning to infer the target system state machine;

[0021] (3) The fuzz testing module analyzes the state machine obtained in step (2), and the user determines the target state to be audited.

[0022] (4) Perform fuzz testing and display the progress of the fuzz testing, whether vulnerabilities are generated, and details of the data packets that generate vulnerabilities in real time.

[0023] As an improvement of the present invention, the specific method of step (1) is as follows: (1.1) The user determines the target of this state learning, including IP address and port,

[0024] (1.2) The user decides the encryption protocol attributes required for this study, including the encryption suite (encryption algorithm, authentication algorithm, hash algorithm, etc.), authentication method, etc.

[0025] (1.3) The user determines the learning-related attributes required for this learning, including timeout duration, number of retransmissions, status reset commands, etc.

[0026] In this way, the method is not limited to the state learning of a single target and a single encryption suite, but realizes user-defined state learning and achieves a higher controllability.

[0027] As an improvement of the present invention, the design method of the target system state machine using active learning in step (2) is as follows:

[0028] (2.1) The active learning algorithm maintains a mapping between the alphabet and the real message, where the alphabet contains prefixes that can be accepted for message description, such as "ike_sa_init". Active learning continuously selects several letter sequences from the alphabet at random and sends the corresponding data packet to the corresponding target system according to the letter sequence.

[0029] (2.2) Data packet generation based on message template: According to the data packet label in (2.1), read the XML template file corresponding to the data packet, parse the various fields of the XML file, assemble it into a data packet, and send it to the target system. According to the system's corresponding message (timeout if no response), it is converted into a corresponding response sequence for the active learning model to learn.

[0030] (2.3) The active learning algorithm determines whether the current round of learning of the target system is complete based on the principles of closure and consistency. The algorithm continuously constructs test sentences based on the mapping in (2.1) to perform member queries, fills the observation table based on the results, and determines the closure and consistency of the observation table. Closure means that no new state has been generated at present; consistency check is to correct incorrect equivalent row judgments.

[0031] (2.4) State reset: During the state machine inference and black box fuzz testing process, it is necessary to ensure that each round of learning / testing starts from the initial state. This requires resetting the target system to the initial state at the end of each round of learning. This stage resets the state of the target system for the (1.3) user configuration reset command. Since the IKE protocol is designed based on the UDP protocol, it is impossible to end the session by disconnecting the connection. Therefore, other methods need to be found to ensure that each learning and fuzz testing starts from the initial state and will not be affected by the previous session. In order to solve this problem, the invention uses two methods to achieve the reset of the session state.

[0032] (2.4.1) SPI randomization: In the IKE protocol, SPI not only identifies the identities of the communicating parties, but is also responsible for maintaining the session. A specific pair of IKE SPI values ​​identifies an IKE session, and a specific pair of Child SPI values ​​identifies an IPsec session.

[0033] (2.4.2) SA reset command: The randomization of SPI can only ensure that each round of learning and fuzzy testing starts from the initial state, but it cannot guarantee that the results caused by the previous session will not affect the subsequent process. For example, in the early learning and testing, a large number of semi-open or fully open IKE SAs may be created. These IKE SAs not only take up a lot of memory space, but may also cause the target system to reject the establishment of new IKE SAs and ask the initiator for cookies. Therefore, for the IKEv2 protocol, it is necessary to ensure that each round of learning or fuzzy testing is independent of each other, that is, the previously established SAs have been cleared. The present invention uses the configuration commands provided by the system CLI to clear the old SA, and executes the commands through the Telnet or SSH interface provided by the device. Since different devices use different commands, it is necessary to set a reset command for each device separately.

[0034] As an improvement of the present invention, the specific method of step (3) is as follows:

[0035] (3.1) The fuzz testing module parses the state machine learned by active learning: Generally, the state machine model of the network protocol has an initial state and one or more end states. The path from the initial state to each state is unidirectional, so the state machine model can be represented by a tree structure, where each node in the tree represents each state, and each edge represents the state transition mode, that is, what kind of data packet sent causes the state transition. Therefore, the state parser converts the input state machine model into a program-readable state transition tree.

[0036] (3.2) Users can select more important tree nodes (states) in the state transition tree as the focus states for subsequent fuzz testing.

[0037] As an improvement of the present invention, the specific method of step (4) is as follows:

[0038] (4.1) Perform fuzzy testing based on the guided state: According to the key state selected by the user, the leading node sequence to reach the state is obtained from the state transition tree and converted into the corresponding leading data packet character sequence. The method extracts the corresponding leading data packet from the database based on the sequence and sends it to the target system.

[0039] (4.2) Key state data packet mutation: The fields in the message are divided into three types: string, binary data and integer data. For different types of data fields, the invention method adopts different mutation strategies

[0040] (4.2.1) String type fields. For string type fields, the rules used by the generator are: (1) changing the length of the string, such as extending it to an overlong string, or changing the string to an empty string; (2) adding special characters, such as adding formatting string related characters to trigger formatting string vulnerabilities, or inserting command injection type strings to detect command injection vulnerabilities.

[0041] (4.2.2) Binary type field. For binary type fields, the rules used by the generator are: (1) using a byte-by-byte mutation strategy, mutating each byte from 0x00 to 0xFF, and keeping other byte data in the same field unchanged; (2) changing the length of the binary data, changing the length from 0 bytes to 1024 bytes.

[0042] (4.2.3) Integer fields. Integer data usually indicates length. For such data fields, the generator changes the field value to all values ​​from 0 to 1024, as well as the maximum value that can be represented.

[0043] (4.3) Anomaly detection: Since black box fuzz testing cannot determine the occurrence of anomalies by exploring the internal state of the program (such as memory state), it is necessary to monitor anomalies by observing the external state of the device. The inventive method uses the following two methods to achieve anomaly detection:

[0044] (4.3.1) Telnet or SSH session monitoring: The old IKE session is cleared by executing the CLI command of the target device through the Telnet or SSH interface. Therefore, during the entire fuzz testing process, a TCP long connection will be established with the target device to send and receive Telnet or SSH data.

[0045] (4.3.2) IKE port monitoring: IKE is an application layer network protocol based on UDP. It is a connectionless protocol, so it is impossible to determine whether a crash has occurred by whether the network connection is disconnected. When the target program crashes, the IKE port must be closed, so whether the crash exception has occurred can be determined by whether the IKE port is open.

[0046] Through the above steps, the IKE protocol fuzzy testing technology using the status as feedback is implemented.

[0047] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the program, the boot-based IKE protocol fuzzy testing method is implemented.

[0048] A computer-readable storage medium stores computer instructions, which, when executed by a processor, implement a boot-based IKE protocol fuzzy testing method.

[0049] Compared with the prior art, the advantages of the present invention are as follows:

[0050] (1) Through active learning, the traditional black-box fuzz testing method for the encryption protocol IKE is expanded to a gray-box testing method with state feedback. This method can effectively detect deep-level protocol implementation vulnerabilities of the target system;

[0051] (2) Through state guidance, it makes up for the defect that the traditional fuzzy testing program for the IKE protocol is too blind and can only detect non-encrypted messages. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 A state-guided IKE protocol fuzz testing framework.

[0053] Figure 2 Network topology diagram,

[0054] Figure 3IKE syntax template - INFORMATIONAL message template for deleting Child SA,

[0055] Figure 4 Example of state machine obtained by state learning,

[0056] Figure 5 Example of a state transition tree. DETAILED DESCRIPTION

[0057] In order to deepen the understanding of the present invention, the present invention is described in detail below with reference to the accompanying drawings. Figure 1-Figure 5 ,A state-guided IKE protocol fuzz testing framework utilizes active learning to detect the IKE protocol implementation state machine of the IKE target system and uses it to guide the fuzz testing.

[0058] like Figure 1 As shown, it is a state-guided IKE protocol fuzz testing framework.

[0059] The entire architecture consists of active learning and fuzz testing stages, where active learning modules include Learner, Mapper, IKE protocol client and target server. Learner is the core of the active learning algorithm, which is equipped with an active learning algorithm. The corresponding character sequence is selected by the algorithm, and the Mapper converts the character sequence into the corresponding real data packet sequence, which is then sent to the target system by the IKE protocol client. Finally, Learner converts the response of the target system into the corresponding response string (sequence) to infer the protocol implementation state machine of the target system; the fuzz testing stage uses the state machine of the active learning stage, which is parsed into a protocol conversion tree by StateParser and sent to the target system by the fuzz tester (Fuzzer) after mutation, in order to achieve the purpose of exploring deep-level vulnerabilities in the target system.

[0060] In order to better illustrate the steps of the state-guided IKE protocol fuzzy testing method, an example is used to introduce the inventive method:

[0061] By Equipment Figure 2 Taking the shown architecture as an example, the fuzzy learning process is described. Figure 2 The communication topology diagram of the Fortinet firewall IKE VPN built in the EVE-NG simulator is shown. The external interface IP addresses of the two firewalls are 100.1.1.1 and 100.1.1.100, respectively. Fortinet2 is our experimental target. The internal interface IP address of firewall Fortinet1 is 172.16.0.1, which controls the subnet 172.16.0.0 / 24 as a gateway. The internal interface IP address of firewall Fortinet2 is 10.1.1.1, which controls the subnet 10.1.1.0 / 24 as a gateway.

[0062] In the active learning phase, the steps are:

[0063] (1) Determine the basic configuration information for this state learning, such as the IP address is 100.1.1.100 and the port is 500.

[0064] (2) Determine the encryption protocol properties required for this study, such as the encryption algorithm, authentication algorithm, key exchange algorithm and method, which are DES, SHA512, Diffie-Hellman-14, and PSK respectively.

[0065] (3) Configure the reset command to diagnose vpn ike gateway clear to start the active learning algorithm.

[0066] Active learning is called according to the string sequence, calling the corresponding syntax template to generate the corresponding protocol message. For template examples, refer to Figure 3 , which shows the INFORMATIONAL message template for deleting a CHILD SA.

[0067] This stage generates the following results: Figure 4 As shown in Figure 1, it shows an example of a state diagram obtained by state learning. Each node is the protocol implementation state corresponding to the target server, and the edges are the corresponding messages.

[0068] In the fuzz testing phase, the steps are as follows:

[0069] (1) According to the state machine obtained in the active learning phase, it is converted into a state transition tree. The state transition tree reference Figure 5 , which converts the original state machine graph structure into a tree structure

[0070] (2) The more important tree nodes (states) in the user configuration state transition tree are used as key focus states for subsequent fuzz testing.

[0071] (3) Start the fuzz test. The fuzz tester performs fuzz testing according to the built-in mutation strategy and seed strategy.

[0072] (4) The user checks whether the device has any vulnerabilities based on the UI interface.

[0073] It should be noted that the above embodiments are not intended to limit the protection scope of the present invention, and equivalent changes or substitutions made on the basis of the above technical solutions all fall within the protection scope of the claims of the present invention.

Claims

1. A state-guided IKE protocol fuzzy testing method, characterized in that: The method comprises the following steps: (1) The user determines the basic configuration information for this state learning; (2) Use active learning to infer the target system state machine; (3) The fuzz testing module analyzes the state machine obtained in step (2), and the user determines the target state to be audited. (4) Perform fuzz testing and display the progress of the fuzz testing, whether a vulnerability is generated, and the details of the message that generated the vulnerability in real time.

2. The IKE protocol fuzzy testing method based on state guidance according to claim 1 is characterized in that: The specific method of step (1) is as follows (1.1) The user determines the target of this state learning, including IP address and port. (1.2) The user decides the encryption protocol attributes required for this study, including encryption suite and authentication method. (1.3) The user determines the relevant attributes required for this learning, including timeout duration, number of retransmissions, and status reset command.

3. The IKE protocol fuzzy testing method based on guidance according to claim 1, characterized in that: The design method of the target system state machine using active learning in step (2) is as follows: (2.1) The active learning algorithm maintains a mapping between the alphabet and the real message, where the alphabet contains the prefixes of acceptable message descriptions. Active learning continuously selects a number of letter sequences from the alphabet at random and sends the corresponding message to the corresponding target system according to the letter sequence. (2.2) Template-based message generation: According to the message tag in (2.1), read the XML template file corresponding to the message, parse the various fields of the XML file, assemble it into a message, and send it to the target system. According to the system response message, convert it into a corresponding response sequence for the active learning model to learn. (2.3) The active learning algorithm determines whether the current round of learning of the target system is completed according to the principles of closure and consistency. The algorithm continuously constructs test sentences according to the mapping in (2.1) to perform member queries, fills the observation table according to the results, and determines the closure and consistency of the observation table. Closure means that no new state has been generated at present; consistency check is to correct incorrect equivalent row judgments. (2.4) State reset: In the process of state machine inference and black box fuzz testing, it is necessary to ensure that each round of learning / testing starts from the initial state. This requires that the target system be reset to the initial state at the end of each round of learning. In this stage, the state of the target system is reset according to the user configuration reset command (1.3). Since the IKE protocol is designed based on the UDP protocol, it is impossible to end the session by disconnecting the connection. (2.4.1) Security Parameter Index (SPI) randomization: In the IKE protocol, SPI not only identifies the identities of the communicating parties, but is also responsible for maintaining the session. A specific pair of IKE SPI values ​​identifies an IKE session, and a specific pair of Child SPI values ​​identifies an IKE session. (2.4.2) Security Association (SA) reset command: SPI randomization can only ensure that each round of learning and fuzz testing starts from the initial state.

4. The method of claim 1, wherein the IKE protocol fuzzy testing method is based on guidance. The specific method of step (3) is as follows: (3.1) The fuzz testing module parses the state machine learned by active learning: The state machine model of the network protocol has an initial state and one or more end states. The path from the initial state to each state is unidirectional. Therefore, the state machine model can be represented by a tree structure, where each node in the tree represents each state, and each edge represents the state transition method, that is, what kind of message sent causes the state transition. Therefore, the state parser converts the input state machine model into a program-readable state transition tree. (3.2) Users can select more important tree nodes (states) in the state transition tree as the focus states for subsequent fuzz testing.

5. The method of guiding IKE protocol fuzz testing according to claim 1, characterized in that: The specific method of step (4) is as follows: (4.1) Perform fuzzy testing based on the guided state: According to the key state selected by the user, obtain the leading node sequence that reaches the state from the state transition tree and convert it into the corresponding leading message character sequence. At the same time, extract the corresponding leading message from the database based on the sequence and send it to the target system. (4.2) Key Status Message Mutation: The fields in the message are divided into three types: string, binary data, and integer data. Different mutation strategies are used for different types of data fields. (4.2.1) String type fields. For string type fields, the rules used by the generator are: (1) Changing the length of a string, including extending it to an overlong string, or changing the string to an empty string; (2) Add special characters, including adding format string related characters to trigger format string vulnerabilities, or inserting command injection type strings to detect command injection vulnerabilities. (4.2.2) Binary type fields. For binary type fields, the rules used by the generator are: (1) using a byte mutation strategy to mutate each byte from 0x00 to 0xFF, leaving other byte data in the same field unchanged; (2) Change the length of the binary data from 0 bytes to 1024 bytes. (4.2.3) Integer fields. Integer data usually indicates length. For such data fields, the generator changes the value of the field to all values ​​from 0 to 1024, as well as the maximum value that can be represented. (4.3) Anomaly detection: Since black box fuzz testing cannot determine the occurrence of anomalies by exploring the internal state of the program, it is necessary to monitor anomalies by observing the external state of the device. The following two methods are used to implement anomaly detection: (4.3.1) Telnet or SSH session monitoring: Execute the target device’s CLI command through the Telnet or SSH interface to clear the old IKE session. Therefore, during the entire fuzz testing process, a TCP long connection will be established with the target device to send and receive Telnet or SSH data. (4.3.2) IKE port monitoring: IKE is an application layer network protocol based on UDP. It is a connectionless protocol. Therefore, it is impossible to determine whether a crash has occurred by the status of the network connection. When the target program crashes, the IKE port must be in a closed state. Whether a crash exception has occurred can be determined by whether the IKE port is open.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the boot-based IKE protocol fuzzy testing method as described in any one of claims 1 to 5 is implemented.

7. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the computer instruction is executed by the processor, a guidance-based IKE protocol fuzzy testing method as described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Industrial control protocol fuzzing test method based on protocol state

    CN105763392A

  • Fuzzy test script based on protocol state machine and test engine

    CN110532162A

  • Gigabit Ethernet adapter supporting the iSCSI and IPSEC protocols

    US20040062267A1

  • Method and apparatus for secure internet protocol (IPSEC) offloading with integrated host protocol stack management

    US20060104308A1

  • Secure Executable Code Update for a Securely-Bootable Processing Chip

    US20210312053A1

Cited By

  • Dynamic access control method and device applied to B5G network, equipment and medium

    CN121218176A

  • A dynamic access control method and device applied to a B5G network, equipment and medium

    CN121218176B