Black box fuzzy test method and device and computer readable storage medium

By obtaining the test case model and generating test case messages based on it, the problem of low effectiveness of traditional black box fuzz testing is solved, more efficient test case generation and execution is achieved, and testing efficiency and effect are improved.

CN118733425APending Publication Date: 2024-10-01ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310335835.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

The traditional black-box fuzz testing solution has low effectiveness when generating test case messages and cannot effectively utilize the internal structure and characteristics of the device program, resulting in poor testing efficiency and results.

Method used

By obtaining the test case model, including the mutable field characteristics of the protocol field, and generating test case messages based on these characteristics, using the preset mutation strategy to generate mutable field values, the effectiveness of the test case message is improved.

Benefits of technology

It improves the effectiveness of the test case messages of black box fuzz testing, enhances the testing efficiency and effect, and is more targeted and efficient than the method of randomly changing data samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733425A_ABST
    Figure CN118733425A_ABST
Patent Text Reader

Abstract

The invention discloses a black box fuzz testing method, device and equipment and a computer readable storage medium, and the method comprises the steps: obtaining a test case model which comprises the field features of variable fields in all protocol fields in a message needing to be sent in a test task; a test case message is generated according to the test case model, and the field value of at least one variable field in the test case message is generated according to a preset variation strategy corresponding to the field feature of the variable field; and executing the test task by adopting the test case message. According to the invention, the effectiveness of the test case message of the black box fuzz test is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer testing technology, and in particular to a black box fuzz testing method, device and computer readable storage medium. Background Art

[0002] With the rapid development of IoT smart devices and mobile terminal technologies and fields, security testing of related devices and protocols has become particularly important. Fuzz testing has been considered the most effective testing tool in the field of software testing after years of development due to its high testing efficiency and strong exploratory nature.

[0003] In the field of black-box fuzz testing, since the internal structure and internal characteristics of the device program cannot be known by default, it is particularly important to generate efficient test cases. Traditional black-box fuzz testing solutions generate test data by randomly changing existing data samples. The effectiveness of the test case messages generated in the field of black-box testing is extremely low. Summary of the invention

[0004] The main purpose of the present application is to provide a black box fuzz testing method, device and computer-readable storage medium, aiming to provide a black box fuzz testing solution, which improves the effectiveness of the test case message of the black box fuzz testing by generating test case messages based on the test case model for testing.

[0005] To achieve the above object, the present application provides a black box fuzzy testing method, which comprises the following steps:

[0006] Acquire a test case model, wherein the test case model includes field characteristics of variable fields in each protocol field in a message to be sent in the test task;

[0007] Generate a test case message according to the test case model, wherein a field value of at least one of the mutable fields in the test case message is generated according to a preset mutation strategy corresponding to a field feature of the mutable field;

[0008] The test case message is used to execute the test task.

[0009] To achieve the above-mentioned objectives, the present application also provides a black-box fuzzy testing device, which includes: a memory, a processor, and a black-box fuzzy testing program stored in the memory and executable on the processor, and the black-box fuzzy testing program, when executed by the processor, implements the steps of the black-box fuzzy testing method described above.

[0010] In addition, to achieve the above objectives, the present application also proposes a computer-readable storage medium, on which a black box fuzz testing program is stored. When the black box fuzz testing program is executed by a processor, the steps of the black box fuzz testing method described above are implemented.

[0011] In an embodiment of the present application, a test case model is obtained, and the test case model includes field features of variable fields in each protocol field in a message to be sent in a test task, and a test case message is generated according to the test case model, wherein the field value of at least one variable field in the test case message is generated according to a preset mutation strategy corresponding to the field features of the variable field, and the test task is executed using the test case message. An embodiment of the present application provides an efficient black-box fuzzy testing solution. Compared to generating test data by randomly changing existing data samples, in an embodiment of the present application, a test case message is generated for testing through a test case model. Since the test case model includes field features of variable fields, and the field values ​​of the variable fields in the test case message are generated according to the mutation strategy corresponding to the field features of the variable fields, the test case message generated for black-box fuzzy testing is more effective. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 A schematic diagram of the structure of the hardware operating environment involved in the embodiment of the present application;

[0013] Figure 2 This is a flowchart of the first embodiment of the black box fuzz testing method of the present application;

[0014] Figure 3 A schematic diagram of a black box module testing system architecture involved in an embodiment of the present application;

[0015] Figure 4 A flowchart of a black box module testing method involved in an embodiment of the present application.

[0016] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0017] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0018] like Figure 1 As shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.

[0019] It should be noted that the black-box fuzz testing device in the embodiment of the present application may be a smart phone, a personal computer, a server or other device, and is not specifically limited here.

[0020] like Figure 1 As shown, the black box fuzz testing device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may optionally be a storage device independent of the aforementioned processor 1001.

[0021] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the black box fuzz testing device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0022] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a black box fuzz test program. The operating system is a program that manages and controls the hardware and software resources of the device and supports the operation of the black box fuzz test program and other software or programs. Figure 1 In the device shown, the user interface 1003 is mainly used for data communication with the client; the network interface 1004 is mainly used for establishing a communication connection with the server; and the processor 1001 can be used to call the black box fuzz testing program stored in the memory 1005 and perform the following operations:

[0023] Acquire a test case model, wherein the test case model includes field characteristics of variable fields in each protocol field in a message to be sent in the test task;

[0024] Generate a test case message according to the test case model, wherein a field value of at least one of the mutable fields in the test case message is generated according to a preset mutation strategy corresponding to a field feature of the mutable field;

[0025] The test case message is used to execute the test task.

[0026] In one feasible implementation, the operation of obtaining the test case model includes:

[0027] Get sample message;

[0028] A test case model is generated according to the field information of each protocol field in the sample message, wherein the test case model includes field characteristics of the variable fields in each protocol field in the sample message.

[0029] In a feasible implementation manner, the operation of generating a test case model according to the field information of each protocol field in the sample message includes:

[0030] Matching the field information of the protocol field in the sample message with the preset information, and obtaining the variation of the protocol field according to the matching result, wherein the matching result indicates whether the preset information exists in the field information of the protocol field, and the variation is used to indicate whether the protocol field is variable;

[0031] Extracting a field feature of the protocol field from the field information of the protocol field;

[0032] The test case model is generated according to the variation of each of the protocol fields and the field characteristics.

[0033] In a feasible implementation manner, the operation of generating a test case model according to the field information of each protocol field in the sample message includes:

[0034] According to the protocol to be tested corresponding to the test task, an analysis strategy corresponding to the protocol to be tested is selected from the analysis strategies corresponding to various preset communication protocols to analyze the field information of each protocol field in the sample message, and a test case model is obtained according to the analysis results.

