Fuzzy test method and system, electronic equipment and computer storage medium
By using a fuzzy testing system between a 4G/5G communication base station and the terminal under test, and leveraging the data format and analog-to-digital conversion of the communication protocol stack and software-defined radio hardware layer, target test cases are generated and sent. This solves the problem of insufficient accuracy in existing fuzzy testing technologies, achieving cost savings and improved success rates.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SIWEI TECH (WUHAN) CO LTD
- Filing Date
- 2026-02-10
- Publication Date
- 2026-05-05
AI Technical Summary
In 4G/5G network communication, existing technologies struggle to effectively generate and process test cases to improve the accuracy of fuzz testing.
By using a fuzz testing system between a 4G/5G communication base station and the terminal under test, a test case library is generated using the communication protocol stack. Data format conversion and digital-to-analog conversion are performed through the software-defined radio hardware layer to generate target test cases for fuzz testing.
This significantly reduces the cost of generating test cases and improves the success rate and accuracy of fuzz testing.
Smart Images

Figure CN121985359A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of network communication connection technology, and more specifically, to a fuzz testing method, system, electronic device, and computer storage medium. Background Technology
[0002] With the development of communication network technology and the shortcomings of 2G / 3G networks in the data era, such as low spectrum efficiency and limited service support capabilities, 4G / 5G networks have emerged as the next generation of mobile communication technology.
[0003] For terminal devices using 4G / 5G networks as communication technologies, how to generate and process test cases during the communication process between the terminal device and the 4G / 5G network base station to perform fuzz testing on the wireless protocols in the 4G / 5G communication field, thereby improving the accuracy of fuzz testing, has become an important research topic. Summary of the Invention
[0004] This disclosure provides a fuzz testing method, system, electronic device, and computer storage medium that can improve the accuracy of fuzz testing.
[0005] Firstly, this disclosure relates to a fuzz testing method applied to a fuzz testing system based on a 4G / 5G communication network protocol. The fuzz testing system includes a 4G / 5G communication base station and a terminal under test (DUT) connected by communication. The 4G / 5G communication base station includes a communication protocol stack and a software-defined radio hardware layer connected by communication. The communication protocol stack is used to generate a test case library required for performing fuzz testing between the 4G / 5G communication base station and the DUT. The software-defined radio hardware layer is used to send the test cases from the test case library sent by the communication protocol stack to the DUT and receive test cases from the DUT. The method includes: controlling the communication protocol stack to detect whether there are unexecuted test cases in the test case library; if an unexecuted test case is detected in the test case library, selecting a test case from the test case library in a preset order as an initial test case; controlling the communication protocol stack to perform data format conversion on the initial test case to obtain an intermediate test case; controlling the software-defined radio hardware layer to perform digital-to-analog conversion on the intermediate test case to obtain a target test case; and controlling the software-defined radio hardware layer to send the target test case to the terminal under test to perform fuzz testing.
[0006] This embodiment of the application can determine initial test cases when the communication protocol stack detects unexecuted test cases in the test case library. The communication protocol stack first performs data format conversion on the initial test cases to obtain intermediate test cases in a digital format recognizable by the software-defined radio hardware layer. Then, the software-defined radio hardware layer performs digital-to-analog conversion on the intermediate test cases to obtain target test cases in analog signal form. Finally, the software-defined radio hardware layer directly sends the target test cases to the terminal device using 4G / 5G network as the communication technology. This significantly reduces the cost of test case generation and improves the success rate and correctness of fuzz testing.
[0007] In some embodiments, the software-defined radio hardware layer is provided with a radio frequency interface based on software-defined radio, the terminal under test is provided with a wireless communication interface, and the terminal under test is communicatively connected to the software-defined radio hardware layer through the radio frequency interface and the wireless communication interface; controlling the software-defined radio hardware layer to send the target test case to the terminal under test to perform fuzz testing includes: controlling the software-defined radio hardware layer to send the target test case to the terminal under test through the radio frequency interface and the wireless communication interface to perform fuzz testing.
[0008] In some embodiments, the communication protocol stack includes a control layer, which is communicatively connected to the software-defined radio hardware layer; controlling the communication protocol stack to detect whether there are unexecuted test cases in the test case library includes: controlling the control layer to detect whether there are unexecuted test cases in the test case library; if an unexecuted test case is detected in the test case library, selecting a test case from the test case library as an initial test case according to a preset order includes: if an unexecuted test case is detected in the test case library, controlling the control layer to select a test case from the test case library as the initial test case according to the preset order.
[0009] In some embodiments, the communication protocol stack includes a protocol layer that is communicatively connected to the software-defined radio hardware layer. Controlling the communication protocol stack to perform data format conversion on the initial test cases to obtain intermediate test cases includes: controlling the protocol layer to perform data format conversion on the initial test cases to obtain the intermediate test cases.
[0010] In some embodiments, the protocol layer includes a state machine for communication connections and a protocol encoding / decoding module. The state machine is used to sense protocol state changes of the 4G / 5G communication network protocol and manage the protocol context of the 4G / 5G communication network protocol. The protocol encoding / decoding module is used to perform encoding / decoding operations on all test cases. Controlling the protocol layer to perform data format conversion on the initial test cases to obtain the intermediate test cases includes: controlling the protocol encoding / decoding module to perform data format conversion on the initial test cases to obtain the intermediate test cases; after controlling the protocol encoding / decoding module to perform data format conversion on the initial test cases to obtain the intermediate test cases, the method further includes: based on the initial test cases... For example, determining the target communication state, which is the communication state that the 4G / 5G communication base station and the terminal under test need to be in before the 4G / 5G communication base station sends the initial test case to the terminal under test to perform fuzz testing; controlling the 4G / 5G communication base station and the terminal under test to communicate based on the state machine, so that the 4G / 5G communication base station and the terminal under test are in the target communication state; controlling the software-defined radio hardware layer to perform digital-to-analog conversion on the intermediate test cases to obtain the target test cases includes: based on the target communication state, controlling the software-defined radio hardware layer to perform digital-to-analog conversion on the intermediate test cases to obtain the target test cases.
[0011] In some embodiments, the protocol layer further includes a protocol module, which communicatively connects the state machine and the protocol encoding / decoding module. The protocol module is used to encapsulate all test cases in the test case library according to a preset encapsulation order. The protocol encoding / decoding module is used to perform encoding / decoding operations on all the test cases encapsulated by the protocol module. The step of controlling the software-defined radio hardware layer to perform digital-to-analog conversion on the intermediate test cases based on the target communication state to obtain the target test case includes: performing data injection processing on the intermediate test cases based on the target communication state, and controlling the protocol module to encapsulate the intermediate test cases after data injection processing to obtain mutated test cases; injecting the mutated test cases into the software-defined radio hardware layer; and controlling the software-defined radio hardware layer to perform digital-to-analog conversion on the mutated test cases to obtain the target test case.
[0012] Secondly, this disclosure also relates to a fuzz testing system based on a 4G / 5G communication network protocol. The fuzz testing system includes a 4G / 5G communication base station and a terminal under test (DUT) connected by communication. The 4G / 5G communication base station includes a communication protocol stack and a software-defined radio hardware layer connected by communication. The communication protocol stack is used to generate a test case library required for performing fuzz testing between the 4G / 5G communication base station and the DUT. The software-defined radio hardware layer is used to send test cases from the test case library sent by the communication protocol stack to the DUT and receive response messages from the DUT. The communication protocol stack is used to detect whether there are any unexecuted test cases in the test case library. If unexecuted test cases are detected, a test case is selected from the test case library in a preset order as an initial test case. The communication protocol stack is also used to perform data format conversion on the initial test case to obtain intermediate test cases. The software-defined radio hardware layer is used to perform digital-to-analog conversion on the intermediate test cases to obtain target test cases and send the target test cases to the DUT to perform fuzz testing.
[0013] In some embodiments, the software-defined radio hardware layer is provided with a software-defined radio-based radio frequency interface, the terminal under test is provided with a wireless communication interface, and the terminal under test is communicatively connected to the software-defined radio hardware layer through the radio frequency interface and the wireless communication interface; the software-defined radio hardware layer is also used to send the target test case to the terminal under test through the radio frequency interface and the wireless communication interface to perform fuzz testing.
[0014] Thirdly, this disclosure also relates to an electronic device, the electronic device comprising: a memory storing computer-readable instructions; and a processor executing the computer-readable instructions stored in the memory to implement the fuzz testing method as described above.
[0015] Fourthly, this disclosure also relates to a computer storage medium storing computer-readable instructions that are executed by a processor in an electronic device to implement the fuzz testing method described above.
[0016] The fuzzy testing system in the second aspect, the electronic equipment in the third aspect, and the computer storage medium in the fourth aspect correspond one-to-one with the technical features of the fuzzy testing method in the first aspect, and produce the same technical effects, which will not be elaborated here. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of the structure of the fuzz testing system according to an embodiment of this application.
[0018] Figure 2 This is a flowchart illustrating the steps of the fuzz testing method according to an embodiment of this application.
[0019] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0020] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0021] It should be understood that the various steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0022] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0023] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0024] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0025] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0026] This application provides a fuzz testing method, system, electronic device, and computer storage medium.
[0027] Please see Figure 1 As shown, Figure 1This is a schematic diagram of the fuzz testing system. The fuzz testing method in this embodiment is applied to a fuzz testing system based on 4G / 5G communication network protocols. The fuzz testing system includes a 4G / 5G communication base station and a terminal under test (DUT) connected by communication. The 4G / 5G communication base station includes a communication protocol stack and a software-defined radio (SDR) hardware layer connected by communication. The communication protocol stack is used to generate a test case library required for performing fuzz testing between the 4G / 5G communication base station and the DUT. The SDR hardware layer is used to send test cases from the test case library sent by the communication protocol stack to the DUT and receive response messages from the DUT. The test case library includes at least one test case for performing fuzz testing. Software-defined radio (SDR) is a radio broadcast communication technology that is based on a software-defined wireless communication protocol rather than hard-wired implementation. Frequency bands, air interface protocols, and functions can be upgraded through software downloads and updates without completely replacing the hardware. Setting up a SDR hardware layer in the 4G / 5G communication base station provides strong flexibility and openness in the communication connection between the 4G / 5G communication base station and the DUT.
[0028] Before performing fuzz testing, the fuzz testing system in this embodiment controls the communication connection between the 4G / 5G communication base station and the terminal under test. Then, the fuzz testing system executes the fuzz testing method, generates a test case library from the communication protocol stack, and sends the test cases from the test case library to the software-defined radio hardware layer. Finally, the software-defined radio hardware layer sends the test cases (i.e., Figure 1 The system sends the mutated message (in the test case) to the terminal under test to perform fuzz testing and receives the response message from the terminal under test after receiving the test case.
[0029] Furthermore, the communication protocol stack in the 4G / 5G communication base station receives the response messages sent by the software-defined radio and parses the response messages to determine the execution status of the fuzz test.
[0030] In this embodiment, the fuzz testing system may further include a control terminal. The control terminal is communicatively connected to a 4G / 5G communication base station and the terminal under test. The test engineer can control the 4G / 5G communication base station through the control terminal to modify its relevant configuration parameters, thereby enabling communication between the 4G / 5G communication base station and the terminal under test. The control terminal can be an electronic device such as a laptop computer.
[0031] It should be noted that, in this embodiment, fuzz testing refers to the test engineer controlling the 4G / 5G communication base station to connect to the terminal under test via a control terminal, and having the 4G / 5G communication base station send test cases to the terminal under test, monitoring the response of the terminal under test, and judging the execution status of the fuzz test based on the response messages sent by the terminal under test to the 4G / 5G communication base station.
[0032] See Figure 2 As shown, Figure 2 This is a flowchart illustrating the steps of an embodiment of the fuzzing method of this application. Depending on different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted. The fuzzing method may include the following steps.
[0033] Step 101: Control the communication protocol stack to detect whether there are any unexecuted test cases in the test case library. If an unexecuted test case is detected in the test case library, select a test case from the test case library in a preset order as the initial test case.
[0034] In this embodiment, the communication protocol stack includes a control layer, which communicates with the software-defined radio hardware layer. The control layer is used to generate a test case library required for performing fuzz testing. Specifically, the fuzz testing system controls the control layer to detect whether there are any unexecuted test cases in the test case library. If an unexecuted test case is detected, the control layer selects a test case from the test case library in a preset order as the initial test case. The preset order can be set to a first-in, first-out (FIFO) format; this application does not restrict the preset order, and it can be set according to the actual needs of performing fuzz testing.
[0035] Furthermore, the communication protocol stack comprises multiple communication layers from top to bottom; that is, the control layer is one of these communication layers. All communication layers are connected to the software-defined radio hardware layer. Besides generating the test case library, the control layer is also responsible for orchestrating the order of test cases in the library, selecting test cases from the library in a preset order, sending them to the next communication layer, and monitoring the execution of fuzz tests.
[0036] Specifically, please refer to Figure 1The control layer includes a test case generator, a test case orchestrator, a test case executor, and a test status monitor. These components are interconnected. The test case generator generates a test case library, and the test case orchestrator arranges the execution order (i.e., the preset order) of the test cases in the library. The test case executor determines and executes the current test case according to the preset order, and selects the next test case from the library to ensure execution of the next test case after the current one has finished. The test status monitor monitors the status of the next communication layer and the feedback signals from the terminal under test.
[0037] The test case generator in this embodiment can generate a test case library based on seed test cases. Seed test cases serve as the starting point or basic input in the fuzzing process, representing a set of initial, typical, and valid data samples. The test case generator can then generate a large number of illegal, abnormal, or marginal test cases by applying various mutations and changes to these seed test cases. The seed test cases in this embodiment can be obtained through methods such as 4G / 5G communication protocol specification documents.
[0038] In this embodiment, when the control layer of the fuzzing system detects that there are still unexecuted test cases in the test case orchestrator, the test case orchestrator selects a test case from the test case library in a preset order as the initial test case. The test case executor then injects the initial test case into the next communication layer, and the test status monitor monitors the execution status of the initial test case.
[0039] Step 102: Control the communication protocol stack to convert the data format of the initial test cases to obtain intermediate test cases.
[0040] The communication protocol stack in this embodiment also includes a protocol layer, a control layer communication connection protocol layer, and a software-defined radio hardware layer. It can be understood that a 4G / 5G communication base station includes, from top to bottom, a control layer, a protocol layer, and a software-defined radio hardware layer.
[0041] In this embodiment, the test case executor injects the initial test cases into the protocol layer, and then the protocol layer performs data format conversion on the initial test cases to obtain intermediate test cases.
[0042] Furthermore, the protocol layer includes a state machine for communication connections and a protocol encoding / decoding module. The state machine is used to sense the protocol state changes of the 4G / 5G communication network protocol and manage the protocol context of the 4G / 5G communication network protocol. The protocol encoding / decoding module is used to perform encoding and decoding operations on all test cases.
[0043] The fuzzing system's control protocol encoding / decoding module converts the data format of the initial test cases to obtain intermediate test cases. After obtaining the intermediate test cases, the system further includes: determining the target communication state based on the initial test cases. The target communication state is the communication state that the 4G / 5G communication base station and the terminal under test must be in before the 4G / 5G communication base station sends the initial test cases to the terminal under test to execute the fuzzing test. Based on a state machine, the system controls the communication between the 4G / 5G communication base station and the terminal under test to ensure that they are in the target communication state.
[0044] In this embodiment, the test case generator communicates with the state machine, and the test case generator can also generate a test case library based on seed test cases and the state machine.
[0045] It should be noted that, in this embodiment, the data format conversion of the initial test cases refers to converting the initial test cases in structured text format or data set format into test cases in a preset number base format. The preset number base format can be binary, and the structured text format can be JSON or XML, etc.
[0046] Step 103: Control the software-defined radio hardware layer to perform digital-to-analog conversion on the intermediate test cases to obtain the target test cases.
[0047] In this embodiment, based on the target communication state, the fuzzy testing system controls the software-defined radio hardware layer to perform digital-to-analog conversion on intermediate test cases to obtain the target test cases.
[0048] It should be noted that in this step, the 4G / 5G communication base station and the terminal under test must be in the target communication state before the intermediate test cases can be converted from digital to analog. This is because in any communication connection process, it is necessary to establish physical / link layer connectivity, protocol parameter matching, handshake or authentication completion, basic interaction verification, and other steps before fuzz testing can be performed.
[0049] The software-defined radio hardware layer performs analog-to-digital conversion on intermediate test cases, which means converting intermediate test cases with digital signals into target test cases with analog signals so that the terminal under test can receive the target test cases.
[0050] Furthermore, in order to ensure the correctness of the digital-to-analog conversion of intermediate test cases by the software-defined radio hardware layer, the intermediate test cases also need to be processed by the protocol layer. The specific execution steps will be described below.
[0051] The protocol layer also includes a protocol module, a communication connection state machine, and a protocol encoding / decoding module. The protocol module is used to encapsulate all test cases in the test case library according to a preset encapsulation order, and the protocol encoding / decoding module is used to encapsulate and decode all test cases encapsulated by the protocol module.
[0052] (1) Based on the target communication state, data injection processing is performed on the intermediate test cases, and the control protocol module encapsulates the intermediate test cases after data injection processing to obtain mutated test cases.
[0053] In this embodiment, after establishing the target communication state between the 4G / 5G communication base station and the terminal under test, fuzz testing can be performed based on intermediate test cases. Data injection processing of intermediate test cases refers to the control layer injecting the intermediate test cases into the protocol layer, and the protocol module encapsulating the intermediate test cases to obtain mutated test cases.
[0054] (2) Inject variant test cases into the software-defined radio hardware layer. That is, the protocol layer injects variant test cases into the software-defined radio hardware layer.
[0055] (3) The control software defines the radio hardware layer to perform digital-to-analog conversion on the variant test cases to obtain the target test cases.
[0056] In this embodiment, the software-defined radio hardware layer converts the variation test cases of digital signals into target test cases of analog signals, which facilitates the sending of the target test cases of analog signals to the terminal under test for fuzz testing.
[0057] Step 104: Control the software-defined radio hardware layer to send the target test cases to the terminal under test to perform fuzz testing.
[0058] In this embodiment, the software-defined radio hardware layer is equipped with a radio frequency (RF) interface based on software-defined radio, and the terminal under test (DUT) is equipped with a wireless communication interface. The DUT communicates with the software-defined radio hardware layer through the RF interface and the wireless communication interface. Furthermore, the software-defined radio hardware layer is controlled to send target test cases to the DUT through the RF interface and the wireless communication interface to perform fuzz testing.
[0059] The purpose of setting up a software-defined radio hardware layer is to enable 4G / 5G communication base stations to achieve radio communication functions without the need for dedicated hardware circuits (such as filters, modulators, demodulators, etc.). The terminal under test (DUT) is equipped with a wireless communication interface, and can communicate with the software-defined radio hardware layer through the RF interface and the wireless communication interface, eliminating the need for the hardware facilities required in traditional fuzzy testing techniques.
[0060] The following section will focus on the encapsulation process of test cases in the protocol module, as follows: There is also a driver layer between the software-defined wireless hardware layer and the protocol layer. The protocol module includes the top-down Radio Resource Control layer, Packet Data Convergence Protocol layer, Radio Link Control layer and Media Access Control layer. The Radio Resource Control layer, Packet Data Convergence Protocol layer, Radio Link Control layer and Media Access Control layer communicate with each other.
[0061] The Radio Resource Control (RRC) layer is responsible for establishing and managing the communication path between the 4G / 5G base station and the terminal under test. The Packet Data Convergence Protocol (PDCP) layer is used to package and encrypt the test cases sent by the control layer. The Radio Link Control (RLC) layer is used to segment and reassemble the packaged and encrypted test cases sent by the PRC layer. The Media Access Control (MAC) layer is used to assemble the segmented and reassembled test cases sent by the RLC layer to obtain the encapsulated test cases.
[0062] In this embodiment, the Radio Resource Control (RRC) layer is responsible for higher-layer signaling, such as connection establishment, mobility management, and broadcast system information. The Packet Data Convergence Protocol (PDCP) layer is mainly responsible for encrypting or protecting the integrity of data during the communication protocol process, and for header compression. The Radio Link Control (RANC) layer is mainly responsible for segmenting or reassembling data packets during the communication protocol process, and for error correction and confirmation. The Media Access Control (MAC) layer is mainly responsible for multiplexing scheduling and channel data into a single transport block.
[0063] For example, if a 4G / 5G communication base station wants to send a malformed RRC message to the tested terminal (assuming the RRC message is an RRC connection request), firstly, the RRC message enters the RRC layer, which generates the RRC message content (which may contain malformed parts), resulting in a malformed RRC message. Then, the malformed RRC message, as the data payload, is transmitted to the PDCP layer. The PDCP layer adds a PDCP header to the malformed RRC message and encrypts it, obtaining a PDCP data packet. Next, the PDCP data packet is transmitted to the RLC layer, which adds an RLC header to the PDCP data packet and segments it, obtaining an RLC data packet. Finally, the RLC data packet is transmitted to the MAC layer, which adds a MAC header to the RLC data packet, resulting in a complete data transmission block.
[0064] Thus, after the above operations, a complete test case can be obtained, fully packaged according to the requirements of the 4G / 5G communication protocol stack.
[0065] In this embodiment, the state machine is mainly responsible for sensing the state changes of the 4G / 5G communication network protocol and managing the protocol context.
[0066] For example, based on the current state (e.g., "idle state") and the policy, the state machine decides to "perform a fuzz test when making an RRC connection request between the 4G / 5G communication base station and the terminal under test." The state machine transmits the connection command and the required context (e.g., terminal identifier) to the protocol module. The RRC layer, PDCP layer, RLC layer, and MAC layer in the protocol module begin operating, performing operations such as encapsulating the communication data. The protocol layer then sends the complete data transmission block encapsulated by the MAC layer to the terminal under test via the lower driver layer and software-defined radio hardware layer. The state machine monitors the response of the 4G / 5G communication base station. If the 4G / 5G communication base station replies "reject," the state machine may record an anomaly and remain in the "idle state," preparing for the next test. If the 4G / 5G communication base station unexpectedly crashes or does not respond, it indicates a potential vulnerability. If the 4G / 5G communication base station replies "accept," the state machine immediately detects that the communication state has changed to the "connected state" and updates all contexts (e.g., generating a new key). Then, the state machine can determine the next communication operation, such as "Now we can start fuzzy testing of data transmission messages between the 4G / 5G communication base station and the terminal under test".
[0067] In some embodiments, the protocol encoding / decoding module is used to encode and decode the encapsulated test cases output by the media access control layer.
[0068] In this embodiment, when the protocol layer needs to send test cases to the lower driver layer, the protocol encoding / decoding module needs to encode the test cases to be sent. Then, the protocol layer sends the encoded test cases to the lower driver layer. Conversely, when the protocol layer receives a response message from the lower driver layer, the protocol encoding / decoding module needs to decode the received response message. Then, the protocol layer sends the decoded response message to the upper control layer so that the control layer can monitor the execution status of the test cases corresponding to the response messages.
[0069] Please refer to the following: Figure 1 The communication protocol stack consists of, from top to bottom, the application layer, control layer, protocol layer, and driver layer. The roles and structural characteristics of the control layer, protocol layer, and driver layer have already been described above and will not be repeated here. The application layer is used to monitor the execution process of the fuzz test, analyze the process, and output the analysis results.
[0070] The fuzz testing system may also include a 4G / 5G core network fuzzing device. This 4G / 5G core network simulation device is used to simulate communication nodes in the 4G / 5G core network and establish a signaling connection with the 4G / 5G communication base station. Both the control terminal and the 4G / 5G core network simulation device are communicatively connected to the communication protocol stack.
[0071] In this embodiment, the control terminal can be a portable computer. In other embodiments, the control terminal can also be other electronic devices besides a portable computer, and this application is not limited in this regard. The terminal under test is a smartphone or an IoT smart terminal, which can communicate using 4G / 5G communication network protocols. In other embodiments, the terminal under test can also be other electronic devices besides smartphones or IoT smart terminals. For example, an IoT terminal, as long as it ensures the function of communicating using 4G / 5G communication network protocols.
[0072] The 4G / 5G core network simulation equipment in this embodiment is mainly used to simulate the functions of the core network in 4G / 5G network communication. The core network acts as a scheduling center, including a control plane and a user plane. The control plane is responsible for authenticating the identity of the terminal under test, recording the location of data sent by the terminal under test, and planning the optimal delivery route for data transmission. The 4G / 5G communication base station is mainly used to simulate the functions of the access network in 4G / 5G network communication. The access network is responsible for directly connecting to the terminal under test via wireless signals for initial data reception and transmission.
[0073] Compared with the prior art, the embodiments of this application have at least the following advantages:
[0074] The fuzzing method of this application involves the control layer of the fuzzing system detecting unexecuted test cases in the test case orchestrator. The test case orchestrator then selects a test case from the test case library in a preset order as the initial test case. The test case executor injects the initial test case into the protocol layer, and the test status monitor tracks the execution of the initial test case.
[0075] Next, the protocol encoding / decoding module at the protocol layer converts the data format of the initial test cases to obtain intermediate test cases in a digital format recognizable by the software-defined radio hardware layer. Then, the software-defined radio hardware layer performs digital-to-analog conversion on the intermediate test cases to obtain target test cases represented as analog signals. Finally, the software-defined radio hardware layer directly sends the target test cases to terminal devices using 4G / 5G networks as communication technology to perform fuzz testing. This significantly reduces the cost of generating test cases and improves the success rate and accuracy of fuzz testing.
[0076] Figure 3 This is a schematic diagram of an embodiment of the electronic device of this application. The electronic device 100 includes a memory 20, a processor 30, and a computer program 40 stored in the memory 20 and executable on the processor 30. When the processor 30 executes the computer program 40, it implements the steps in the above-described method embodiments.
[0077] The electronic device 100 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, processors, microprogrammed control units (MCUs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0078] For example, computer program 40 can also be divided into one or more modules / units, which are stored in memory 20 and executed by processor 30. The one or more modules / units can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 40 in electronic device 100.
[0079] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 100 and does not constitute a limitation on the electronic device 100. It may include more or fewer components than shown in the diagram, or combine certain components, or different components. For example, the electronic device 100 may also include input / output devices, network access devices, buses, etc.
[0080] Processor 30 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. General-purpose processors can be microprocessors, single-chip microcomputers, or any conventional processor.
[0081] The memory 20 can be used to store computer programs 40 and / or modules / units. The processor 30 implements various functions of the electronic device 100 by running or executing the computer programs and / or modules / units stored in the memory 20 and by calling data stored in the memory 20. The memory 20 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device 100 (such as audio data), etc. In addition, the memory 20 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other non-volatile solid-state storage device.
[0082] If the modules / units integrated in the electronic device 100 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0083] This application also provides a computer-readable storage medium, which may include the above-described electronic device.
[0084] In the several embodiments provided in this application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the electronic device embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and other division methods may be used in actual implementation.
[0085] Furthermore, the functional units in the various embodiments of this application can be integrated into the same processing unit, or each unit can exist physically separately, or two or more units can be integrated into the same unit. The integrated units described above can be implemented in hardware or in the form of hardware plus software functional modules.
[0086] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that this application can be implemented in other specific forms without departing from the spirit or essential characteristics of this application. Therefore, the embodiments should be considered exemplary and not restrictive in all respects. Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or electronic devices recited in the electronic device claims may also be implemented by the same unit or electronic device through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any particular order.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.
Claims
1. A fuzz testing method, characterized in that, The fuzz testing method is applied to a fuzz testing system based on 4G / 5G communication network protocols. The fuzz testing system includes a 4G / 5G communication base station and a terminal under test (DUT) connected by communication. The 4G / 5G communication base station includes a communication protocol stack and a software-defined radio hardware layer connected by communication. The communication protocol stack is used to generate a test case library required for performing fuzz testing between the 4G / 5G communication base station and the DUT. The software-defined radio hardware layer is used to send the test cases from the test case library sent by the communication protocol stack to the DUT and receive the response messages from the DUT. The method includes: The communication protocol stack is controlled to detect whether there are unexecuted test cases in the test case library, and if an unexecuted test case is detected in the test case library, a test case is selected from the test case library in a preset order as the initial test case; The communication protocol stack is controlled to convert the data format of the initial test cases to obtain intermediate test cases; The software-defined radio hardware layer is controlled to perform digital-to-analog conversion on the intermediate test cases to obtain the target test cases; The software-defined radio hardware layer is controlled to send the target test cases to the terminal under test to perform fuzz testing.
2. The fuzz testing method according to claim 1, characterized in that, The software-defined radio hardware layer is provided with a radio frequency interface based on software-defined radio, the terminal under test is provided with a wireless communication interface, and the terminal under test communicates with the software-defined radio hardware layer through the radio frequency interface and the wireless communication interface. The step of controlling the software-defined radio hardware layer to send the target test cases to the terminal under test to perform fuzz testing includes: The software-defined radio hardware layer is controlled to send the target test cases to the terminal under test through the radio frequency interface and the wireless communication interface to perform fuzz testing.
3. The fuzz testing method according to claim 2, characterized in that, The communication protocol stack includes a control layer, which is communicatively connected to the software-defined radio hardware layer. The control of the communication protocol stack to detect whether there are unexecuted test cases in the test case library includes: The control layer is configured to detect whether there are any unexecuted test cases in the test case library; If an unexecuted test case is detected in the test case library, selecting one of the test cases from the test case library as the initial test case according to a preset order includes: If an unexecuted test case is detected in the test case library, the control layer is controlled to select a test case from the test case library in the preset order as the initial test case.
4. The fuzz testing method according to claim 1, characterized in that, The communication protocol stack includes a protocol layer, which is communicatively connected to the software-defined radio hardware layer. Controlling the communication protocol stack to perform data format conversion on the initial test cases to obtain intermediate test cases includes: The protocol layer is controlled to perform data format conversion on the initial test cases to obtain the intermediate test cases.
5. The fuzz testing method according to claim 4, characterized in that, The protocol layer includes a state machine for communication connections and a protocol encoding / decoding module. The state machine is used to sense changes in the protocol state of the 4G / 5G communication network protocol and manage the protocol context of the 4G / 5G communication network protocol. The protocol encoding / decoding module is used to perform encoding / decoding operations on all test cases. The control mechanism, which involves the protocol layer converting the data format of the initial test cases to obtain the intermediate test cases, includes: The protocol encoding / decoding module is controlled to convert the data format of the initial test cases to obtain the intermediate test cases; After the protocol encoding / decoding module performs data format conversion on the initial test cases to obtain the intermediate test cases, the method further includes: Based on the initial test cases, a target communication state is determined. The target communication state is the communication state that the 4G / 5G communication base station and the terminal under test need to be in before the 4G / 5G communication base station sends the initial test cases to the terminal under test to perform fuzz testing. The state machine controls the 4G / 5G communication base station and the terminal under test to communicate, so that the 4G / 5G communication base station and the terminal under test are in the target communication state. The process of controlling the software-defined radio hardware layer to perform analog-to-digital conversion on the intermediate test cases to obtain target test cases includes: Based on the target communication state, the software-defined radio hardware layer is controlled to perform digital-to-analog conversion on the intermediate test cases to obtain the target test cases.
6. The fuzz testing method according to claim 5, characterized in that, The protocol layer further includes a protocol module, which is communicatively connected to the state machine and the protocol encoding / decoding module. The protocol module is used to encapsulate all test cases in the test case library according to a preset encapsulation order. The protocol encoding / decoding module is used to encapsulate and decode all the test cases encapsulated by the protocol module. The step of controlling the software-defined radio hardware layer to perform analog-to-digital conversion on the intermediate test cases based on the target communication state to obtain the target test cases includes: Based on the target communication state, data injection processing is performed on the intermediate test cases, and the protocol module is controlled to encapsulate the intermediate test cases after data injection processing to obtain mutated test cases. Inject the variant test cases into the software-defined radio hardware layer; The software-defined radio hardware layer is controlled to perform digital-to-analog conversion on the variant test cases to obtain the target test cases.
7. A fuzz testing system based on 4G / 5G communication network protocols, characterized in that, The fuzz testing system includes a 4G / 5G communication base station and a terminal under test connected by communication. The 4G / 5G communication base station includes a communication protocol stack and a software-defined radio hardware layer connected by communication. The communication protocol stack is used to generate a test case library required for performing fuzz testing between the 4G / 5G communication base station and the terminal under test. The software-defined radio hardware layer is used to send the test cases in the test case library sent by the communication protocol stack to the terminal under test and to receive the response messages from the terminal under test. The communication protocol stack is used to detect whether there are unexecuted test cases in the test case library. If an unexecuted test case is detected in the test case library, a test case is selected from the test case library in a preset order as the initial test case. The communication protocol stack is also used to convert the data format of the initial test cases to obtain intermediate test cases. The software-defined radio hardware layer is used to perform digital-to-analog conversion on the intermediate test cases to obtain target test cases, and then send the target test cases to the terminal under test to perform fuzz testing.
8. The fuzz testing system according to claim 7, characterized in that, The software-defined radio hardware layer is provided with a radio frequency interface based on software-defined radio, the terminal under test is provided with a wireless communication interface, and the terminal under test communicates with the software-defined radio hardware layer through the radio frequency interface and the wireless communication interface. The software-defined radio hardware layer is also used to send the target test cases to the terminal under test through the radio frequency interface and the wireless communication interface to perform fuzz testing.
9. An electronic device, characterized in that, The electronic device includes: a memory storing computer-readable instructions; and a processor executing the computer-readable instructions stored in the memory to implement the fuzz testing method as described in any one of claims 1 to 6.
10. A computer storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which are executed by a processor in an electronic device to implement the fuzz testing method as described in any one of claims 1 to 6.