Industrial control protocol fuzz testing method and system based on normal form grammar and reinforcement learning
By combining paradigm syntax and reinforcement learning methods, the problem of generating test cases that do not comply with regulations and ignoring data model modeling in ICS protocol testing is solved, and more efficient test coverage and abnormal discovery rates are achieved, ensuring the system of test cases. Sexual and structured.
Patent Information
- Application Number
- CN202410933797.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-07-12
AI Technical Summary
The prior art has problems in ICS protocol testing that generates test cases that do not comply with protocol regulations and focuses on feedback information collection and ignores data model modeling, resulting in unstable test results and the inability to fully explore the potential behavior of the protocol.
Using a method based on paradigm syntax and reinforcement learning, we use the Bax paradigm to describe the industrial control protocol structure, construct the syntax tree and mutation tree, initialize and update the weight of leaf nodes, select the mutation strategy to generate test cases, and use the reinforcement learning algorithm to optimize the test case generation .
It improves the test coverage and abnormal discovery rate, ensures that the test cases are systematic and structured, adaptively adjusts the mutation strategy, effectively utilizes testing resources, and improves testing efficiency and accuracy.
Smart Images

Figure CN119030906A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of protocol security testing, and in particular relates to an industrial control protocol fuzzy testing method and system based on paradigm grammar and reinforcement learning. Background Art
[0002] Industrial Control System (ICS) is the core of modern industrial infrastructure, responsible for monitoring and controlling various industrial processes. ICS usually consists of multiple components, which communicate with each other through specific ICS protocols. These protocols define data formats and interaction rules to ensure stable operation and efficient management of the system. With the development of industrial automation and intelligence, the security and reliability of ICS protocols have become particularly important.
[0003] Fuzz testing technology has been widely used in the field of software testing, especially in ICS protocol testing. It detects whether the system can properly handle abnormal input by sending mutated abnormal messages to the protocol parsing module, thereby identifying potential security vulnerabilities. At present, there are two main methods for generating abnormal input data: data generation-based methods and data mutation-based methods. The generation-based method relies on a deep understanding of the protocol format, while the mutation-based method explores more execution paths by modifying legitimate input samples. However, the generation-based method may not cover all possible input situations, and the test cases generated by the mutation-based method may contain a lot of randomness, resulting in unstable test results. Therefore, in recent years, technicians have increasingly adopted coverage-guided fuzz testing technology, which uses code coverage information to guide the generation and mutation of test inputs, thereby more effectively discovering vulnerabilities and defects in the protocol. It mainly includes protocol fuzz testing methods based on reinforcement learning and fuzz testing methods based on coverage feedback.
[0004] Although existing technologies have made some progress in ICS protocol testing, there are still some limitations: although the protocol fuzz testing method based on reinforcement learning can adaptively select mutation strategies, it may generate test cases that do not meet the requirements of the protocol specification, affecting the effectiveness of the test; the fuzz testing method based on coverage feedback focuses too much on the collection of feedback information and ignores the importance of data model modeling, which may result in test cases that cannot fully explore all potential behaviors of the protocol. Summary of the invention
[0005] In view of the deficiencies of the above-mentioned prior art, the present invention proposes an industrial control protocol fuzzy testing method and system based on paradigm grammar and reinforcement learning, which realizes fuzzy testing of industrial control protocols by combining paradigm grammar and reinforcement learning method.
[0006] To achieve the above object, the present invention provides an industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning, comprising the following steps:
[0007] Step S1: Use the extended Backus Naur Form ABNF to describe the structure of the industrial control protocol, identify the fields in the message of the industrial control protocol, construct a syntax tree of the industrial control protocol, instantiate the syntax tree to obtain a variant tree, and initialize the weight of each leaf node in the variant tree;
[0008] Step S2: selecting leaf nodes that need to be mutated according to the weight, mutating the mutation tree, traversing the mutated mutation tree to obtain test cases, and sending the test cases to the industrial control protocol for fuzzy testing;
[0009] Step S3: Update the weight of each leaf node according to the fuzzy test result, and obtain a new test case using the method in step S2;
[0010] Step S4: Repeat steps S2 to S3 until a set number of iterations is reached.
[0011] Preferably, instantiating the syntax tree to obtain a variant tree in step S1 includes the following steps: taking the message of the industrial control protocol as the root node, and each field in the message as a child node, calculating the byte length of each field according to the ABNF description of the industrial control protocol, dividing the child node into two intermediate child nodes with the middle byte of each field as the boundary, repeating the division operation until the intermediate child node contains only one byte, taking the single-byte intermediate child node as a leaf node, and constructing a variant tree of the industrial control protocol.
[0012] Preferably, mutating the mutation tree in step S2 includes the following steps: taking leaf nodes whose weights are greater than a preset threshold as pre-selected mutation points, randomly selecting several pre-selected mutation points as mutation nodes, formulating multiple mutation strategies, and using a heuristic algorithm to select a mutation strategy for each mutation node, wherein the mutation strategies include type mutation, operation mutation, and combination field mutation.
[0013] Preferably, the type mutation selects a mutation strategy according to the character type of the leaf node of the mutation tree:
[0014] When the character type of the leaf node is a numerical value, the leaf node is mutated by taking the critical value at the boundary of the numerical value;
[0015] When the character type of the leaf node is a string, an overlong string or a string containing special characters is generated to mutate the leaf node;
[0016] When the character type of the leaf node is binary, a bit reversal operation is used to mutate the leaf node.
[0017] Preferably, the operational mutation randomly selects the following strategies to mutate the mutation tree:
[0018] A. Randomly select a leaf node for copy or delete operation;
[0019] B. Randomly select a numerical leaf node and randomly increase or decrease its value;
[0020] C. Randomly select a leaf node and overwrite its value with randomly generated data;
[0021] D. Randomly shuffle the order of leaf nodes.
[0022] Preferably, the combined field mutation combines two leaf nodes with the closest weights into a new leaf node.
[0023] Preferably, in step S3, updating the weight of each leaf node according to the fuzzy test result includes the following steps:
[0024] Step S31: Calculate the reward score of the test case according to the fuzz test results:
[0025] reward=coverage_reward+exception_reward
[0026] coverage_reward=coverage_gain×coverage_weight;
[0027] exception_reward=exception_gain×exception_weight
[0028] Among them, reward is the reward score of the test case; coverage_reward is the coverage score of the test case; exception_reward is the exception detection rate score of the test case; coverage_gain is the coverage of the test case; coverage_weight is the coverage weight; exception_gain is the exception detection rate of the test case, which is 1 when the test case causes an exception, otherwise it is 0; exception_weight is the exception detection rate weight of the test case;
[0029] Step S32: Adjust the values of coverage weight and anomaly detection rate weight according to the test requirements. If the test places more emphasis on improving coverage, increase the coverage weight. If the test places more emphasis on detecting anomalies, increase the anomaly detection rate weight.
[0030] The present invention also provides an industrial control protocol fuzzy testing system based on paradigm grammar and reinforcement learning, which is implemented based on the above-mentioned industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning, including a paradigm grammar description module, a mutation module, a use case generation module and a reinforcement learning module;
[0031] The paradigm grammar description module uses the extended Backus-Naur form ABNF to describe the industrial control protocol, constructs a syntax tree of the protocol, and instantiates the syntax tree to obtain a variant tree;
[0032] The mutation module adopts a heuristic algorithm to select a mutation strategy and mutate the mutation tree;
[0033] The test case generation module traverses the mutated mutation tree, generates test cases, and sends the test cases to the protocol to be tested for fuzz testing;
[0034] The reinforcement learning module calculates the reward function of the test case according to the test results, dynamically updates the field weights, and guides the generation and mutation of subsequent test cases.
[0035] The present invention also provides an electronic device, comprising: a memory, a processor and a computer program, wherein the computer program is stored in the memory and is configured to be executed by the processor to implement the above-mentioned industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning.
[0036] The present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program is executed by a processor to implement the above-mentioned industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning.
[0037] The benefits of the present invention include at least:
[0038] 1. Use the extended Backus Narrative Form (ABNF) to uniformly describe the industrial control protocol, ensuring the systematic and structured generation of test cases, and ensuring that all protocol fields and combinations are correctly parsed and test cases are generated;
[0039] 2. By initializing and updating the weight of each leaf node in the mutation tree, the process can adaptively adjust the mutation strategy to improve the coverage of test cases and the probability of discovering vulnerabilities;
[0040] 3. Through iteration and weight update, limited test resources can be used more effectively, focusing on testing those parts that are more likely to find problems. At the same time, the test results are used to guide the subsequent test case generation, making the testing process more intelligent and goal-oriented. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1A schematic diagram of the structure of the Modus / TCP protocol selected for the embodiment of the present invention;
[0042] Figure 2 A schematic diagram of a method flow chart of an embodiment of the present invention;
[0043] Figure 3 ABNF description of the Modus / TCP protocol of an embodiment of the present invention;
[0044] Figure 4 The ABNF syntax tree of the Modus / TCP protocol constructed for the embodiment of the present invention;
[0045] Figure 5 ABNF variation tree of Modus / TCP protocol constructed for the embodiment of the present invention;
[0046] Figure 6 Schematic diagram of the system structure of an embodiment of the present invention. DETAILED DESCRIPTION
[0047] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the protection scope of the present invention.
[0048] like Figure 1 As shown, the industrial control protocol selected by the embodiment of the present invention is the Modbus / TCP protocol, and the message (modbus-tcp-frame) of the Modbus / TCP protocol is composed of an MBAP message header (mbap-header) and a protocol data unit (pdu). The MBAP message header includes a transaction flag (transaction-id), a protocol flag (protocol-id), a length (length) and a unit flag (unit-id). The protocol data unit is composed of a function code (function-code) and a data segment (data).
[0049] Embodiment 1
[0050] like Figure 2 As shown, an embodiment of the present invention provides an industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning, comprising the following steps:
[0051] Step S1: Use the extended Backus Naur Form ABNF to describe the structure of the industrial control protocol, identify the various fields in the message of the industrial control protocol, and construct a syntax tree. In order to instantiate the abstract ABNF syntax description of the protocol, parse the message sample of the industrial control protocol, generate the ABNF variation tree of the protocol, and initialize the weight of each leaf node in the variation tree.
[0052] like Figure 3 As shown, ABNF is used to describe the specifications of the industrial control protocol to be tested. The ABNF syntax tree of the protocol is constructed with the non-terminal symbols described in the ABNF of the industrial control protocol as intermediate nodes and the terminal symbols as leaf nodes. The structure of the syntax tree is as follows Figure 4 shown.
[0053] Then, we obtain the actual message sample of Modbus / TCP protocol, and use ABNF syntax tree as template to parse the actual message sample. We take the message of industrial control protocol as root node and each field in the message as child node. We calculate the byte length of each field according to the ABNF description of industrial control protocol, and divide the child node into two middle child nodes with the middle byte of each field as boundary. We repeat the division operation until the middle child node contains only one byte. We take the middle child node of single byte as leaf node and construct ABNF variation tree of industrial control protocol. Its structure is as follows: Figure 5 The mutation tree is generated according to the specific content of the message sample. It inherits the structure of the syntax tree, but adds the ability and flexibility of mutation. The nodes in the mutation tree represent the parts of the message that can be mutated, including the internal bytes of the field, etc.
[0054] Step S2: Select the leaf nodes that need to be mutated according to the size of the weight, mutate the mutation tree, perform depth-first traversal or hierarchical traversal to obtain mutation test cases, send the mutation test cases to the industrial control protocol to be tested for fuzzy testing, and represent all leaf nodes in the mutation tree in the form of vectors. Input the vectors into the reinforcement learning module to learn the weights.
[0055] Specifically, a variety of mutation strategies are formulated, and a heuristic algorithm is used to select mutation strategies to mutate the mutation tree, where the mutation strategies include type mutation, operation mutation, and combination field mutation.
[0056] Type mutation selects a mutation strategy based on the type of the field in the leaf node. For numeric fields, you can take the critical value at the boundary, etc. For string fields, you can generate an extra-long string or a string containing special characters, etc. For binary fields, you can use bit reversal operations to mutate.
[0057] Operation mutation can add or delete certain fields, randomly add or subtract a number from a field, or overwrite it with a random value. It can also shuffle leaf nodes and perform other operations to mutate.
[0058] Combined field mutation can guide mutation based on the weights learned by the reinforcement learning module. For example, if the weights of two fields are close, the two fields will be combined and mutated.
[0059] The heuristic algorithm determines the probability of field mutation based on the weight of each field. Fields with high weights are more likely to be selected for mutation. The weights define the priority of mutation, and with limited resources, the heuristic method allows testers to focus on test cases that are more likely to lead to the discovery of defects. During the heuristic mutation process, the weights can be dynamically adjusted based on the test results. If a defect is found in a mutation test case, the weight of the relevant field may be increased to explore more relevant mutations.
[0060] Heuristics help optimize the use of test resources, improve test efficiency and defect detection rates by focusing on areas with higher potential risks. By prioritizing high-weighted fields, heuristics can effectively reduce the search space that needs to be explored and avoid wasting resources in areas where problems are unlikely to be found.
[0061] At the same time, all leaf nodes in the variant tree are represented in the form of a vector, that is, each leaf node is combined with its corresponding weight to obtain a vector. For example, the modbus / TCP message is “00 01 00 00 00 06 01 03 00 6B00 03”. Assuming that the weights are all initialized to 0, the vectorized data with weights is “00 01 00 00 00 00 00 0600 0100 03 00 006B 00 03 00”.
[0062] Step S3: Send the unweighted mutation test case to the protocol to be tested for testing. The monitoring module inserts the program to be tested and monitors whether its running state is abnormal. The weight of each leaf node is updated according to the fuzzy test result. The method in step S2 is used to obtain a new test case, including the following steps:
[0063] Step S31: Calculate the reward score of the mutation test case according to the fuzzy test results:
[0064] reward=coverage_reward+exception_reward
[0065] coverage_reward=coverage_gain×coverage_weight;
[0066] exception_reward=exception_gain×exception_weight
[0067] Among them, reward is the reward score of the test case; coverage_reward is the coverage score of the test case; exception_reward is the exception detection rate score of the test case; coverage_gain is the coverage rate of the test case; coverage_weight is the coverage weight, which is initialized to 0.7 in this embodiment; exception_gain is the exception detection rate of the test case, which is 1 when the test case causes an exception, otherwise it is 0; exception_weight is the exception detection rate weight of the test case, which is initialized to 0.3 in this embodiment;
[0068] Step S32: Use the back-propagation algorithm to adjust the values of the coverage weight and the anomaly detection rate weight according to the test requirements. If the test attaches more importance to improving the coverage, the coverage weight is increased. If the test attaches more importance to discovering anomalies, the anomaly detection rate weight is increased, thereby guiding the generation of the next round of test cases.
[0069] Step S4: Repeat steps S2 to S3 until the expected effect is achieved or the test program is manually terminated and exited. At the same time, the mapping relationship between the field and the weight is recorded, which can be used for the weight initialization setting when testing other protocols.
[0070] Specifically, after updating the field weights according to the feedback information of step S3, the mutation strategy in step S2 is reused to mutate the mutation tree to generate new test cases, and the mutated test cases are sent to the protocol to be tested for testing. At the same time, the vectorized data with weight information is sent to the reinforcement learning module, and then the monitoring module monitors the execution coverage and the occurrence of abnormalities, that is, entering the loop from step S2 to step S3.
[0071] After achieving the expected effect or being terminated manually, exit the test program and record the mapping relationship between fields and weights, which can be used for weight initialization settings when testing other protocols.
[0072] The industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning proposed in the present invention combines paradigm grammar, reinforcement learning and protocol fuzzy testing. The paradigm grammar is used to uniformly describe the industrial control protocol, reduce the generation of redundant test cases, and control the mutation strategy in a finer granularity. Reinforcement learning is used to use the feedback information brought by the two indicators of coverage and anomaly detection rate to update the weights of the mutant tree leaf nodes. This combination is beneficial to improving the coverage and efficiency of protocol fuzzy testing.
[0073] The traditional fuzz testing tool peach randomly generates a large number of test cases to test the protocol to be tested based on the protocol template described by the data model. Its biggest disadvantage is that it will generate a large number of redundant test cases. Many research works have focused on improving the efficiency of fuzz testing, and different protocol fuzz testing methods have been proposed from different angles. However, some of these methods focus on the description of the protocol data format and do not use the feedback information brought by indicators such as coverage. Some focus on mutating the seeds, which may cause the generated test cases to fail to meet the protocol specifications. Others focus on the collection of feedback information and ignore the importance of data model modeling itself. The present invention provides an industrial control protocol fuzz testing method based on paradigm grammar and reinforcement learning, which combines paradigm grammar with reinforcement learning and feedback guidance and is applied to fuzz testing of protocol models, and has at least the following technical effects:
[0074] 1. Improve test coverage
[0075] The ABNF formal grammar is used to accurately describe the structure and rules of the industrial control protocol, ensuring that all protocol fields and combinations are correctly parsed and test cases are generated. In addition, the reinforcement learning algorithm can intelligently explore the protocol state space, give priority to test cases that can increase coverage, and quickly identify and cover edge cases and special paths in the protocol implementation. When testing the Modbus / TCP protocol, ABNF is used to describe the protocol structure, and the reinforcement learning algorithm optimizes the test case generation strategy based on coverage feedback. The results show that compared with traditional random fuzz testing, this method covers more protocol states and paths in a shorter time and discovers multiple potential boundary condition processing errors.
[0076] 2. Improve the abnormality detection rate
[0077] Reinforcement learning continuously adjusts and optimizes field weights to generate more challenging inputs, identify and focus on attacking the most error-prone parts of protocol implementation, such as boundary values and abnormal inputs, and improve the probability of abnormal discovery. Discover deep-level vulnerabilities that are difficult to detect with traditional fuzz testing. The most vulnerable fields in the Modbus / TCP protocol, such as function codes and data fields, are identified through reinforcement learning algorithms, and these fields are mutated to generate a large number of valid test cases. The test discovered some abnormal inputs including buffer overflows and improper handling.
[0078] Embodiment 2
[0079] like Figure 6 As shown, an embodiment of the present invention provides an industrial control protocol fuzzy testing system based on paradigm grammar and reinforcement learning, including a paradigm grammar description module, a mutation module, a use case generation module and a reinforcement learning module.
[0080] The paradigm grammar description module uses the extended Backus-Naur form (ABNF) to describe the industrial control protocol, construct the syntax tree of the protocol, instantiate the syntax tree, and obtain the variant tree. ABNF is a standardized form for describing the grammar of a language or protocol, and is usually used to describe Internet protocols such as HTTP, SMTP, etc. ABNF is more structured and consistent than EBNF, and is suitable for describing complex protocols. At the same time, ABNF uses simple and intuitive grammar rules, making the language and protocol it describes easy to understand and implement. In short, ABNF provides a hierarchical and structured way to describe grammar, which helps to define complex language structures.
[0081] The present invention uses ABNF to uniformly describe the industrial control protocol and adds a weight attribute to the node. The attribute is mainly used to record the importance of the fields learned in reinforcement learning. The higher the reward function score, the greater the weight of the field.
[0082] The mutation module uses a heuristic algorithm to select a mutation strategy and mutate the mutation tree, where the mutation strategies include type mutation, operation mutation, and combination field mutation.
[0083] The use case generation module traverses the mutated mutation tree, generates test cases, and sends the test cases to the protocol to be tested for fuzz testing.
[0084] The reinforcement learning module adopts the reinforcement learning algorithm to calculate the reward function of the test results to evaluate the effectiveness of the test case, and uses the back-propagation algorithm to update the weight information of the input vector to guide the generation and mutation of subsequent test cases.
[0085] At the same time, a monitoring module can also be set up to monitor the system's operating status in real time during the process of generating test cases.
[0086] Embodiment 3
[0087] An embodiment of the present invention provides an electronic device, comprising: a memory, a processor and a computer program, wherein the computer program is stored in the memory and is configured to be executed by the processor to implement the above-mentioned industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning.
[0088] Embodiment 4
[0089] An embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored. The computer program is executed by a processor to implement the above-mentioned industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning.
[0090] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. Only the preferred embodiments of the present invention are expressed. The description is more specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. As long as there is no contradiction in the combination of these technical features, they should be considered as the scope recorded in this specification.
[0091] It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these modifications and improvements all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A fuzzy testing method for industrial control protocols based on paradigm grammar and reinforcement learning, characterized by: The following steps are involved: Step S1: Use the extended Backus Naur Form ABNF to describe the structure of the industrial control protocol, identify the fields in the message of the industrial control protocol, construct a syntax tree of the industrial control protocol, instantiate the syntax tree to obtain a variant tree, and initialize the weight of each leaf node in the variant tree; Step S2: selecting leaf nodes that need to be mutated according to the weight, mutating the mutation tree, traversing the mutated mutation tree to obtain test cases, and sending the test cases to the industrial control protocol for fuzzy testing; Step S3: Update the weight of each leaf node according to the fuzzy test result, and obtain a new test case using the method in step S2; Step S4: Repeat steps S2 to S3 until a set number of iterations is reached.
2. According to claim 1, a fuzzy testing method for industrial control protocols based on paradigm grammar and reinforcement learning is characterized in that: Instantiating the syntax tree to obtain a variant tree in step S1 includes the following steps: taking the message of the industrial control protocol as the root node, and each field in the message as a child node, calculating the byte length of each field according to the ABNF description of the industrial control protocol, dividing the child node into two intermediate child nodes with the middle byte of each field as the boundary, repeating the division operation until the intermediate child node contains only one byte, taking the single-byte intermediate child node as a leaf node, and constructing a variant tree of the industrial control protocol.
3. According to claim 1, a fuzzy testing method for industrial control protocols based on paradigm grammar and reinforcement learning is characterized in that: In step S2, mutating the mutation tree includes the following steps: taking leaf nodes with weights greater than a preset threshold as pre-selected mutation points, randomly selecting several pre-selected mutation points as mutation nodes, formulating multiple mutation strategies, and using a heuristic algorithm to select a mutation strategy for each mutation node, wherein the mutation strategies include type mutation, operation mutation, and combination field mutation.
4. According to claim 3, a fuzzy testing method for industrial control protocols based on paradigm grammar and reinforcement learning is characterized in that: The type mutation selects a mutation strategy based on the character type of the leaf node of the mutation tree: When the character type of the leaf node is a numerical value, the leaf node is mutated by taking the critical value at the boundary of the numerical value; When the character type of the leaf node is a string, an overlong string or a string containing special characters is generated to mutate the leaf node; When the character type of the leaf node is binary, a bit reversal operation is used to mutate the leaf node.
5. According to claim 3, a fuzzy testing method for industrial control protocols based on paradigm grammar and reinforcement learning is characterized in that: The operational mutation randomly selects the following strategies to mutate the mutation tree: A. Randomly select a leaf node for copy or delete operation; B. Randomly select a numerical leaf node and randomly increase or decrease its value; C. Randomly select a leaf node and overwrite its value with randomly generated data; D. Randomly shuffle the order of leaf nodes.
6. According to claim 3, a fuzzy testing method for industrial control protocols based on paradigm grammar and reinforcement learning is characterized in that: The combined field mutation combines two leaf nodes with the closest weights into a new leaf node.
7. The industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning according to claim 1 is characterized in that: In step S3, the weight of each leaf node is updated according to the fuzzy test result, including the following steps: Step S31: Calculate the reward score of the test case according to the fuzz test results: reward=coverage_reward+exception_reward coverage_reward=coverage_gain×coverage_weight; exception_reward=exception_gain×exception_weight Among them, reward is the reward score of the test case; coverage_reward is the coverage score of the test case; exception_reward is the exception detection rate score of the test case; coverage_gain is the coverage of the test case; coverage_weight is the coverage weight; exception_gain is the exception detection rate of the test case, which is 1 when the test case causes an exception, otherwise it is 0; exception_weight is the exception detection rate weight of the test case; Step S32: Adjust the values of coverage weight and anomaly detection rate weight according to the test requirements. If the test places more emphasis on improving coverage, increase the coverage weight. If the test places more emphasis on detecting anomalies, increase the anomaly detection rate weight.
8. An industrial control protocol fuzzy testing system based on paradigm grammar and reinforcement learning, implemented based on an industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning as claimed in any one of claims 1 to 7, characterized in that: It includes paradigm grammar description module, mutation module, use case generation module and reinforcement learning module; The paradigm grammar description module uses the extended Backus-Naur form ABNF to describe the industrial control protocol, constructs a syntax tree of the protocol, and instantiates the syntax tree to obtain a variant tree; The mutation module adopts a heuristic algorithm to select a mutation strategy and mutate the mutation tree; The test case generation module traverses the mutated mutation tree, generates test cases, and sends the test cases to the protocol to be tested for fuzz testing; The reinforcement learning module calculates the reward function of the test case according to the test results, dynamically updates the field weights, and guides the generation and mutation of subsequent test cases.
9. An electronic device, comprising: A memory, a processor and a computer program, characterized in that: the computer program is stored in the memory and is configured to be executed by the processor to implement an industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement an industrial control protocol fuzzy testing method based on paradigm grammar and reinforcement learning as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Modbus TCP protocol fuzzy test method based on abnormal field positioning
CN110336827A
Industrial control protocol fuzzy test method based on flow replay
CN110505111A
Modbus TCP (Transmission Control Protocol) fuzzy test method based on QRNN (Quantitative Recurrent Neural Network)
CN116094972A
Abnormal flow detection method and system and computer storage medium
WO2021258348A1
Cited By
Method for testing messages with normal and abnormal formats based on PCIe Switch equipment
CN119906652A
Fuzzy test method, system and equipment for unknown protocol of industrial Internet of Things and medium
CN120528835A