[0035] In a feasible implementation manner, the operation of generating a test case model according to the field information of each protocol field in the sample message includes:

[0036] The relationship between the protocol fields in the sample message is parsed. If the parsing shows that there are parent protocol fields and sub-protocol fields between the protocol fields, a test case model is generated according to the field information of the sub-protocol fields.

[0037] In a feasible implementation manner, the test case model further includes a default value of each of the protocol fields, the default value of the protocol field is a default field value of the protocol field, and the operation of generating a test case message according to the test case model includes:

[0038] Generate a default message according to the default values ​​of each of the protocol fields in the test case model;

[0039] For at least one of the mutable fields, generating a mutation value of the mutable field according to a preset mutation strategy corresponding to the field characteristics of the mutable field;

[0040] The default value of the variable field in the default message is replaced by the variable value of the variable field, and a test case message is obtained according to the default message after the default value is replaced.

[0041] In a feasible implementation manner, the test case model further includes association information of associated fields in each of the protocol fields, the association information includes the protocol field and the association type associated with the associated field, and the operation of obtaining the test case message according to the default message after replacing the default value includes:

[0042] According to the association algorithm corresponding to the association type of the association field, the field value of the protocol field associated with the association field in the message is replaced according to the mutation value, and the generated value of the association field is calculated, wherein the mutation value replacement message is a default message after replacing the default value;

[0043] The generated value of the associated field is used to replace the mutated value to replace the field value of the associated field in the message, so as to obtain a test case message.

[0044] In a feasible implementation manner, the field characteristics include field type and field length, and the operation of generating a mutation value of the variable field according to a preset mutation strategy corresponding to the field characteristics of the variable field includes:

[0045] For the variable field whose field type is an integer field or a long bit field, generating a mutation value of the variable field according to a preset mutation strategy corresponding to the field length of the variable field;

[0046] For the variable field whose field type is a string field, inserting a preset character into the default value of the variable field to obtain a variable value of the variable field;

[0047] For the variable field whose field type is a universal field, the selectable values ​​of each bit of the variable field are arranged and combined to obtain multiple variable values ​​of the variable field.

[0048] In one feasible implementation, the operation of generating the default value in the test case model includes:

[0049] Determining a configuration field in each of the protocol fields according to field information of each of the protocol fields;

[0050] Obtaining a configuration value of the configuration field, and using the configuration value as a default value corresponding to the configuration field in the test case model;

[0051] For the remaining fields in each of the protocol fields except the configuration field, the field values ​​of the remaining fields in the sample message are extracted as the default values ​​corresponding to the remaining fields in the test case model.

[0052] In a feasible implementation manner, after the operation of generating a test case message according to the test case model, the processor 1001 may be used to call a black box fuzzy testing program stored in the memory 1005, and perform the following operations:

[0053] The test case message generated according to the test case model is used as a variant corpus, and a mutation operation is performed on the variant corpus to obtain a new test case message.

[0054] In one feasible implementation, the operation of using the test case message to execute the test task includes:

[0055] Sending the test case message to the device under test;

[0056] Recording the response of the device under test to the test case message in a log;

[0057] The log is output in response to a log viewing request.

[0058] In a feasible implementation manner, the test task includes multiple test phases, and the operation of obtaining the sample message includes:

[0059] Receive sample messages of any target test phase uploaded by the user;

[0060] The operation of using the test case message to execute the test task includes:

[0061] Execute each of the test phases in order, wherein when executing the target test phase, the test case message generated based on the test case model is sent to the device under test, and when executing a test phase other than the target test phase, a message generated based on a preset default model corresponding to the test phase is sent to the device under test.

[0062] In one feasible implementation, the processor 1001 may be used to call the black box fuzz testing program stored in the memory 1005 and perform the following operations:

[0063] Obtaining the current test status of the test task, the current test status including the current test progress of each test stage in the test task;

[0064] The current test status is visually output.

[0065] Based on the above structure, various embodiments of the black box fuzz testing method are proposed.

[0066] Reference Figure 2 , Figure 2 This is a flowchart of the first embodiment of the black box fuzz testing method of the present application. The embodiment of the present application provides an embodiment of the black box fuzz testing method. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that here. The execution subject of the black box fuzz testing method of the present application can be a personal computer, server and other devices, which is not limited in the present embodiment. For the sake of ease of description, the following explanation of each embodiment by the execution subject is omitted. In this embodiment, the black box fuzz testing method includes:

[0067] Step S10, obtaining a test case model, wherein the test case model includes field characteristics of variable fields in each protocol field in a message to be sent in the test task;

[0068] The test task may be a task to test a certain communication protocol, or may be a task to test a certain function of a device (hereinafter referred to as the device under test) that communicates using a certain communication protocol. The device under test may be a smart device such as a smart phone, an Internet of Things terminal device, etc., which is not limited in this embodiment. In this embodiment, there is no restriction on the setting of the test task. It should be noted that the black box fuzzy testing method in this embodiment can be applied to any structured protocol, and supports the testing of communication protocols at layers above the link layer, such as IEEE 802.11 (IEEE802.11 is a common standard for wireless local area networks today, and it is a standard for wireless network communication defined by the Institute of Electrical and Electronics Engineers (IEEE)), Bluetooth, NFC (Near Field Communication) and other communication protocols. For example, in a feasible implementation, the test task may be a task to test the authentication link in the access process of the IEEE 802.11 protocol.

[0069] A message refers to a communication protocol message. In the test task, a message needs to be sent to the device under test. In this embodiment, for any type of message, a test case model corresponding to the message of this type can be obtained, and the test case model includes the field characteristics of the variable fields in each protocol field in the message of this type. The field characteristics of the variable field can be the characteristics used to distinguish the mutation strategy of the variable field. The variable field refers to a field in the message that can be mutated.

[0070] In this embodiment, there is no restriction on the method of obtaining the test case model. For example, the test case model can be uploaded by the user, or the test case model uploaded by the user can be saved locally in advance and obtained locally when needed. For example, the test case model can be generated based on a sample message.

[0071] Step S20, generating a test case message according to the test case model, wherein the field value of at least one of the mutable fields in the test case message is generated according to a preset mutation strategy corresponding to the field feature of the mutable field;

