Fuzzy test method and system, electronic equipment and computer storage medium
By analyzing abnormal test cases, signaling plane messages, and log data, the similarity between test cases and abnormal test cases is calculated, and the test case library is reordered. This solves the efficiency and accuracy problems of abnormal responses in fuzzy testing of 4G/5G networks, and achieves more efficient test results.
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 fuzz testing of 4G/5G networks, how can we improve the efficiency and accuracy of test case execution when abnormal responses occur, especially how to adjust the execution order of test cases based on abnormal responses to improve the efficiency and accuracy of fuzz testing?
By acquiring abnormal test cases, signaling plane messages, and log data, parsing protocol semantic data, calculating the initial similarity between test cases and abnormal test cases, and reordering the execution order in the test case library, the efficiency of fuzz testing can be improved.
It improves the efficiency and accuracy of fuzz testing, reduces testing costs, and ensures the reliability of test results.
Smart Images

Figure CN121985361A_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 a new generation of mobile communication technology, enabling terminal devices using 4G / 5G networks as communication technology to communicate directly with 4G / 5G network base stations.
[0003] When performing fuzz testing on terminal devices, and the 4G / 5G network base station receives an abnormal response from the terminal device, how to adjust the execution order of other test cases to be tested based on the abnormal test cases that match the abnormal response in order to improve the execution efficiency and accuracy of fuzz testing has become a key 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 connected by communication. The 4G / 5G communication base station generates a test case library and sends a test case from the test case library to the terminal under test. Multiple test cases in the test case library are sorted according to a preset rule. The method includes: acquiring abnormal test cases, signaling plane messages matching the abnormal test cases, and first log data. The abnormal test cases are the test cases that cause an abnormal response in the terminal under test, and the signaling plane messages represent the 4G / 5G communication network protocol. Data generated during the complete signaling interaction between the 4G / 5G communication base station and the terminal under test; parsing the abnormal test cases, the signaling plane messages, and the first log data to obtain protocol semantic data, the protocol semantic data including at least the semantic data of the functions performed, triggered state transitions, and included fields of the protocol messages matching the abnormal test cases during the communication process between the 4G / 5G communication base station and the terminal under test; based on the protocol semantic data, calculating the initial similarity between each test case and the abnormal test case; and re-determining the execution order of the test cases in the test case library according to the descending order of the initial similarity between each test case and the abnormal test case.
[0006] This application embodiment can acquire abnormal test cases sent to the tested terminal, along with signaling plane messages and first log data matching the abnormal test cases, when the tested terminal experiences an abnormal response. This allows for the determination of the interaction between the tested terminal and the 4G / 5G communication base station at the time of the abnormal response. The abnormal test cases, signaling plane messages, and first log data are then parsed to obtain protocol semantic data. This facilitates the subsequent calculation of the initial similarity between other test cases and the abnormal test cases based on the protocol semantic data. Finally, based on the descending order of multiple initial similarities, the execution order of all test cases in the test case library is re-determined. This ensures that the test cases with the highest similarity to the abnormal test cases are sent to the tested terminal, thereby improving the efficiency of fuzz testing.
[0007] In some embodiments, the 4G / 5G communication base station includes a protocol state machine, which 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 semantic data includes first protocol state data, use case structure data, fault feature data, and first protocol interaction data; parsing the abnormal use case, the signaling plane message, and the first log data to obtain the protocol semantic data includes: performing structural parsing on the abnormal use case to obtain the use case structure data, which characterizes the variation of the abnormal use case; based on a preset... The protocol knowledge graph is used to parse the signaling plane messages to obtain first protocol interaction data and first protocol state data. The first protocol interaction data represents the data related to signaling interaction when the 4G / 5G communication base station and the terminal under test communicate based on the abnormal use case. The first protocol state data represents all the state transitions of the protocol state machine when the 4G / 5G communication base station and the terminal under test communicate based on the abnormal use case. Feature extraction is performed on the first log data to obtain fault feature data, which represents the abnormal information that occurs when the terminal under test responds abnormally.
[0008] In some embodiments, the initial similarity includes structural similarity; the step of calculating the initial similarity between each test case and the abnormal test case based on the protocol semantic data includes: selecting any one of the test cases from the test case library as an initial test case; calculating the structural similarity between the initial test case and the test case structure data; taking any one of the test cases in the test case library other than the initial test case as a new initial test case, and calculating a new structural similarity between the new initial test case and the test case structure data, until the structural similarity corresponding to each initial test case in the test case library is obtained.
[0009] In some embodiments, the initial similarity further includes interaction similarity and state similarity; after calculating the structural similarity between the initial use case and the use case structure data, the method further includes: based on the structural similarity, predicting second protocol interaction data and second protocol state data generated when the 4G / 5G communication base station sends the initial use case to the terminal under test for signaling interaction, wherein the second protocol interaction data represents data related to signaling interaction based on the initial use case when the 4G / 5G communication base station and the terminal under test communicate, and the second protocol state data represents data related to signaling interaction when the 4G / 5G communication base station and the terminal under test communicate based on the initial use case. When a use case communicates, the protocol state machine performs all state transitions; the interaction similarity between the first protocol interaction data and the second protocol interaction data, and the state similarity between the first protocol state data and the second protocol state data are calculated; after calculating the new structural similarity between the new initial use case and the use case structure data, the method further includes: predicting new second protocol interaction data and new second protocol state data based on the new structural similarity; calculating the new interaction similarity and the new state similarity, until the interaction similarity and the state similarity corresponding to each initial use case in the test case library are obtained.
[0010] In some embodiments, the initial similarity further includes fault similarity. After calculating the structural similarity between the initial use case and the use case structure data, the method further includes: predicting whether the terminal under test will have an abnormal response after the 4G / 5G communication base station sends the initial use case to the terminal under test; if an abnormal response is predicted, obtaining the second log data generated when the terminal under test has an abnormal response; calculating the fault similarity between the fault feature data and the second log data; after calculating the new structural similarity between the new initial use case and the use case structure data, the method further includes: predicting whether the terminal under test will have an abnormal response after the 4G / 5G communication base station sends the new initial use case to the terminal under test; if an abnormal response is predicted, obtaining the new second log data generated when the terminal under test has an abnormal response; calculating the new fault similarity between the fault feature data and the new second log data, until the fault similarity corresponding to each initial use case in the test case library is obtained.
[0011] In some embodiments, after calculating the initial similarity between each test case and the abnormal test case, the method further includes: calculating the first product of the structural similarity and the first preset weight corresponding to each initial test case; calculating the second product of the interaction similarity and the second preset weight corresponding to each initial test case; calculating the third product of the state similarity and the third preset weight corresponding to each initial test case; and calculating the fourth product of the fault similarity and the fourth preset weight corresponding to each initial test case; and calculating the weight sum of the first product, the second product, the third product, and the fourth product corresponding to each initial test case.
[0012] In some embodiments, the step of re-determining the execution order of the test cases in the test case library according to the descending order of the initial similarity between each test case and the abnormal test case includes: sorting the total weights corresponding to each initial test case in descending order, and re-determining the execution order of the test cases in the test case library based on the descending order result.
[0013] 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 connected by communication. The 4G / 5G communication base station is used to generate a test case library and send a test case from the test case library to the terminal under test. The test cases in the test case library are ordered according to a preset rule. The 4G / 5G communication base station is used to: acquire abnormal test cases, signaling plane messages matching the abnormal test cases, and first log data. The abnormal test case is the test case that causes an abnormal response in the terminal under test, and the signaling plane message represents the 4G / 5G communication base station. Data generated during complete signaling interaction between the test case and the terminal under test; parsing the abnormal test case, the signaling plane message, and the first log data to obtain protocol semantic data, the protocol semantic data including at least the semantic data of the function performed, the triggered state transition, and the fields contained in the protocol message matching the abnormal test case during the communication process between the 4G / 5G communication base station and the terminal under test; based on the protocol semantic data, calculating the initial similarity between each test case and the abnormal test case; and re-determining the execution order of the test cases in the test case library according to the descending order of the initial similarity between each test case and the abnormal test case.
[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 1 This 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 connected by communication. The 4G / 5G communication base station is used to generate a test case library and send a test case from the library to the terminal under test, and monitor the response of the terminal under test. The multiple test cases in the test case library are sorted according to preset rules.
[0028] In this embodiment, the preset rule sorting can be set according to actual testing needs. For example, multiple test cases can be arranged in a queue, and during the fuzzing test, the 4G / 5G communication base station sends a test case from the test case library to the terminal under test according to the first-in-first-out principle. This application does not limit the specific method of preset rule sorting.
[0029] The fuzz testing system in this embodiment requires controlling the communication connection between the 4G / 5G communication base station and the terminal under test before performing fuzz testing. Then, the fuzz testing system executes the fuzz testing method, whereby the 4G / 5G communication base station generates a test case library, and then sends the test cases in the test case library to the terminal under test to perform fuzz testing.
[0030] Furthermore, the 4G / 5G communication base station determines the execution status of the fuzz test based on the response of the terminal under test. Specifically, if the terminal under test responds abnormally, it indicates that the test case sent by the 4G / 5G communication base station to the terminal under test (referred to as the first test case for ease of understanding, i.e., ...) is incorrect. Figure 1 The mutated message in the message caused anomalies in the fuzz test.
[0031] Therefore, to improve the execution efficiency of fuzz testing, the fuzz testing system executes a fuzz testing method, changing the execution order of other test cases in the test case library based on the first test case. Specifically, the 4G / 5G communication base station is used to acquire abnormal test cases, signaling plane messages matching the abnormal test cases, and first log data. Abnormal test cases are those that cause abnormal responses in the terminal under test (DUT), and signaling plane messages represent data generated during complete signaling interaction between the 4G / 5G communication base station and the DUT. The system also parses the abnormal test cases, signaling plane messages, and first log data to obtain protocol semantic data. This protocol semantic data includes at least the semantic data of the functions performed, triggered state transitions, and included fields of the protocol messages matching the abnormal test cases during communication between the 4G / 5G communication base station and the DUT. Furthermore, based on the protocol semantic data, the system calculates the initial similarity between each test case and the abnormal test case. Finally, it redetermines the execution order of test cases in the test case library according to the descending order of the initial similarity between each test case and the abnormal test case. This improves the execution efficiency of fuzz testing. The specific steps and procedures are described in detail below, and will not be repeated here to avoid repetition.
[0032] When an abnormal response is detected in the terminal under test, the fuzzing system can parse the abnormal test cases, signaling plane messages, and first log data to obtain protocol semantic data. Based on the protocol semantic data, it calculates the initial similarity between other test cases in the test case library and the abnormal test cases. According to the ranking results of multiple initial similarities, it determines the execution order of multiple test cases in the test case library to improve the execution efficiency of fuzzing.
[0033] In other words, abnormal test cases lead to abnormal responses from the tested terminal, and other test cases with high similarity to abnormal test cases are also most likely to cause abnormal responses from the tested terminal. Therefore, to improve the execution efficiency of fuzz testing, the execution order of multiple test cases in the test case library can be determined based on the initial descending similarity ranking, thereby improving the accuracy and efficiency of testing.
[0034] In some embodiments, 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.
[0035] It should be noted that, in this embodiment, fuzz testing refers to the test engineer controlling a 4G / 5G communication base station to connect to the terminal under test via a control terminal, and the 4G / 5G communication base station sending 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 of the terminal under test.
[0036] Please continue reading. Figure 1 The 4G / 5G communication base station in the fuzzing system includes a communication protocol stack for communication connections and a software-defined radio hardware layer. The communication protocol stack generates a test case library required for fuzzing, selects a test case as the initial test case according to preset rules, and sends the initial test case to the software-defined radio hardware layer. The software-defined radio hardware layer then sends the initial test case to the terminal under test to execute the fuzzing test.
[0037] In this embodiment, 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 terminal under test (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 based on software-defined wireless communication protocols rather than hard-wired implementations. Frequency bands, air interface protocols, and functions can be upgraded through software downloads and updates without requiring a complete hardware replacement. Setting up a software-defined radio hardware layer in a 4G / 5G communication base station provides strong flexibility and openness for communication connections between the 4G / 5G base station and the DUT.
[0038] The software-defined radio hardware layer has a radio frequency interface based on software-defined radio, and the terminal under test has a wireless communication interface. The terminal under test communicates with the software-defined radio hardware layer through the radio frequency interface and the wireless communication interface.
[0039] Specifically, the software-defined radio hardware layer is used to convert test cases in the test case library sent by the communication protocol stack into test cases of analog signals, and then send the test cases of analog signals to the terminal under test through the radio frequency interface and wireless communication interface based on software-defined radio.
[0040] 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.
[0041] In this embodiment, the communication protocol stack monitors whether the terminal under test (DUT) responds abnormally after receiving the test cases. When an abnormal response is detected, the communication protocol stack executes a fuzzing method to adjust the execution order of multiple test cases in the test case library. This improves the efficiency of fuzzing.
[0042] In this embodiment, the test cases in the test case library can be test cases generated based on seed test cases. Seed test cases are the starting point or basic input in the fuzzing process, that is, a set of initial, typical, and valid data samples. The communication protocol stack can generate a large number of illegal, abnormal, or marginal test cases based on seed test cases by applying various mutations and changes. The seed test cases in this embodiment can be obtained through 4G / 5G communication protocol specification documents, etc.
[0043] It should be noted that this application only describes the generation of test cases based on seed test cases, and does not mean that the test cases in this application can only be obtained using this method. That is to say, in other embodiments, test cases can also be obtained using methods other than the generation of test cases based on seed test cases, and this application is not limited in this regard.
[0044] In some embodiments, the fuzz testing system may further include a 4G / 5G core network fuzzing device. This 4G / 5G core network simulation device is used to simulate a communication node in the 4G / 5G core network and establish a signaling connection with a 4G / 5G communication base station. Both the control terminal and the 4G / 5G core network simulation device are communicatively connected to a communication protocol stack.
[0045] 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.
[0046] 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.
[0047] 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.
[0048] Step 101: Obtain the abnormal test case and the signaling plane message and first log data that match the abnormal test case.
[0049] Among them, abnormal test cases are test cases that cause the terminal under test to respond abnormally. Signaling plane messages represent the data generated during a complete signaling interaction between the 4G / 5G communication base station and the terminal under test. In this embodiment, signaling plane messages may include the communication interaction between the 4G / 5G communication base station and the terminal under test between sending abnormal test cases to the terminal under test and the terminal under test responding abnormally. The first log data includes log data generated by the terminal under test when it responds abnormally.
[0050] In other words, after the 4G / 5G communication base station sends abnormal test cases to the terminal under test, it monitors the terminal's response. If an abnormal response is detected, it indicates that if a certain test case has a high degree of similarity to the abnormal test case, sending that test case to the terminal is very likely to cause an abnormal response as well, thus improving the execution efficiency of the fuzz test. Therefore, it is necessary to adjust the execution order of multiple test cases in the test case library based on the abnormal test cases, signaling plane messages matching common cases, and first log data.
[0051] In this embodiment, after obtaining the abnormal test cases, signaling plane messages, and first log data, data preprocessing operations can be performed on the abnormal test cases, signaling plane messages, and first log data to improve the efficiency of subsequent data processing. These data preprocessing operations may include data classification and deduplication, data formatting, etc. This application does not limit the specific content of the data preprocessing operations; they can be set according to actual needs.
[0052] Step 102: parse the abnormal use cases, signaling plane messages, and first log data to obtain protocol semantic data.
[0053] In some embodiments, protocol semantic data includes at least the semantic data of the functions performed, the triggered state transitions, and the fields contained in the protocol messages that match abnormal use cases during the communication process between the 4G / 5G communication base station and the terminal under test.
[0054] That is, in this embodiment, during the period from when the 4G / 5G communication base station sends the abnormal use case to the terminal under test and the terminal under test responds abnormally, the 4G / 5G communication base station and the terminal under test send protocol messages to each other. In order to maintain the communication status between the 4G / 5G communication base station and the terminal under test, based on the protocol messages, the 4G / 5G communication base station and / or the terminal under test perform response actions, trigger their own state transitions, and obtain the semantic information of the mutated fields in the abnormal use case.
[0055] Next, we will explain in detail the specific steps to parse abnormal use cases, signaling plane messages, and first log data to obtain protocol semantic data.
[0056] In some embodiments, the 4G / 5G communication base station includes a protocol state machine, which 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. Protocol semantic data includes first protocol state data, use case structure data, fault characteristic data, and first protocol interaction data.
[0057] The test case structure data represents the variations of abnormal test cases. The first protocol interaction data represents the signaling-related data during communication between the 4G / 5G communication base station and the terminal under test (DUT) based on abnormal test cases (i.e., the data during communication interaction between the 4G / 5G communication base station and the DUT). The first protocol state data represents all state transitions of the protocol state machine during communication between the 4G / 5G communication base station and the DUT based on abnormal test cases (i.e., the protocol state transitions of the protocol state machine during communication between the 4G / 5G communication base station and the DUT). The fault characteristic data represents the abnormal information that appears when the DUT experiences an abnormal response.
[0058] Specifically, step 102 includes:
[0059] (1) Perform structural analysis on the abnormal test cases to obtain the test case structure data.
[0060] In this embodiment, the test cases in the test case library are all abnormal test cases generated based on the seed test case method, for fuzz testing. Therefore, by parsing the abnormal test cases, the mutation status of the abnormal test cases can be clearly understood, including the message type of the mutation, the mutation location, the mutation form, the mutation field, the mutation length, etc.
[0061] In other words, the use case structure data shows the variation of abnormal use cases.
[0062] (2) Based on the preset protocol knowledge graph, the signaling plane message is parsed to obtain the first protocol interaction data and the first protocol status data.
[0063] In this embodiment, the protocol state machine contains a preset protocol knowledge graph. The protocol knowledge graph can be a directed graph including multiple entity nodes, wherein each entity node includes at least configuration parameters, communication states, communication messages, and device types. The relationships between entity nodes include at least configuration parameter dependency relationships, state transition relationships, and relationships regarding which configuration parameters are included in the communication messages.
[0064] Therefore, by parsing signaling plane messages based on the protocol knowledge graph, data representing protocol state transitions and protocol interactions can be obtained.
[0065] Furthermore, the process of constructing the protocol knowledge graph includes:
[0066] (a) Obtain standard documents and device configuration template data. The standard documents are the protocol standard files of 4G / 5G communication network protocols, and the device configuration template data are the communication parameter configuration information set by the equipment manufacturer before the terminal under test leaves the factory.
[0067] For example, the protocol standard documents for 4G / 5G communication networks are specification documents developed and published by the international standardization organization 3GPP. These specification documents include Series 21 (Reports and Planning), Series 22 (Service Requirements), and Series 23 (Technical Implementation), etc. Equipment configuration template data refers to the equipment configuration template files and practice documents provided on the device, which can include normal configuration information and common misconfiguration information.
[0068] (b) Extract multiple feature parameters and dependencies between multiple feature parameters from standard documents.
[0069] All configurable parameters of the 4G / 5G communication base station and the terminal under test are extracted from standard documents and used as feature parameters. The dependencies between these feature parameters are then determined. These dependencies can include constraints between configuration parameters and the relationship between configuration parameters and communication.
[0070] The steps of extracting text, recognizing semantics, and determining relationships in a document are all existing technologies, and will not be described in detail here.
[0071] (c) Construct a protocol knowledge graph based on dependency relationships and device configuration template data.
[0072] This integrates multiple feature parameters, dependencies, configuration template files, and other elements into a structured knowledge base. For example, using a knowledge graph format, entities can include at least configuration parameters, communication states, communication messages, and device types. Dependencies can include at least configuration parameter dependency relationships, state transition relationships, and relationships regarding which configuration parameters are included in communication messages.
[0073] (3) Extract features from the first log data to obtain fault feature data.
[0074] In this embodiment, when an abnormal response is detected in the terminal under test, the first log data generated by the terminal under test is obtained so as to analyze and obtain the reason for the abnormal response detected by the terminal under test.
[0075] Step 103: Based on the protocol semantic data, calculate the initial similarity between each test case and the abnormal test case.
[0076] In this embodiment, the initial similarity includes structural similarity, interaction similarity, state similarity, and fault similarity. Structural similarity indicates the similarity between two use cases in terms of structural variations. Interaction similarity indicates the similarity between two use cases in terms of communication interactions when the 4G / 5G communication base station and the terminal under test communicate. State similarity indicates the similarity between two use cases in terms of protocol state transitions when the protocol state machine of the 4G / 5G communication base station and the terminal under test communicates. Fault similarity indicates the similarity in the logs generated when the terminal under test experiences abnormal responses due to two use cases.
[0077] The following sections will describe the processes for obtaining structural similarity, interaction similarity, state similarity, and fault similarity.
[0078] (1) Steps for obtaining structural similarity:
[0079] Select any test case from the test case library as the initial test case. Calculate the structural similarity between the initial test case and the test case structure data. Take any test case from the test case library other than the initial test case as a new initial test case, and calculate the new structural similarity between the new initial test case and the test case structure data, until the structural similarity is obtained for each initial test case in the test case library.
[0080] (2) Steps for obtaining interaction similarity and state similarity:
[0081] Select any test case from the test case library as the initial test case. Calculate the structural similarity between the initial test case and the test case structure data. Based on the structural similarity, predict the second protocol interaction data and second protocol state data generated when the 4G / 5G communication base station sends the initial test case to the terminal under test for signaling interaction.
[0082] The second protocol interaction data represents the signaling interaction data when the 4G / 5G communication base station and the terminal under test communicate based on the initial use case. The second protocol state data represents all the state transitions of the protocol state machine when the 4G / 5G communication base station and the terminal under test communicate based on the initial use case.
[0083] Calculate the interaction similarity between the first protocol interaction data and the second protocol interaction data, as well as the state similarity between the first protocol state data and the second protocol state data. Take any test case from the test case library other than the initial test case as a new initial test case, and calculate the new structural similarity between the new initial test case and the test case structure data. Based on the new structural similarity, predict the new second protocol interaction data and the new second protocol state data. Calculate the new interaction similarity and the new state similarity until the interaction similarity and state similarity corresponding to each initial test case in the test case library are obtained.
[0084] In this embodiment, the second protocol interaction data refers to the data generated when the 4G / 5G communication base station sends the initial use case to the terminal under test, and the 4G / 5G communication base station and the terminal under test perform signaling interaction. The second protocol state data refers to the protocol state transition of the protocol state machine when the 4G / 5G communication base station sends the initial use case to the terminal under test.
[0085] (3) Steps for obtaining fault similarity:
[0086] After selecting any test case from the test case library as the initial test case and calculating the structural similarity between the initial test case and the test case structure data, it is predicted whether the terminal under test will respond abnormally after the 4G / 5G communication base station sends the initial test case to the terminal under test. If an abnormal response is predicted, the second log data generated when the terminal under test responds abnormally is obtained. The fault similarity between the fault feature data and the second log data is calculated.
[0087] After calculating the new structural similarity between the new initial use case and the use case structure data, it predicts whether the terminal under test will have an abnormal response after the 4G / 5G communication base station sends the new initial use case to the terminal under test.
[0088] If an abnormal response is predicted from the terminal under test, obtain the new second log data generated when the abnormal response occurs. Calculate the new fault similarity between the fault feature data and the new second log data, until the fault similarity corresponding to each initial test case in the test case library is obtained.
[0089] In this embodiment, the second log data refers to the log data generated when the terminal under test exhibits an abnormal response after the 4G / 5G communication base station sends the initial use case to the terminal under test.
[0090] After completing step 103, to improve the execution order of fuzz testing, it is necessary to sort the execution order of multiple test cases in the test case library based on structural similarity, interaction similarity, state similarity, and fault similarity. Specific steps include:
[0091] Calculate the first product of structural similarity and first preset weight for each initial use case; calculate the second product of interaction similarity and second preset weight for each initial use case; calculate the third product of state similarity and third preset weight for each initial use case; and calculate the fourth product of fault similarity and fourth preset weight for each initial use case. Then, calculate the sum of the weights of the first, second, third, and fourth products for each initial use case.
[0092] In this way, the total weight of each test case in the test case library can be obtained.
[0093] It should be noted that in this embodiment, the sum of the first preset weight, the second preset weight, the third preset weight, and the fourth preset weight is set to 1. However, this embodiment does not limit the relative magnitudes of the first preset weight, the second preset weight, the third preset weight, and the fourth preset weight. Specific values for the four preset weights can be assigned according to the importance of the test, and setting the sum of the four preset weights to a certain value facilitates clear interpretation and numerical stability of the test results.
[0094] Step 104: Determine the execution order of test cases in the test case library according to the descending order of the initial similarity between each test case and the exception test case.
[0095] Specifically, the total weights corresponding to each initial test case are sorted in descending order, and the execution order of the test cases in the test case library is re-determined based on the descending order result.
[0096] In other words, if a test case in the test case library has the highest total weight, it indicates that this test case is most similar to an abnormal test case. Since the 4G / 5G communication base station sends the abnormal test case to the terminal under test, and the terminal responds abnormally, it can be predicted that after the 4G / 5G communication base station sends this test case to the terminal under test, the terminal under test will also likely respond abnormally. This improves the overall efficiency of fuzz testing, reduces testing costs, and increases testing accuracy.
[0097] Compared with the prior art, the embodiments of this application have at least the following advantages:
[0098] The fuzzing method of this application can acquire abnormal test cases sent to the terminal under test (DUT) along with signaling plane messages and first log data matching the abnormal test cases when the DUT experiences an abnormal response. This allows for the determination of the interaction between the DUT and the 4G / 5G communication base station during the abnormal response. The abnormal test cases, signaling plane messages, and first log data are then parsed to obtain protocol semantic data. This facilitates subsequent calculations of structural similarity, interaction similarity, state similarity, and fault similarity between other test cases and the abnormal test cases. Finally, based on structural similarity, interaction similarity, state similarity, and fault similarity, the total weight of each test case in the test case library is calculated. The execution order of all test cases in the test case library is then re-determined based on the descending order of multiple weight sums. This allows the other test cases with the highest similarity to the abnormal test cases to be sent to the DUT, thereby improving the efficiency of fuzzing.
[0099] 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.
[0100] 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.
[0101] 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.
[0102] 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.
[0103] 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.
[0104] 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.
[0105] 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.
[0106] This application also provides a computer-readable storage medium, which may include the above-described electronic device.
[0107] 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.
[0108] 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.
[0109] 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.
[0110] 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 a 4G / 5G communication network protocol. 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 is used to generate a test case library and send a test case from the test case library to the terminal under test. The test cases in the test case library are ordered according to a preset rule. The method includes: Obtain abnormal test cases, signaling plane messages matching the abnormal test cases, and first log data, wherein the abnormal test cases are the test cases that cause the terminal under test to have an abnormal response, and the signaling plane messages represent the data generated when the 4G / 5G communication base station and the terminal under test perform a complete signaling interaction; The abnormal use case, the signaling plane message, and the first log data are analyzed to obtain protocol semantic data. The protocol semantic data includes at least the semantic data of the functions performed by the protocol messages that match the abnormal use case, the triggered state transitions, and the fields contained therein during the communication process between the 4G / 5G communication base station and the terminal under test. Based on the protocol semantic data, the initial similarity between each test case and the abnormal test case is calculated respectively; The execution order of the test cases in the test case library is re-determined according to the descending order of the initial similarity between each test case and the abnormal test case.
2. The fuzz testing method according to claim 1, characterized in that, The 4G / 5G communication base station includes a protocol state machine, which 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 semantic data includes first protocol state data, use case structure data, fault feature data and first protocol interaction data; The process of parsing the abnormal use case, the signaling plane message, and the first log data to obtain protocol semantic data includes: The abnormal use cases are parsed to obtain the use case structure data, which represents the variation of the abnormal use cases; Based on a preset protocol knowledge graph, the signaling plane message is parsed to obtain first protocol interaction data and first protocol state data. The first protocol interaction data represents the data related to signaling interaction when the 4G / 5G communication base station and the terminal under test communicate based on the abnormal use case. The first protocol state data represents all the state transitions of the protocol state machine when the 4G / 5G communication base station and the terminal under test communicate based on the abnormal use case. Feature extraction is performed on the first log data to obtain the fault feature data, which characterizes the abnormal information that occurs when the tested terminal responds abnormally.
3. The fuzz testing method according to claim 2, characterized in that, The initial similarity includes structural similarity; the calculation of the initial similarity between each test case and the abnormal test case based on the protocol semantic data includes: Select any one of the test cases from the test case library as the initial test case; Calculate the structural similarity between the initial use case and the use case structure data; Take any test case in the test case library other than the initial test case as the new initial test case, and calculate the new structural similarity between the new initial test case and the test case structure data, until the structural similarity corresponding to each initial test case in the test case library is obtained.
4. The fuzz testing method according to claim 3, characterized in that, The initial similarity also includes interaction similarity and state similarity; After calculating the structural similarity between the initial use case and the use case structure data, the method further includes: Based on the structural similarity, the second protocol interaction data and the second protocol state data generated when the 4G / 5G communication base station sends the initial use case to the terminal under test for signaling interaction are predicted. The second protocol interaction data represents the data related to signaling interaction when the 4G / 5G communication base station and the terminal under test communicate based on the initial use case. The second protocol state data represents all the state transitions of the protocol state machine when the 4G / 5G communication base station and the terminal under test communicate based on the initial use case. Calculate the interaction similarity between the first protocol interaction data and the second protocol interaction data, as well as the state similarity between the first protocol state data and the second protocol state data; After calculating the new structural similarity between the new initial use case and the use case structure data, the method further includes: Based on the new structural similarity, predict new second protocol interaction data and new second protocol state data; Calculate new interaction similarities and new state similarities until the interaction similarities and state similarities corresponding to each initial test case in the test case library are obtained.
5. The fuzz testing method according to claim 4, characterized in that, The initial similarity also includes fault similarity, and after calculating the structural similarity between the initial use case and the use case structure data, it further includes: Predict whether the terminal under test will respond abnormally after the 4G / 5G communication base station sends the initial use case to the terminal under test; If an abnormal response is predicted to occur in the tested terminal, the second log data generated when the tested terminal responds abnormally is obtained; Calculate the fault similarity between the fault feature data and the second log data; After calculating the new structural similarity between the new initial use case and the use case structure data, the method further includes: Predict whether the terminal under test will respond abnormally after the 4G / 5G communication base station sends the new initial use case to the terminal under test; If an abnormal response is predicted to occur in the tested terminal, new second log data generated when the tested terminal responds abnormally is obtained; Calculate the new fault similarity between the fault feature data and the new second log data, until the fault similarity corresponding to each of the initial test cases in the test case library is obtained.
6. The fuzz testing method according to claim 5, characterized in that, After calculating the initial similarity between each test case and the anomalous test case, the method further includes: Calculate the first product of the structural similarity and the first preset weight for each initial use case, calculate the second product of the interaction similarity and the second preset weight for each initial use case, calculate the third product of the state similarity and the third preset weight for each initial use case, and calculate the fourth product of the fault similarity and the fourth preset weight for each initial use case. Calculate the sum of the weights of the first product, the second product, the third product, and the fourth product for each of the initial use cases.
7. The fuzz testing method according to claim 6, characterized in that, The step of re-determining the execution order of the test cases in the test case library according to the descending order of the initial similarity between each test case and the abnormal test case includes: The weights corresponding to each initial test case are sorted in descending order, and the execution order of the test cases in the test case library is re-determined based on the descending order result.
8. 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 is used to generate a test case library and send a test case from the test case library to the terminal under test. The multiple test cases in the test case library are sorted according to a preset rule. The 4G / 5G communication base station is used for: Obtain abnormal test cases, signaling plane messages matching the abnormal test cases, and first log data, wherein the abnormal test cases are the test cases that cause the terminal under test to have an abnormal response, and the signaling plane messages represent the data generated when the 4G / 5G communication base station and the terminal under test perform a complete signaling interaction; The abnormal use case, the signaling plane message, and the first log data are analyzed to obtain protocol semantic data. The protocol semantic data includes at least the semantic data of the functions performed by the protocol messages that match the abnormal use case, the triggered state transitions, and the fields contained therein during the communication process between the 4G / 5G communication base station and the terminal under test. Based on the protocol semantic data, the initial similarity between each test case and the abnormal test case is calculated respectively; The execution order of the test cases in the test case library is re-determined according to the descending order of the initial similarity between each test case and the abnormal test case.
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 7.
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 7.