[0072] After obtaining the test case model, a test case message can be generated according to the test case model. In the test case message generated according to the test case model, there may be at least one field value of a mutable field generated according to the preset mutation strategy corresponding to the field characteristics of the mutable field. In a specific implementation, in addition to the protocol field whose field value is generated according to the mutation strategy in the test case message, the field value of other protocol fields may be the field value of the corresponding protocol field in the sample message, or may be a preset default value. In a feasible implementation, the test case model may include the default value of each protocol field. In the case where the protocol field is not mutated, the default value of the protocol field can be used as the field value of the protocol field in the test case message. There may be one or more mutable fields in the test case model. If there are multiple, according to the specific implementation, it can be specified or randomly generated according to the corresponding mutation strategy for one or more mutable fields. Among them, in the specified case, each mutable field can be displayed in a visual interface for the user to select. It can be understood that in a test case message, at least one field value of a protocol field is generated according to the corresponding mutation strategy. In a specific implementation, the correspondence between field features and mutation strategies can be pre-set, that is, different field features correspond to different mutation strategies. For example, the field type is a field feature, and the mutation strategies corresponding to integer and string fields are different; the mutation strategy corresponding to the mutable field is determined based on the correspondence, and then the field value of the mutable field is generated according to the mutation strategy.

[0073] Step S30, using the test case message to execute the test task.

[0074] According to the needs in the specific application scenario, one or more test case messages can be generated according to the test case model. If multiple test case messages are generated, each test case message can be used to execute the test task separately. For example, after using a test case message to execute a test task once, the next test case message can be used to execute the test task again; using each test case message to execute the test task separately may obtain different test results. The specific process of using the test case message to execute the test task is not limited in this embodiment. For example, in a feasible implementation, the test result can be obtained according to the response of the device to be tested by sending a test case message to the device to be tested. In a specific implementation, when configuring the test task, the device information of the device to be tested can be configured, such as the SSID, MAC address, test channel, encryption method and other information of the device to be tested. This information can be used as the default value of the corresponding field when generating the test case message, or when sending the test case message. By configuring the device information, the normal execution of the test task is guaranteed. For example, SSID, MAC address, and test channel can be pre-set as configuration fields, and the acquired SSID, MAC address, and test channel of the device under test can be used as the configuration value of the configuration field to generate a test case model based on the configuration value. The device information of the device under test can be input by the user in the human-computer interaction interface, or the test device can sniff the message in the air, extract the specific field in the message to obtain the device information, and display the device information of each device in the human-computer interaction interface for the user to select the required device information and configure it as the device information of the device under test. The device information that users select most frequently can be set as the default value to improve the convenience of configuration.

[0075] In a specific implementation manner, test case models may be generated based on different types of sample messages, and test case messages may be generated based on various test case models. Each test case message may be used to execute a different test task.

[0076] In this embodiment, a test case model is obtained, and the test case model includes field characteristics of variable fields in each protocol field in the message to be sent in the test task, and a test case message is generated according to the test case model, wherein the field value of at least one variable field in the test case message is generated according to a preset mutation strategy corresponding to the field characteristics of the variable field, and the test task is executed using the test case message. The embodiment of the present application provides an efficient black box fuzzy testing solution. Compared with generating test data by randomly changing existing data samples, the embodiment of the present application generates a test case message for testing through a test case model. Since the test case model includes field characteristics of variable fields, and the field values ​​of the variable fields in the test case message are generated according to the mutation strategy corresponding to the field characteristics of the variable fields, the test case message generated for black box fuzzy testing is more effective.

[0077] Based on the above first embodiment, a second embodiment of the black box fuzzy testing method of the present application is proposed. In this embodiment, step S10 includes:

[0078] Step S101, obtaining a sample message;

[0079] A sample message refers to a message used as a sample, and a test case message refers to a message used as a test case, that is, a test case message is generated using a sample message as a template, and the test case message is used to perform a test task. The purpose of the test case message generated based on the sample message is the same as the purpose of the sample message. The purpose of the sample message can be determined based on the test task. In this embodiment, there is no restriction on the type of sample message. In a feasible implementation, the test task can be a task for testing the authentication link in the access process of the IEEE 802.11 protocol, and the message of the authentication link can be obtained as a sample message.

[0080] The method of obtaining the sample message is not limited in this embodiment. For example, the sample message may be a message uploaded by a user, or a message sent by other devices may be received as a sample message.

[0081] Step S102: Generate a test case model according to the field information of each protocol field in the sample message, wherein the test case model includes field characteristics of the variable fields in each protocol field in the sample message.

[0082] In a specific implementation, the sample message can be converted into a format that is convenient for analyzing and reading field information, and then a test case model is generated based on the sample message in the converted format. In this embodiment, there is no restriction on the conversion format, and a format that is convenient for analyzing and reading field information can be selected, for example, it can be converted into a pdml (Page Discrimination Markup Language) format. The following is an example fragment of a message in pdml format: ................

[0084] <field name="wlan.duration"showname=".000 0001 0011 1010=Duration:314microseconds"size="2"pos="32"show="314"value="13A"unmaskedvalue="3a01" / >

[0085] <field name="wlan.ra" showname="Receiver address:2e:54:35:5c:07:cf(2e:54:35:5c:07:cf)" size="6" pos="34"show="2e:54:35:5c:07:cf"value="2e54355c07cf" / >

[0086] <field name="wlan.ra_resolved"showname="Receiver address(resolved):2e:54:35:5c:07:cf"hide="yes"size="6"pos="34"show="2e:54:35:5c:07:cf"value="2e54355c07cf" / >

[0087] <field name="wlan.addr"showname="Hardware address:2e:54:35:5c:07:cf(2e:54:35:5c:07:cf)"hide="yes"size="6"pos="34"show="2e:54:35:5c:07:cf"value="2e54355c07cf" / >

[0088] <field name="wlan.addr_resolved"showname="Hardware address(resolved):2e:54:35:5c:07:cf"hide="yes"size="6"pos="34"show="2e:54:35:5c:07:cf"value="2e54355c07cf" / >

[0089] <field name="wlan.da" showname="Destination address:2e:54:35:5c:07:cf (2e:54:35:5c:07:cf)" size="6" pos="34"show="2e:54:35:5c:07:cf"value="2e54355c07cf" / > .....................

[0091] The content defined by the <> symbol is the field information of a protocol field, field name is the field name of the protocol field, showname is the field description information of the protocol field, size is the field length of the protocol field, pos is the offset position of the protocol field in the message, hide indicates whether the protocol field can be hidden, and value is the field value of the protocol field.

[0092] The sample message includes multiple protocol fields and field values ​​of each protocol field. In black box fuzz testing, the test case message can be generated by mutating the field values ​​of one or more protocol fields in the sample message. In this embodiment, a test case model is first generated according to the field information of each protocol field in the sample message, and then the test case message is generated according to the test case model. The test case model includes but is not limited to the field characteristics of the variable fields in each protocol field in the sample message. Among them, the field information of the protocol field may include information for determining whether the protocol field is a variable field, and may include information for extracting the field characteristics of the protocol field. The field characteristics of the variable field may be characteristics for distinguishing the mutation strategy of the variable field. The variable field refers to a field that can be mutated in the sample message. In a specific implementation, the correspondence between the field information of the protocol field and whether the protocol field is variable can be preset, that is, when the field information of the protocol field is preset to include which information, it indicates that the protocol field is a variable field, and when it includes which information or does not include which information, it indicates that the protocol field is not a variable field. According to the correspondence, the field information of the protocol field is analyzed to determine whether the protocol field is a variable field. By analyzing whether each protocol field is a variable field and only mutating the variable field, the effectiveness of the generated test case message can be improved. In a specific implementation, the correspondence between the field information of the protocol field and the field characteristics can also be preset, that is, when the field information of the protocol field is preset to include which information, it indicates which field characteristics the protocol field has. According to the correspondence, the field information of the protocol field can be analyzed to obtain the field characteristics of the protocol field.

[0093] In this embodiment, a sample message is obtained, and a test case model is generated according to the field information of each protocol field in the sample message, wherein the test case model includes the field characteristics of the variable fields in each protocol field in the sample message; a test case message is generated according to the test case model, wherein the field value of at least one variable field in the test case message is generated according to the preset mutation strategy corresponding to the field characteristics of the variable field; and the test task is executed using the test case message. This embodiment provides an efficient black box fuzzy testing solution, which improves the test efficiency of black box fuzzy testing by automatically generating a test case model based on a sample message, and then generating a test case message based on the test case model for testing.

[0094] Based on the above first and / or second embodiments, a third embodiment of the black box fuzzy testing method of the present application is proposed. In this embodiment, step S102 includes:

[0095] Step S1021, matching the field information of the protocol field in the sample message with the preset information, and obtaining the variation of the protocol field according to the matching result, wherein the matching result indicates whether the preset information exists in the field information of the protocol field, and the variation is used to indicate whether the protocol field is variable;

[0096] The preset information may be information that needs to be included in the field information of the variable protocol field, or may be information that cannot be included in the field information of the variable protocol field (in other words, information that needs to be included in the field information of the non-variable protocol field), which can be obtained in advance by analyzing the communication protocol rules to which the sample message belongs. For each protocol field in the sample message, the field information of the protocol field can be matched with the preset information to obtain a matching result of whether there is preset information in the field information of the protocol field, and the variation of the protocol field can be obtained according to the matching result, that is, according to the matching result, it can be determined whether the protocol field can be varied, that is, whether it is a variable field. It can be understood that if the preset information is information that needs to be included in the field information of the variable protocol field, then when the preset information exists in the field information of the protocol field, it can be determined that the protocol field is a variable field; if the preset information is information that cannot be included in the field information of the variable protocol field, then when the preset information exists in the field information of the protocol field, it can be determined that the protocol field is not a variable field.

[0097] Step S1022, extracting the field feature of the protocol field from the field information of the protocol field;

[0098] The method of extracting the field features of the protocol field from the field information of the protocol field is not limited in this embodiment. In a specific implementation, the field features may include features related to the mutation strategy such as field type and field length. The correspondence between the field information and the field features may be preset, that is, which field features correspond to which information contained in the field information. Exemplarily, after converting the sample message into the pdml format, each protocol field corresponds to a hidden layer field (hide), an offset position field (pos), a protocol field description information (showname field), a length field (size) and other field information. The showname field may be analyzed. If address, channel, RSN, SSID, and Algorithm exist, it is determined that the field type of the field is a string type. If there are alternating 1s and 0s or minutes, seconds, number, db, or time, it is determined that the field type of the field is an integer type.

[0099] Step S1023: Generate the test case model according to the variation of each of the protocol fields and the field characteristics.

[0100] The generated test case model may include field characteristics of mutable fields, that is, the mutable fields in each protocol field may be determined according to the mutation of each protocol field, and then the test case model may be generated according to the field characteristics of the mutable fields.

[0101] In one feasible implementation, step S102 includes:

[0102] Step S1024, according to the protocol to be tested corresponding to the test task, select the analysis strategy corresponding to the protocol to be tested from the preset analysis strategies corresponding to various communication protocols to analyze the field information of each protocol field in the sample message, and obtain the test case model according to the analysis result.

[0103] The test task may be a task to test a certain communication protocol, or may be a task to test a certain function of a device that uses a certain communication protocol for communication, and the communication protocol is the protocol to be tested. The protocols to be tested for different test tasks may be different, for example, they may be protocols such as IEEE 802.11, Bluetooth or NFC. The protocol rules of different communication protocols have commonalities, but there may also be some differences. Different analysis strategies can be pre-set for different communication protocols. After determining the protocol to be tested for the test task, the field information of each protocol field in the sample message can be analyzed according to the analysis strategy corresponding to the protocol to be tested, and then the test case model is obtained according to the analysis result. It can be understood that by setting corresponding analysis strategies for different communication protocols in advance, the applicable protocol range of the black box fuzzy testing method can be improved. In a feasible implementation, different analysis strategies can be reflected in the different corresponding relationships between the field information of the protocol field and whether the protocol field is variable (partially different or completely different), or reflected in the different corresponding relationships between the field information of the protocol field and the field characteristics (partially different or completely different). Exemplarily, the analysis strategies may be as follows: the 802.11 protocol may use strategies a, b, c, e, g, and h; the Bluetooth protocol may use strategies c, d, e, f, and h; and the NFC protocol may use strategies a, d, and f.

[0104] a) If the showname field of a protocol field contains an address / channel / RSN (classification: display type identifier) ​​string, then the protocol field is determined to be a string type field and is an immutable field;

[0105] b) If the showname field of a protocol field contains an SSID string (classification: descriptive identifier), it is determined that the protocol field is a string type field and is a mutable field;

[0106] c) If the showname field of a protocol field contains the string Algorithm (category: algorithm type identifier), it is determined that the protocol field is a string type field and is a mutable field;

[0107] d) If the showname field of a protocol field has alternating 1s and 0s or a string such as minutes\seconds\number\db\time (classification: time / random number type identifier), it is determined that the protocol field is an integer field and a mutable field;

[0108] e) If the showname field of a protocol field contains characters such as flag\true\false (classification: flag bit / Boolean flag), it is determined that the protocol field belongs to the universal field and is a variable field;

[0109] f) If the showname field of a protocol field contains a size character (classification: time / random number type identifier), it is determined that the protocol field is an immutable field. It can also be determined that the protocol field is an associated field, and the associated type is length;

[0110] g) If a mask field appears in the field information of a protocol field, it can be determined that the protocol field is a mask field and is a variable field.

[0111] h) If the words "crc" and so on appear in the showname field of a protocol field (classification: verification type identifier), it is determined that the protocol field is an immutable field, and it can be determined that the protocol field is an associated field, and the association type is crc verification.

[0112] In one feasible implementation, step S102 includes:

[0113] Step S1025, parsing the relationship between the various protocol fields in the sample message, if the analysis shows that there are parent protocol fields and sub-protocol fields between the various protocol fields, generating a test case model according to the field information of the sub-protocol fields.

[0114] When there are parent protocol fields and sub-protocol fields in each protocol field of the sample message, field deduplication can be performed, and a test case model is generated based on the field information of the sub-protocol field. The method of parsing the relationship between each protocol field in the sample message is not limited in this embodiment.

[0115] Based on the above first, second and / or third embodiments, a fourth embodiment of the black box fuzzy testing method of the present application is proposed. In this embodiment, step S20 includes:

[0116] Step S201, generating a default message according to the default values ​​of each of the protocol fields in the test case model;

[0117] The test case model also includes the default value of each protocol field, and the default value of the protocol field is the default field value of the protocol field. The source of the default value of each protocol field in the test case model is not limited in this embodiment. For example, in a feasible implementation, the field value of each protocol field in the sample message can be used as the default value of each protocol field in the test case model. A message can be generated according to the default value of each protocol field in the test case model, and the message is used as the default message. In a feasible implementation, a message including each protocol field can be generated, and the default value of each protocol field is used as the field value of each protocol field in the message, and the message is used as the default message.

[0118] Step S202: for at least one of the mutable fields, generating a mutation value of the mutable field according to a preset mutation strategy corresponding to the field characteristics of the mutable field;

[0119] For at least one mutable field in the test case model, a mutation value of the mutable field may be generated according to a preset mutation strategy corresponding to the field characteristics of the mutable field. Exemplarily, the field characteristics may include the field type of the protocol field, and for integer fields, the mutation value may be generated by reversing bits, and for string fields, the mutation value may be generated by inserting characters.

[0120] Step S203, replacing the default value of the variable field in the default message with the variable value of the variable field, and obtaining a test case message according to the default message after replacing the default value.

[0121] After generating the mutated value of the mutable field, the mutated value of the mutable field can be used to replace the default value of the mutable field in the default message. In a specific implementation, the default message after replacing the default value can be directly used as a test case message according to specific needs, or the default message after replacing the default value can be processed in other ways to obtain a test case message.

[0122] In one feasible implementation, the step of obtaining the test case message according to the default message after replacing the default value in step S203 includes:

[0123] Step S2031, according to the association algorithm corresponding to the association type of the association field, the field value of the protocol field associated with the association field in the message is replaced according to the mutation value, and the generated value of the association field is calculated, wherein the mutation value replacement message is a default message after replacing the default value;

[0124] The test case model may also include association information of associated fields in each protocol field. An associated field refers to a field that has an association relationship with other protocol fields. The association information includes the protocol field associated with the associated field (i.e., the field that has an association relationship with the associated field) and the association type (the type of the association relationship). When the field value of the protocol field associated with the associated field changes, the field value of the associated field also changes. The association information of the associated fields in each protocol field can be extracted from the field information of each protocol field. In a specific implementation, the correspondence between the field information of the protocol field and whether the protocol field is an associated field can be pre-set, and a parsing rule for parsing the protocol field and the association type associated with the associated field from the field information of the associated field can be set. According to the correspondence and the field information of the protocol field, it can be determined whether the protocol field is an associated field. If the protocol field is an associated field, the protocol field and the association type associated with the protocol field can be obtained by parsing according to the parsing rule.

[0125] Different association types correspond to different association algorithms. The default message after replacing the default value with a mutation value is called a mutation value replacement message for distinction. The generated value of the association field can be calculated according to the association algorithm corresponding to the association type of the association field and the field value of the protocol field associated with the association field in the mutation value replacement message.

[0126] Step S2032: Replace the field value of the associated field in the message with the generated value of the associated field to obtain a test case message.

[0127] In one feasible implementation, when the associated field itself is used as a field that needs to be mutated, the field values ​​of other protocol fields except the associated field can all adopt default values, and only the field value of the associated field is mutated according to the corresponding mutation strategy; it can be understood that since the field values ​​of other protocol fields adopt default values, the field value of the associated field is mutated, so the field value of the associated field must be wrong, so that the response of the device under test to an erroneous message can be tested.

[0128] In one feasible implementation, step S202 includes:

[0129] Step S2021: for the variable field whose field type is an integer field or a long bit field, generating a mutation value of the variable field according to a preset mutation strategy corresponding to the field length of the variable field;

[0130] The field characteristics of a protocol field may include a field type and a field length of the protocol field.

[0131] When the variable field is an integer field or a long bit field, a value within the field length range of the variable field can be generated as the variation value of the protocol field. Different mutation strategies can be set for different field lengths to improve the effectiveness of the generated test case message. In a specific implementation, for an integer field or a long bit field whose field length is less than a preset length, the selectable values ​​of each bit of the variable field (that is, 0 and 1) can be arranged and combined to generate multiple variation values ​​of the variable field, and each variation value can be used to replace the default value of the variable field to generate a test case message. For an integer field or a long bit field whose field length is greater than or equal to the preset length, in order to avoid generating too many test case messages by using an arrangement and combination method, a special value can be used as the variation value of the variable field; illustratively, in a feasible implementation, the maximum value within the field length (number of bits) of the variable field can be calculated, that is, 2 比特位数 , set to max_num, for example, if the length of the variable field is 16 bits, then max_num = 2 16 , calculate the special value (0, max_num / 2, max_num / 3, max_num / 4, max_num / 8, max_num / 16, max_num / 32, max_num / 64)±10 as the mutation value of the mutable field.

[0132] Step S2022: for the variable field whose field type is a string field, inserting a preset character into the default value of the variable field to obtain a variable value of the variable field;

[0133] When the mutable field is a string field, the mutation value of the mutable field can be obtained by inserting preset characters into the default value of the mutable field. The preset characters can be set in advance as needed, and are not limited in this embodiment. For example, they can be special characters or invisible characters that may cause abnormalities collected through research. In some feasible implementations, for string fields, mutation values ​​can also be generated by performing random bit reversal, over-length examples, inserting blank fields, and other conventional mutation strategies.

[0134] Step S2023: for the variable field whose field type is a universal field, the selectable values ​​of each bit of the variable field are arranged and combined to obtain multiple variant values ​​of the variable field.

[0135] When the mutable field is a universal field, such as a flag field or a Boolean field, the selectable values ​​of each bit of the mutable field (i.e., 0 and 1) can be arranged and combined to obtain multiple variant values ​​of the mutable field. For example, if a mutable field is a universal field with a field length of 2 bits, four variant values ​​of 00, 01, 10, and 11 can be generated.

[0136] In one feasible implementation, the step of generating the default value in the test case model in step S102 includes:

[0137] Step S1026, determining a configuration field in each of the protocol fields according to the field information of each of the protocol fields;

[0138] Some protocol fields in the sample message may be fields that require user configuration, such as the SSID and MAC address fields of the device to be tested. The configuration fields in each protocol field can be determined in advance based on the field information of each protocol field. In a specific implementation, the information required to be included in the field information of the configuration field (hereinafter referred to as configuration field description information for distinction) can be pre-set. When the configuration field description information exists in the field information of the protocol field, it can be determined that the protocol field is a configuration field.

[0139] Step S1027, obtaining a configuration value of the configuration field, and using the configuration value as a default value corresponding to the configuration field in the test case model;

[0140] Step S1028: For the remaining fields in each of the protocol fields except the configuration field, extract the field values ​​of the remaining fields in the sample message as the default values ​​corresponding to the remaining fields in the test case model.

[0141] There are many ways to obtain the configuration value of the configuration field, for example, it may be to obtain the configuration value pre-stored locally, or it may be to receive the configuration value input by the user through the human-computer interaction interface.

[0142] In a feasible implementation manner, after step S20, the method further includes:

[0143] Step S40: using the test case message generated according to the test case model as a variant corpus, performing a mutation operation on the variant corpus to obtain a new test case message.

[0144] The mutation operation performed on the variant corpus is not limited in this embodiment, and can be implemented by using the mutation operation in the conventional mutation-based test case message generation method. For example, mutation operations such as randomly exchanging the position of parameters (protocol groups), adding / deleting random parameters, randomly adjusting the end order of the case fields, testing extremely large parameters (parameters that do not meet the protocol requirements), and mutating specific connectors can be used. The new test case message obtained by performing the mutation operation on the variant corpus can also be used to execute the test task, thereby enriching the number and types of test case messages and improving the test coverage.

[0145] Based on the above first, second, third and / or fourth embodiments, a fifth embodiment of the black box fuzzy testing method of the present application is proposed. In this embodiment, step S30 includes:

[0146] Step S301, sending the test case message to the device under test;

[0147] After the test case message is generated, the test case message may be sent to the device under test, so as to obtain a test result according to the response of the device under test to the test case message.

[0148] In one possible implementation, if Figure 3 As shown, the test software, i.e., the software used to implement the black box fuzz testing method in the embodiment of the present application, can be deployed on the test device. According to the different communication protocols to be tested in the test task, the test device can be configured to connect the corresponding test hardware via USB, so that the test device can communicate with the device under test through the test hardware through the communication protocol; for example, when the communication protocol is the IEEE 802.11 protocol, the device under test can be communicated with through a wireless network card that supports the monitoring mode; when the communication protocol is the Bluetooth protocol, the device under test can be communicated with through a Bluetooth adapter; when the communication protocol is the NFC protocol, the device under test can be communicated with through the NFC reader function; when the communication protocol is a wired protocol, the test device can maintain connection with the device under test through Ethernet. It should be noted that if the test device itself has the function of communicating with the device under test according to the communication protocol, the test device can perform the test task without connecting the corresponding test hardware. For example, if the test device has the function of communicating according to the wireless communication protocol IEEE 802.11, the test task can be performed without the need to connect an additional wireless network card. In a specific implementation, when executing a test task, the test device can send a test case message to the device under test through the test hardware in a socket manner. Figure 3As shown, the test software can be composed of a front-end UI (User Interface), a back-end server and middleware. In a feasible implementation, the test software can adopt a lightweight B / S architecture, and all functions can be used by opening a specified page using a browser. The browser front-end page and the server can be built together on the same host. In a specific implementation, different communication protocols can be tested separately at the same time without interfering with each other. In a specific implementation, the test software can include an interactive UI, a test environment plug-in, code, etc., which can be deployed to a Linux kernel device, can be built and deployed in the form of a virtual machine or Docker, or can be deployed to a windows system.

[0149] Step S302, recording the response of the device under test to the test case message in a log;

[0150] The response of the device under test to the test case message may include: whether there is a response, the response time, the content of the response message, whether the response is abnormal, etc. In a specific implementation, each time a test task is executed using a test case message, the response situation can be recorded once. After executing the test task in sequence using multiple test case messages, multiple logs can be obtained.

[0151] In a specific implementation, the device under test responds after receiving the test case message. Since there are various messages in transmission in the environment and there is a lot of noise, the test device can call the status monitor to denoise the device response when monitoring the response status of the device under test in real time, that is, according to the device information of the device under test, remove the messages transmitted by other devices other than the device under test. In a feasible implementation, the test device can send a non-mutated original probe message to the device under test and record the response of the device under test to the original probe message. It can be understood that according to the response of the device under test to the original probe message, it can be determined whether the device under test can communicate normally, thereby determining whether the device under test responds abnormally to the test case message only because the device under test itself is abnormal.

[0152] Step S303: output the log in response to the log viewing request.

[0153] The log viewing request may be triggered by the user or according to a custom trigger condition, which is not limited in this embodiment. The output log may be output to a visual interface for display, or may be output to a storage device for storage, or may be sent to other devices, which is not limited in this embodiment. In a feasible implementation, if Figure 3As shown, the log report module in the front-end UI can be used to output and display logs, and test case messages and other test information can also be displayed, such as test time, device information of the device to be tested, etc. The front-end can also set a test case reproduction module to provide a test case reproduction function, such as allowing users to select or input test case messages that need to be reproduced. The back-end server uses the test case messages selected by the user to perform another test and record the test results to achieve vulnerability reproduction and location.

[0154] In one feasible implementation, the logs can be analyzed to obtain visualized analysis results and displayed on the front end, such as the change of test response time with test time, the correlation between test requests and test responses, and the comparison of test model effects. Based on the visualized conclusions, users can be assisted in problem analysis and location.

[0155] In one feasible implementation, the step of obtaining a sample message in step S101 includes:

[0156] Step S1011, receiving a sample message of any target test phase uploaded by a user;

[0157] A test task may include multiple test phases. Each test phase needs to be executed in a certain order. Each test phase sends a message to the device under test, that is, each test phase sends a different type of message to the device under test. The user can choose to generate a test case message for one or more test phases in the test case by automatically generating a test case model. That is, the user can upload sample messages for one or more test phases. The sample message of the target test phase uploaded by the user is received, and the test case message of the target test phase is generated according to the sample message.

[0158] The step S30 comprises:

[0159] Step S304, execute each test phase in the order of each test phase, wherein, when executing the target test phase, the test case message generated based on the test case model is sent to the device under test, and when executing a test phase other than the target test phase, a message generated based on a preset default model corresponding to the test phase is sent to the device under test.

[0160] When executing a test task, each test stage can be executed in the order of each test stage, and when executing each test stage, the message of the test stage is sent to the device under test. Among them, when executing the target test stage, the message sent to the device under test is generated according to the test case model generated by the sample message of the target test stage, that is, the above-mentioned test case message. When executing a test stage other than the target test stage, the message sent is generated based on the preset default model corresponding to the test stage. That is, the default models corresponding to each test stage of the test task are pre-set, and the user can choose to use the default model or upload a sample message to automatically generate a model. It can be understood that the default model contains the same type of information as the test case model. For example, the default model corresponding to the test stage includes the default values ​​of each protocol field in the message that needs to be sent in the test stage and the field information of the variable field.

[0161] In a specific implementation, a test phase that requires mutation selected by a user can be received. When a test case message is generated according to the model of the test phase, the test case message is generated by generating a mutation value to replace the default value. For a test phase that does not require mutation, the default message generated according to the model can be directly used as the test case message.

[0162] In one possible implementation, the method further includes:

[0163] Step S50, obtaining the current test status of the test task, where the current test status includes the current test progress of each test stage in the test task;

[0164] The current test progress of the test phase may be progress information indicating whether the test phase has not started execution, is being executed, or has been completed.

[0165] Step S60: Visually output the current test status.

[0166] In a specific implementation, the current test status can be visualized in the form of a progress chart. For example, in the chart, nodes are used to represent each test stage, arrows are used to represent the execution order of each test stage, and text or logos are used to represent the current test progress of each test stage. Figure 3 As shown, the current test status can be visually output through the status display module in the front-end UI.

[0167] In one possible implementation, the following Figure 4The process shown is used to perform black box fuzz testing. The test target refers to the device under test, and the test protocol refers to the protocol under test. Creating a new task is to create a new test task. The configuration parameters can be the parameters required for configuring the test, such as encryption method, time interval for sending test case messages, etc. Users can choose to use the built-in model (that is, the default model) or choose to automatically generate a model by uploading messages. During the test process, the corresponding response of the test case message that generates an exception can be recorded. After the test task is completed, the log can be organized into a report for output.

[0168] In addition, the embodiment of the present application also proposes a black box fuzzy testing device, the black box fuzzy testing device comprising:

[0169] An acquisition module, used for acquiring a test case model, wherein the test case model includes field characteristics of variable fields in each protocol field in a message to be sent in a test task;

[0170] A generating module, configured to generate a test case message according to the test case model, wherein a field value of at least one of the mutable fields in the test case message is generated according to a preset mutation strategy corresponding to a field feature of the mutable field;

[0171] The test module is used to execute the test task using the test case message.

[0172] In a feasible implementation manner, the acquisition module is further used for:

[0173] Get sample message;

[0174] A test case model is generated according to the field information of each protocol field in the sample message, wherein the test case model includes field characteristics of the variable fields in each protocol field in the sample message.

[0175] In a feasible implementation manner, the acquisition module is further used for:

[0176] Matching the field information of the protocol field in the sample message with the preset information, and obtaining the variation of the protocol field according to the matching result, wherein the matching result indicates whether the preset information exists in the field information of the protocol field, and the variation is used to indicate whether the protocol field is variable;

[0177] Extracting a field feature of the protocol field from the field information of the protocol field;

[0178] The test case model is generated according to the variation of each of the protocol fields and the field characteristics.

[0179] In a feasible implementation manner, the acquisition module is further used for:

[0180] According to the protocol to be tested corresponding to the test task, an analysis strategy corresponding to the protocol to be tested is selected from the analysis strategies corresponding to various preset communication protocols to analyze the field information of each protocol field in the sample message, and a test case model is obtained according to the analysis results.

[0181] In a feasible implementation manner, the acquisition module is further used for:

[0182] The relationship between the protocol fields in the sample message is parsed. If the parsing shows that there are parent protocol fields and sub-protocol fields between the protocol fields, a test case model is generated according to the field information of the sub-protocol fields.

[0183] In a feasible implementation manner, the test case model further includes a default value of each of the protocol fields, the default value of the protocol field is a default field value of the protocol field, and the acquisition module is further used to:

[0184] Generate a default message according to the default values ​​of each of the protocol fields in the test case model;

[0185] For at least one of the mutable fields, generating a mutation value of the mutable field according to a preset mutation strategy corresponding to the field characteristics of the mutable field;

[0186] The default value of the variable field in the default message is replaced by the variable value of the variable field, and a test case message is obtained according to the default message after the default value is replaced.

[0187] In a feasible implementation manner, the test case model further includes association information of associated fields in each of the protocol fields, the association information includes the protocol field and association type associated with the associated field, and the generating module is further used to:

[0188] According to the association algorithm corresponding to the association type of the association field, the field value of the protocol field associated with the association field in the message is replaced according to the mutation value, and the generated value of the association field is calculated, wherein the mutation value replacement message is a default message after replacing the default value;

[0189] The generated value of the associated field is used to replace the mutated value to replace the field value of the associated field in the message, so as to obtain a test case message.

[0190] In a feasible implementation manner, the field characteristics include field type and field length, and the generation module is further used for:

[0191] For the variable field whose field type is an integer field or a long bit field, generating a mutation value of the variable field according to a preset mutation strategy corresponding to the field length of the variable field;

[0192] For the variable field whose field type is a string field, inserting a preset character into the default value of the variable field to obtain a variable value of the variable field;

[0193] For the variable field whose field type is a universal field, the selectable values ​​of each bit of the variable field are arranged and combined to obtain multiple variable values ​​of the variable field.

[0194] In a feasible implementation manner, the acquisition module is further used for:

[0195] Determining a configuration field in each of the protocol fields according to field information of each of the protocol fields;

[0196] Obtaining a configuration value of the configuration field, and using the configuration value as a default value corresponding to the configuration field in the test case model;

[0197] For the remaining fields in each of the protocol fields except the configuration field, the field values ​​of the remaining fields in the sample message are extracted as the default values ​​corresponding to the remaining fields in the test case model.

[0198] In a feasible implementation manner, the black box fuzzy testing device further includes:

[0199] The mutation module is used to use the test case message generated according to the test case model as a mutation corpus, perform a mutation operation on the mutation corpus, and obtain a new test case message.

[0200] In one feasible implementation, the test module is further used for:

[0201] Sending the test case message to the device under test;

[0202] Recording the response of the device under test to the test case message in a log;

[0203] The log is output in response to a log viewing request.

[0204] In a feasible implementation manner, the test task includes multiple test phases, and the acquisition module is further configured to include:

[0205] Receive sample messages of any target test phase uploaded by the user;

[0206] The test module is also used to:

[0207] Execute each of the test phases in order, wherein when executing the target test phase, the test case message generated based on the test case model is sent to the device under test, and when executing a test phase other than the target test phase, a message generated based on a preset default model corresponding to the test phase is sent to the device under test.

[0208] In a feasible implementation manner, the acquisition module is further used to: acquire the current test status of the test task, the current test status including the current test progress of each test stage in the test task;

[0209] The black box fuzzy testing device also includes:

[0210] The output module is used to visually output the current test status.

[0211] In addition, an embodiment of the present application also proposes a computer-readable storage medium, on which a black box fuzzy testing program is stored. When the black box fuzzy testing program is executed by a processor, the steps of the black box fuzzy testing method described below are implemented.

[0212] The various embodiments of the black-box fuzz testing device and computer-readable storage medium of the present application can all refer to the various embodiments of the black-box fuzz testing method of the present application, and will not be repeated here.

[0213] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0214] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0215] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0216] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A black box fuzz testing method, characterized in that: The black box fuzz testing method comprises: Acquire a test case model, wherein the test case model includes field characteristics of variable fields in each protocol field in a message to be sent in the test task; Generate a test case message according to the test case model, wherein a field value of at least one of the mutable fields in the test case message is generated according to a preset mutation strategy corresponding to a field feature of the mutable field; The test case message is used to execute the test task.

2. The black box fuzz testing method according to claim 1, characterized in that: The step of obtaining the test case model comprises: Get sample message; A test case model is generated according to the field information of each protocol field in the sample message, wherein the test case model includes field characteristics of the variable fields in each protocol field in the sample message.

3. The black box fuzz testing method according to claim 2, characterized in that: The step of generating a test case model according to the field information of each protocol field in the sample message includes: Matching the field information of the protocol field in the sample message with the preset information, and obtaining the variation of the protocol field according to the matching result, wherein the matching result indicates whether the preset information exists in the field information of the protocol field, and the variation is used to indicate whether the protocol field is variable; Extracting a field feature of the protocol field from the field information of the protocol field; The test case model is generated according to the variation of each of the protocol fields and the field characteristics.

4. The black box fuzz testing method according to claim 2, characterized in that: The step of generating a test case model according to the field information of each protocol field in the sample message includes: According to the protocol to be tested corresponding to the test task, an analysis strategy corresponding to the protocol to be tested is selected from the analysis strategies corresponding to various preset communication protocols to analyze the field information of each protocol field in the sample message, and a test case model is obtained according to the analysis results.

5. The black box fuzz testing method according to claim 2, characterized in that: The step of generating a test case model according to the field information of each protocol field in the sample message includes: The relationship between the protocol fields in the sample message is parsed. If the parsing shows that there are parent protocol fields and sub-protocol fields between the protocol fields, a test case model is generated according to the field information of the sub-protocol fields.

6. The black box fuzz testing method according to claim 2, characterized in that: The test case model also includes a default value of each of the protocol fields, where the default value of the protocol field is a default field value of the protocol field. The step of generating a test case message according to the test case model includes: Generate a default message according to the default values ​​of each of the protocol fields in the test case model; For at least one of the mutable fields, generating a mutation value of the mutable field according to a preset mutation strategy corresponding to the field characteristics of the mutable field; The default value of the variable field in the default message is replaced by the variable value of the variable field, and a test case message is obtained according to the default message after the default value is replaced.

7. The black box fuzz testing method according to claim 6, characterized in that: The test case model also includes association information of associated fields in each of the protocol fields, wherein the association information includes the protocol field and the association type associated with the associated field, and the step of obtaining the test case message according to the default message after replacing the default value includes: According to the association algorithm corresponding to the association type of the association field, the field value of the protocol field associated with the association field in the message is replaced according to the mutation value, and the generated value of the association field is calculated, wherein the mutation value replacement message is a default message after replacing the default value; The generated value of the associated field is used to replace the mutated value to replace the field value of the associated field in the message, so as to obtain a test case message.

8. The black box fuzz testing method according to claim 6, characterized in that: The field characteristics include field type and field length. The step of generating a mutation value of the variable field according to the preset mutation strategy corresponding to the field characteristics of the variable field includes: For the variable field whose field type is an integer field or a long bit field, generating a mutation value of the variable field according to a preset mutation strategy corresponding to the field length of the variable field; For the variable field whose field type is a string field, inserting a preset character into the default value of the variable field to obtain a variable value of the variable field; For the variable field whose field type is a universal field, the selectable values ​​of each bit of the variable field are arranged and combined to obtain multiple variable values ​​of the variable field.

9. The black box fuzz testing method according to claim 6, characterized in that: The steps of generating the default value in the test case model include: Determining a configuration field in each of the protocol fields according to field information of each of the protocol fields; Obtaining a configuration value of the configuration field, and using the configuration value as a default value corresponding to the configuration field in the test case model; For the remaining fields in each of the protocol fields except the configuration field, the field values ​​of the remaining fields in the sample message are extracted as the default values ​​corresponding to the remaining fields in the test case model.

10. The black box fuzz testing method according to claim 1, characterized in that: After the step of generating a test case message according to the test case model, the method further includes: The test case message generated according to the test case model is used as a variant corpus, and a mutation operation is performed on the variant corpus to obtain a new test case message.

11. The black box fuzz testing method according to claim 1, characterized in that: The step of using the test case message to execute the test task includes: Sending the test case message to the device under test; Recording the response of the device under test to the test case message in a log; The log is output in response to a log viewing request.

12. The black box fuzz testing method according to claim 2, characterized in that: The test task includes multiple test phases, and the step of obtaining a sample message includes: Receive sample messages of any target test phase uploaded by the user; The step of using the test case message to execute the test task includes: Execute each of the test phases in order, wherein when executing the target test phase, the test case message generated based on the test case model is sent to the device under test, and when executing a test phase other than the target test phase, a message generated based on a preset default model corresponding to the test phase is sent to the device under test.

13. The black box fuzz testing method according to any one of claims 1 to 12, characterized in that: The method further comprises: Obtaining the current test status of the test task, the current test status including the current test progress of each test stage in the test task; The current test status is visually output.

14. A black box fuzz testing device, characterized in that: The black box fuzz testing device includes: a memory, a processor, and a black box fuzz testing program stored in the memory and executable on the processor. When the black box fuzz testing program is executed by the processor, the black box fuzz testing method according to any one of claims 1 to 13 is implemented.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a black-box fuzz testing program, which, when executed by a processor, implements the black-box fuzz testing method according to any one of claims 1 to 13.