A Modbus protocol-based industrial control network abnormal traffic detection method

Through the industrial control network abnormal traffic detection method for the Modbus protocol, the abnormal traffic and attack behavior of the Modbus/TCP protocol are identified using packet characteristics and machine learning models, and the existing problem of low detection efficiency is solved and efficient and accurate Network security inspection ensures the stable operation of the power system.

CN117411703BActive Publication Date: 2024-11-12SHANGHAI UNIVERSITY OF ELECTRIC POWER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311448619.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-02
Publication Date
2024-11-12
Estimated Expiration
2043-11-02

AI Technical Summary

Technical Problem

The existing Modbus/TCP protocol has low efficiency in abnormal traffic detection and cannot accurately identify network attacks, resulting in serious security threats in the power system, affecting normal operation and economic losses.

Method used

The industrial control network anomaly traffic detection method is adopted for the Modbus protocol. By capturing data packets, extracting features, building rules and machine learning models, combining timing feature analysis, identifying abnormal traffic and attack behaviors, and improving detection accuracy and efficiency.

Benefits of technology

It realizes efficient detection of abnormal traffic of Modbus/TCP protocol, improves network security performance, ensures smooth operation of the power system, provides stronger network security guarantees, and reduces computing costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117411703B_ABST
    Figure CN117411703B_ABST
Patent Text Reader

Abstract

The present invention relates to an abnormal flow detection method for industrial control networks oriented to the Modbus protocol, comprising the following steps: S1, capturing data packets in the Modbus protocol application layer message; S2, extracting features and processing data on the captured data packet flow, and identifying abnormal flow and attack behavior based on the regular flow characteristics; S3, building a normal flow behavior model, using the regular flow characteristics in S2 to classify flow detection and optimize the model; S4, building an intrusion detection system according to the optimized machine learning model with a rule set, analyzing the time series characteristics of the flow, and then more comprehensively analyzing the network attack; S5, selecting a network data packet for analysis, inputting a model and predicting, and obtaining the final flow analysis result. Compared with the prior art, the present invention has high network attack identification efficiency and high abnormal flow detection accuracy, and has the advantages of comprehensive flow analysis, high efficiency and low cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software security testing, and in particular to a method for detecting abnormal traffic in an industrial control network oriented to a Modbus protocol. Background Art

[0002] With the continuous development of networking and intelligence, the demand for industrial Internet is also gradually increasing. In the power system, industrial control equipment and protocols are widely used, among which Modbus / TCP protocol is gradually occupying a dominant position. This protocol has the advantages of easy deployment, open standards, cross-platform, and strong compatibility, and is very suitable for the scenarios of industrial Internet of Things and Industry 4.0. In smart grids, this protocol is used to achieve communication and control between concentrators and terminal devices, thereby realizing the monitoring and management of power systems. Abnormal flow detection technology based on machine learning has become mainstream. By analyzing and modeling Modbus / TCP communication data, an effective anomaly detection model can be trained to achieve the identification and defense of abnormal flow.

[0003] In practical applications, hybrid feature detection technology has been widely used in various industrial control systems. For example, some domestic power, petrochemical and other enterprises have adopted this technology to ensure the security of their industrial control systems.

[0004] Patent application CN115277241A discloses a method, device and storage medium for abnormal traffic detection based on traffic layering, the method comprising: obtaining the network traffic of the industrial control network; inputting the network traffic into the traffic feature extraction module, the data packet feature extraction module and the content feature extraction module respectively, and obtaining the traffic feature, the data packet feature and the content feature respectively; inputting the traffic feature, the data packet feature and the content feature into the pre-trained traffic detection network to obtain the traffic detection result. Based on the features of different granularities, the coverage rate of the detection of network traffic is improved, and the abnormal traffic is accurately detected, but the abnormal traffic detection efficiency of the Modbus / TCP protocol is low.

[0005] Due to the defects of the Modbus / TCP protocol itself, the Modbus / TCP protocol has many security threats during use. These security threats may seriously disrupt the normal operation of the power system, causing huge economic losses and safety hazards. Therefore, how to effectively identify and prevent security threats to the Modbus / TCP protocol has become a very urgent and important issue, and the existing detection methods are inefficient and inaccurate in identifying network attacks. Summary of the invention

[0006] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide an abnormal traffic detection method for industrial control networks based on the Modbus protocol, so as to solve the problems of low efficiency in network attack identification and inaccurate abnormal traffic detection, while having the advantages of comprehensive traffic analysis, high efficiency and low cost.

[0007] The purpose of the present invention can be achieved by the following technical solutions:

[0008] The present invention provides a Modbus protocol-oriented industrial control network abnormal flow detection method, comprising the following steps:

[0009] S1, capture the data packets in the Modbus protocol application layer message;

[0010] S2. Extract features and process data from captured data packets, and identify abnormal traffic and attack behaviors based on rule-based traffic features; identify abnormal traffic and attack behaviors by defining a series of rules, which are extracted from normal and abnormal traffic, and formulate a series of rules for identifying abnormal traffic and attack behaviors based on existing security knowledge and data analysis results;

[0011] S3, build a normal traffic behavior model, use the rule-based traffic features in S2 to classify traffic detection and optimize the model;

[0012] S4. Build an intrusion detection system based on the optimized machine learning model with rule set, analyze the time series characteristics of traffic, including the frequency, duration, and transmission rate of traffic, combine the judgment results of the rule set and the machine learning model, comprehensively analyze the characteristics of traffic, and then analyze network attacks more comprehensively;

[0013] S5. Select the network data packets that need to be analyzed, extract the features, input them into the optimized machine learning model and make predictions to obtain the final traffic analysis results.

[0014] Furthermore, in step S1, the real-time traffic is recorded by Wireshark or a pcap file recording the traffic information is analyzed to obtain data packets in the Modbus protocol application layer message.

[0015] Furthermore, step S2 specifically includes the following steps:

[0016] S21. Analyze the communication logic of Modbus and find Modbus data packets with illegal fields and malicious instructions, such as data packets that do not conform to the standard format, abnormal data packet length, instruction errors, etc. At the same time, for Modbus / TCP network traffic, pre-mark the feature elements with high weights, and select the feature elements with high weights for selection;

[0017] S22. Use data processing methods such as standardization and principal component analysis to reduce feature dimensions and simplify unnecessary eigenvalues; standardize the selected feature elements to convert them into values ​​of the same scale, and use principal component analysis to reduce high-dimensional feature data to low-dimensional data, simplify unnecessary eigenvalues, and improve the distinctiveness and accuracy of the features.

[0018] S23. Based on the traffic characteristics of rules, network monitoring software or equipment is used to collect and process network traffic data in real time, convert it into a format that can be matched with rules, match and detect the collected traffic data with pre-defined rules, find the traffic that meets the rule conditions and mark it as abnormal or attack behavior.

[0019] Furthermore, step S21 specifically includes the following steps:

[0020] S211, discover Modbus data packets with illegal fields and malicious instructions through device IP flow and network characteristics;

[0021] S212. Extract characteristic elements that may be used for Modbus attacks, and select the relevant TCP flags, port information, and traffic timing characteristics in combination with common attack types.

[0022] Furthermore, step S22 specifically includes the following steps:

[0023] S221, using the preprocessing method of standardization and normalization and Min-Max Scaling, split the IP address into four integers as four new features to input into the model, and normalize the port number;

[0024] S222. Use principal component analysis to select principal components through grid search after data preprocessing and standardization, map the original data to a new space, and achieve data dimensionality reduction.

[0025] Furthermore, step S23 specifically includes the following steps:

[0026] S231. Record all data packets during the communication process to understand the communication flow between devices, the security risks and potential attack paths in the protocol, and formulate corresponding security rules:

[0027] S232: Collect and analyze network data packets, and make judgments on the network data packets based on the normal rule set and abnormal rule set generated according to the settings.

[0028] Furthermore, step S3 specifically includes the following steps:

[0029] S31. Construct a normal traffic behavior model: collect network traffic data, pre-process the data, including data cleaning and feature extraction, construct a training set of a normal traffic behavior model based on data features, and train the training set using a machine learning algorithm to obtain a normal traffic behavior model; constructing a normal traffic behavior model is used to statistically determine abnormal traffic that does not reach a threshold but poses a threat to the system;

[0030] S32, traffic classification and model optimization: Use the normal traffic behavior model obtained in S31 to classify the network traffic data, use the naive Bayes algorithm to evaluate the classification results, compare the differences between the predicted results and the actual categories, and optimize the model based on the evaluation results. You can adjust the feature selection and data preprocessing methods to improve the performance and generalization ability of the model.

[0031] Furthermore, step S31 specifically includes the following steps:

[0032] S311, obtaining target network traffic data, including real-time data and historical data;

[0033] S312, preprocessing the data, extracting valuable features, such as target IP address, port number, data packet size, etc., and constructing a training set for a normal traffic behavior model;

[0034] S313. Use one of the naive Bayes algorithm, the K-means clustering algorithm, the Rep Tree algorithm, and the LSTM algorithm to train the training set to obtain a normal traffic behavior model.

[0035] Further, step S32 specifically includes the following steps:

[0036] S321. Statistics are collected for packets that do not appear frequently during normal communication, such as TCP handshake packets and PING packets, and the proportional coefficient in the reference is lowered to 0.2 to calculate the normal threshold. A lower normal threshold can be obtained, making it easier to detect abnormal traffic. D = 0.2 × B, where D represents the normal threshold and B represents the normal bandwidth. The captured traffic data is processed and analyzed, and the number of packets per unit time is counted. If the number exceeds the normal threshold D, a denial of service attack may exist. In view of the characteristics of small data size and throughput limitation, technologies such as sliding windows are used to process and analyze traffic data to adapt to the situation of small data volume and throughput limitation.

[0037] S322. Use the accuracy in the crossover as the evaluation criterion, divide the data set into a training set and a test set, which are used to train and test the model respectively, and calculate the accuracy of the model as the evaluation criterion. Through the time series analysis chart, analyze and evaluate the detection results of the model, compare the consistency of the model's prediction results with the actual situation to evaluate the accuracy and performance of the model. According to the evaluation results, optimize the model. You can adjust the algorithm parameters, increase the training samples, and improve the feature engineering to improve the accuracy and generalization ability of the model to obtain better model performance.

[0038] Furthermore, the specific process of optimizing the model in step S4 is: obtaining the current traffic feature map, combining rule-based methods and machine learning algorithms and other technologies to identify and classify different types of network attacks, extracting features and preprocessing the input data packet files, inputting the model for prediction and rule judgment, and then analyzing it, and recording it in the database to obtain specific traffic information and timing analysis information.

[0039] Furthermore, in step S4, the specific process of the intrusion detection system detecting network attacks is as follows:

[0040] When the master-slave data packets flow through the system, the relevant attributes are extracted and sent to the model for one-to-one matching;

[0041] During the traffic detection process, the data packet must meet any rule in the abnormal data set. If it meets any rule, the behavior is judged to be abnormal or risky according to the situation, and then judged one by one whether it is abnormal according to the normal rule set;

[0042] If new rules emerge, new data can be added or rules can be deleted by updating the rules in the database to achieve the maintainability and extensibility of the rules. The reflection mechanism of the class can be mainly used to dynamically manage the properties and methods of the class in combination with the database.

[0043] Compared with the prior art, the present invention has the following advantages:

[0044] (1) The present invention provides an abnormal traffic detection method for industrial control networks oriented to the Modbus protocol, which analyzes and corrects the normal data packet traffic learned from the industrial control network, formulates a series of rules for identifying abnormal traffic and attack behaviors based on existing security knowledge and data analysis, and generates normal rules through the analysis of each field in the protocol packet (transmission identifier, protocol identifier, length, etc.), master / slave (request / response) data packet analysis, same function code data packet analysis, and overall data packet analysis, and performs statistics according to the change law within the cycle, performs judgment analysis on the traffic, performs secondary screening on the filtered traffic based on machine learning, and finally performs auxiliary viewing in the style of feature graphs. The method detects and analyzes network traffic, discovers and identifies any potential threats therefrom, improves the security performance of the industrial control network, and ensures its stable and reliable operation.

[0045] (2) The present invention uses a machine learning intrusion detection model to learn the characteristics and rules of attack behavior by training a large amount of normal and attack behavior data; at the same time, the naive Bayes algorithm is used to improve the accuracy of the intrusion detection model on the test set. With the continuous accumulation of training data, the recognition ability of the machine learning model will continue to improve, and it can effectively detect more new attacks.

[0046] (3) The hybrid attribute detection method of the present invention combines the advantages of the rule set model and the machine learning model, and can build an efficient and low-cost intrusion detection system. Based on the high recognition ability of the machine learning model, the rule set model generated by normal traffic is used to provide a stronger network security guarantee for the new power system, and early warning network security management detects abnormal problems in the network. The low computational advantage of the rule set model makes it very effective in processing simple rules and intrusion detection tasks under specific conditions. By using the rule set model generated by normal traffic, most normal network traffic can be quickly identified and filtered out, reducing the burden of the machine learning model and reducing the computational cost. The rule set model can quickly match and judge according to known rules and features, and can provide accurate detection and warning for some known intrusion behaviors and attack patterns. The machine learning model has a high recognition ability in intrusion detection, and can learn and discover hidden patterns and abnormal behaviors from a large amount of data. By training the machine learning model, an intelligent intrusion detection system can be built that can identify unknown intrusion behaviors and new attack patterns. The machine learning model can predict and classify by learning the statistical characteristics and patterns of the data, and has better adaptability and generalization ability for complex intrusion behaviors and diverse attack patterns. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 Flow chart of abnormal traffic detection method for industrial control network based on Modbus protocol

[0048] Figure 2 Schematic diagram of the client interface of the embodiment.

[0049] Figure 3 Schematic diagram of the abnormal data traffic log interface in the embodiment.

[0050] Figure 4 Schematic diagram of the data packet timing analysis interface in the embodiment. DETAILED DESCRIPTION

[0051] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. Component models, material names, connection structures, control methods, algorithms and other features not clearly described in this technical solution are all considered to be common technical features disclosed in the prior art.

[0052] Example 1

[0053] This embodiment provides a method for detecting abnormal traffic in an industrial control network oriented to the Modbus protocol. Figure 1 As shown, the following steps are included:

[0054] S1. Capture data packets in the Modbus protocol application layer message; specifically, record real-time traffic through Wireshark or analyze pcap files that record traffic information to obtain data packets in the Modbus protocol application layer message.

[0055] S2, extract features and process data from the captured data packet traffic, and identify abnormal traffic and attack behaviors based on regular traffic features;

[0056] In a specific implementation manner:

[0057] S21. Analyze the communication logic of Modbus and find Modbus data packets with illegal fields and malicious instructions, such as data packets that do not conform to the standard format, abnormal data packet length, instruction errors, etc. At the same time, for Modbus / TCP network traffic, pre-mark the feature elements with high weights, and select the feature elements with high weights for selection;

[0058] S22. Use data processing methods such as standardization and principal component analysis to reduce feature dimensions and simplify unnecessary eigenvalues; standardize the selected feature elements to convert them into values ​​of the same scale, and use principal component analysis to reduce high-dimensional feature data to low-dimensional data, simplify unnecessary eigenvalues, and improve the distinctiveness and accuracy of the features.

[0059] S23. Based on the traffic characteristics of rules, network monitoring software or equipment is used to collect and process network traffic data in real time and convert it into a format that can be matched by rules, such as extracting data packet characteristics and converting them into a format that can be recognized by the rule engine, such as Snort rules and YARA rules. The collected traffic data is matched and detected with pre-defined rules, and traffic that meets the rule conditions is found and marked as abnormal or attack behavior.

[0060] Wherein, step S21 specifically includes:

[0061] S211, discover Modbus data packets with illegal fields and malicious instructions through device IP flow and network characteristics;

[0062] S212. Extract characteristic elements that may be used for Modbus attacks, and select the relevant TCP flags, port information, and traffic timing characteristics in combination with common attack types.

[0063] Wherein, step S22 specifically includes:

[0064] S221, using the preprocessing method of standardization and normalization and Min-Max Scaling, split the IP address into four integers as four new features to input into the model, and normalize the port number;

[0065] S222. Use principal component analysis to select principal components through grid search after data preprocessing and standardization, map the original data to a new space, and achieve data dimensionality reduction.

[0066] Wherein, step S23 specifically includes:

[0067] S231. Record all data packets during the communication process to understand the communication flow between devices, the security risks and potential attack paths in the protocol, and formulate corresponding security rules:

[0068] S232: Collect and analyze network data packets, and make judgments on the network data packets based on the normal rule set and abnormal rule set generated according to the settings.

[0069] S3, build a normal traffic behavior model, use the rule-based traffic features in S2 to classify traffic detection and optimize the model;

[0070] In a specific embodiment:

[0071] S31. Construct a normal traffic behavior model: collect network traffic data, pre-process the data, including data cleaning and feature extraction, construct a training set of a normal traffic behavior model based on data features, and train the training set using a machine learning algorithm to obtain a normal traffic behavior model;

[0072] S32, traffic classification and model optimization: Use the normal traffic behavior model obtained in S31 to classify the network traffic data, use the naive Bayes algorithm to evaluate the classification results, compare the differences between the predicted results and the actual categories, and optimize the model based on the evaluation results. You can adjust the feature selection and data preprocessing methods to improve the performance and generalization ability of the model.

[0073] Wherein, step S31 specifically includes:

[0074] S311, obtaining target network traffic data, including real-time data and historical data;

[0075] S312, preprocessing the data, extracting valuable features, such as target IP address, port number, data packet size, etc., and constructing a training set for a normal traffic behavior model;

[0076] S313. Use one of the naive Bayes algorithm, the K-means clustering algorithm, the Rep Tree algorithm, and the LSTM algorithm to train the training set to obtain a normal traffic behavior model.

[0077] Wherein, step S32 specifically includes:

[0078] S321. Statistics are collected for packets that do not appear frequently during normal communication, such as TCP handshake packets and PING packets, and the proportional coefficient in the cited reference is lowered to 0.2. The normal threshold is calculated, D = 0.2 × B, where D represents the normal threshold and B represents the normal bandwidth. The captured traffic data is processed and analyzed, and the number of packets per unit time is counted. If the number exceeds the normal threshold D, a denial of service attack may exist. In view of the characteristics of small data size and throughput limitation, technologies such as sliding windows are used to process and analyze traffic data to adapt to the situation of small data volume and throughput limitation.

[0079] S322. Use the accuracy in the crossover as the evaluation criterion, divide the data set into a training set and a test set, which are used to train and test the model respectively, and calculate the accuracy of the model as the evaluation criterion. Through the time series analysis chart, analyze and evaluate the detection results of the model, compare the consistency of the model's prediction results with the actual situation to evaluate the accuracy and performance of the model. According to the evaluation results, optimize the model. You can adjust the algorithm parameters, increase the training samples, and improve the feature engineering to improve the accuracy and generalization ability of the model to obtain better model performance.

[0080] S4. Build an intrusion detection system based on the optimized machine learning model with rule set, analyze the time series characteristics of traffic, including the frequency, duration, and transmission rate of traffic, combine the judgment results of the rule set and the machine learning model, comprehensively analyze the characteristics of traffic, and then analyze network attacks more comprehensively;

[0081] The specific process of optimizing the model is as follows: obtaining the current traffic feature map, combining rule-based methods and machine learning algorithms to identify and classify different types of network attacks, extracting features and preprocessing the input data packet files, inputting the model for prediction and rule judgment, and then analyzing it, and recording it in the database to obtain specific traffic information and timing analysis information.

[0082] Among them, the specific process of the intrusion detection system detecting network attacks is:

[0083] When the master and slave data packets flow through the system, the relevant attributes are extracted and sent to the model for one-to-one matching. During the traffic detection process, the data packet must meet any rule in the abnormal data set. If it meets any rule, it is judged as abnormal behavior or risky behavior according to the situation, and then judged one by one whether it is abnormal behavior according to the normal rule set.

[0084] If new rules emerge, new data can be added or rules can be deleted by updating the rules in the database to achieve the maintainability and extensibility of the rules. The reflection mechanism of the class can be mainly used to dynamically manage the properties and methods of the class in combination with the database.

[0085] S5. Select the network data packets that need to be analyzed, extract the features, input them into the optimized machine learning model and make predictions to obtain the final traffic analysis results.

[0086] This embodiment applies the above technical solution, and its client is as follows Figure 2 As shown:

[0087] Model selection module: The model trained by the corresponding algorithm can be used by the subsequent traffic analysis module. The module mainly consists of the Naive Bayes algorithm, K-means clustering algorithm, Rep Tree algorithm, and LSTM algorithm. Different processing will be performed on different data sets, and the algorithms will also adjust the parameters of the data sets accordingly.

[0088] Data packet loading module: select to upload data packets, support pcap files, load data packets from the database, and facilitate users to use existing data for analysis.

[0089] Data display module: It presents the visualization of data in the form of charts, showing the amount of data used for training and analysis.

[0090] Data analysis module: It can perform various statistical analysis and mining for different algorithms and data sets, including but not limited to clustering, classification, etc. At the same time, it provides common feature engineering methods to extract features and preprocess the input data packet files, and input the model for prediction and rule judgment before analysis. In addition, this module can also extract risky records and record them in the database. During the analysis process, the program focuses on Modbus protocol and timing characteristics for further analysis by subsequent modules.

[0091] This embodiment uses Wireshark to record real-time traffic or analyze pcap files that record traffic information to obtain data packets in the Modbus protocol application layer message, and obtains a basic behavior model by modeling normal traffic, analyzing and classifying its statistical characteristics. Then, by real-time monitoring of network traffic, the traffic data is input into the basic behavior model to obtain the difference between the current network traffic and the basic behavior model, thereby detecting whether there is abnormal traffic. Finally, based on the generated normal rule set and abnormal rule set, the threat analysis system can judge and analyze the newly entered traffic; at the same time, by updating the rules of the database to add new data or delete rules, the maintainability and extensibility of the rules are realized, and the reflection mechanism of the class is used to dynamically manage the attributes and methods of the class in combination with the database. In the whole process, there are both the low computing advantages of the rule set model and the high recognition ability advantages of the machine learning model. Through reasonable combination, an efficient and low-cost intrusion detection system can be constructed. This embodiment can avoid the blindness of the abnormal traffic detection process, reduce the redundancy of traffic detection, improve the accuracy of abnormal traffic detection, and provide stronger network security protection for the new power system.

[0092] like Figure 3 As shown, in this embodiment, the specific steps of step S3 abnormal data flow log are:

[0093] A1. When a data packet flows through the system, relevant attributes are extracted and sent to the model for one-to-one matching.

[0094] A2. Record it in the database and record the time, IP pair, port pair and other information of the traffic in detail, while also paying special attention to the function code in the industrial control protocol.

[0095] A3. Analyze the possible risks of each field in more depth.

[0096] like Figure 4 As shown, in this embodiment, the specific steps of step S4 data packet timing analysis are:

[0097] B1. Use the data set for time series analysis and draw time series diagrams to observe changes in network traffic, especially for the identification and location of abnormal events.

[0098] B2. Draw attack feature graphs with high frequency and varying intensities for the attack traffic recorded in the data set to better understand the attack timing and intensity.

[0099] B3. According to the timing characteristics of the attack events, the subsequence length is adjusted to an appropriate size, and a reasonable zoom range is set to more clearly display the attack events and their timing characteristics.

[0100] B4. Conduct potential threat analysis and provide guidance for further strengthening of network security protection measures.

[0101] This technical solution essentially includes the following contents:

[0102] 1. Use Wireshark to obtain the data packets in the Modbus protocol application layer message;

[0103] Second, the rule set generated based on normal traffic, which relies on the normal rule set generated by normal traffic and the abnormal rule set generated according to the protocol rules and the attack type, to determine whether there is an attack behavior by matching the rule set;

[0104] The rule set can detect most common attacks, but as attack technology advances, the rule set also needs to be constantly updated to find more relevant rule items to match the corresponding traffic characteristics;

[0105] If new rules appear, new data can be added or rules can be deleted by updating the rules in the database to achieve the maintainability and extensibility of the rules. The reflection mechanism of the class is used to dynamically manage the properties and methods of the class in combination with the database, thereby achieving continuous iteration and optimization.

[0106] 3. Use the model to analyze and judge the input traffic, and use the naive Bayes algorithm to continuously optimize the model. The specific contents are:

[0107] Train the traffic according to the model trained by the corresponding algorithm to obtain data classification, use the naive Bayes algorithm to evaluate the model, and continuously optimize the model to improve its performance and generalization ability;

[0108] Through rule-based methods, a series of rules can be defined to identify known attack behaviors; while through machine learning algorithms, the characteristics and patterns of network traffic data can be automatically learned to facilitate the discovery of new attack behaviors.

[0109] 4. Build an intrusion detection system based on the optimized machine learning model with rule set, analyze the time series characteristics of traffic, and then analyze network attacks more comprehensively. The specific contents are:

[0110] Use multiple feature graphs to comprehensively analyze network traffic, discover and identify any potential threats, and improve network security performance;

[0111] At the same time, some response rules and predetermined ranges of slave stations are set in the attack detection module, and used in combination to better discover and identify any potential attack threats, improve the security performance of the industrial control network, and ensure its smooth and reliable operation.

[0112] This technical solution is applied in practice to capture data packets in the application layer message of the Modbus protocol; feature extraction and data processing of data packet traffic are performed, and abnormal traffic and attack behaviors are identified based on the generated normal and abnormal rule sets; the input traffic is analyzed and judged through the model, classified into specific categories, and the model is continuously optimized using the naive Bayes algorithm; an intrusion detection system is built based on the optimized machine learning model with rule sets, and the time series characteristics of the traffic are analyzed, and then the network attack is analyzed more comprehensively; network data packets are selected for analysis, input into the model and predicted to obtain the final traffic analysis results. It has both the low computational advantages of the rule set model and the high recognition ability advantages of the machine learning model; the two models complement each other, and through reasonable combination, an efficient and low-cost intrusion detection system can be constructed to provide stronger network security for the new power system. Early warning network security management detects abnormal problems in the network, and has the advantages of high execution efficiency and comprehensive network traffic analysis.

[0113] The above description of the embodiments is to facilitate the understanding and use of the invention by those skilled in the art. It is obvious that those skilled in the art can easily make various modifications to these embodiments and apply the general principles described herein to other embodiments without creative work. Therefore, the present invention is not limited to the above embodiments, and improvements and modifications made by those skilled in the art based on the disclosure of the present invention without departing from the scope of the present invention should be within the scope of protection of the present invention.

Claims

1. A method for detecting abnormal traffic in an industrial control network based on Modbus protocol, characterized in that: The following steps are involved: S1, capture the data packets in the Modbus protocol application layer message; S2, extract features and process data from the captured data packet traffic, and identify abnormal traffic and attack behaviors based on regular traffic features; S3, build a normal traffic behavior model, use the rule-based traffic features in S2 to classify traffic detection and optimize the model; S4. Build an intrusion detection system based on the optimized machine learning model with rule set to analyze the time series characteristics of traffic and thus analyze network attacks more comprehensively. S5. Select network data packets for analysis, input the model and make predictions to obtain the final traffic analysis results; Among them, S3 specifically includes the following steps: S31. Construct a normal traffic behavior model: collect network traffic data, pre-process the data, including data cleaning and feature extraction, construct a training set of a normal traffic behavior model based on data features, and train the training set using a machine learning algorithm to obtain a normal traffic behavior model; S32, traffic classification and model optimization: Use the normal traffic behavior model obtained in S31 to classify the network traffic data, use the naive Bayes algorithm to evaluate the classification results, compare the difference between the predicted results and the actual categories, and optimize the model according to the evaluation results; Wherein, S32 specifically includes the following steps: S321. Count packets that do not appear frequently during normal communication, such as TCP handshake packets and PING packets, and adjust the ratio coefficient down to 0.2 to calculate the normal threshold, D = 0.2 × B, where D represents the normal threshold and B represents the normal bandwidth. Process and analyze the captured traffic data to count the number of packets per unit time. If the number exceeds the normal threshold D, a denial of service attack exists. S322. Use the accuracy in the cross as the evaluation standard, analyze and evaluate the detection results of the model through the timing analysis chart, compare the consistency of the model's prediction results with the actual situation to evaluate the accuracy and performance of the model, and update the optimization algorithm and rule set to obtain better model performance.

2. The method for detecting abnormal traffic in an industrial control network based on Modbus protocol according to claim 1, characterized in that: In S1, real-time traffic is recorded by Wireshark or a pcap file recording traffic information is analyzed to obtain data packets in the Modbus protocol application layer message.

3. The method for detecting abnormal traffic in an industrial control network based on Modbus protocol according to claim 1, characterized in that: S2 specifically includes the following steps: S21, analyzing the communication logic of Modbus and discovering Modbus data packets with illegal fields and malicious instructions, and at the same time, marking the characteristic elements with high weights in advance for Modbus / TCP network traffic, and selecting the characteristic elements with high weights for selection; S22, using data processing methods such as standardization and principal component analysis to reduce feature dimensions and simplify unnecessary eigenvalues; S23. Based on the traffic characteristics of rules, network monitoring software or equipment is used to collect and process network traffic data in real time, convert it into a format that can be matched with rules, match and detect the collected traffic data with pre-defined rules, find the traffic that meets the rule conditions and mark it as abnormal or attack behavior.

4. The method for detecting abnormal traffic in an industrial control network based on Modbus protocol according to claim 3, characterized in that: S21 specifically includes the following steps: S211, discover Modbus data packets with illegal fields and malicious instructions through device IP flow and network characteristics; S212. Extract elements that may be used for Modbus attacks, and select the relevant TCP flags, port information, and traffic timing characteristics in combination with common attack types.

5. The method for detecting abnormal traffic in an industrial control network based on Modbus protocol according to claim 3, characterized in that: S22 specifically includes the following steps: S221, using the preprocessing method of standardization and normalization and Min-Max Scaling, split the IP address into four integers as four new features to input into the model, and normalize the port number; S222. Use principal component analysis to select principal components through grid search after data preprocessing and standardization, map the original data to a new space, and achieve data dimensionality reduction.

6. The method for detecting abnormal traffic in an industrial control network based on Modbus protocol according to claim 3, characterized in that: S23 specifically includes the following steps: S231. Record all data packets during the communication process to understand the communication flow between devices, the security risks and potential attack paths in the protocol, and formulate corresponding security rules: S232: Collect and analyze network data packets, and make judgments on the network data packets based on the normal rule set and abnormal rule set generated according to the settings.

7. The method for detecting abnormal traffic in an industrial control network based on Modbus protocol according to claim 1, characterized in that: S31 specifically includes the following steps: S311, obtaining target network traffic data, including real-time data and historical data; S312, preprocessing the data, extracting valuable features, such as target IP address, port number, data packet size, etc., and constructing a training set for a normal traffic behavior model; S313. Use one of the naive Bayes algorithm, the K-means clustering algorithm, the Rep Tree algorithm, and the LSTM algorithm to train the training set to obtain a normal traffic behavior model.

8. The method for detecting abnormal traffic in an industrial control network based on Modbus protocol according to claim 1, characterized in that: The specific process of optimizing the model in S4 is as follows: obtaining the current traffic feature graph, combining rule-based methods and machine learning algorithm technology to identify and classify different types of network attacks, extracting features and preprocessing the input data packet files, inputting the model for prediction and rule judgment, and then analyzing them, and recording them in the database to obtain specific information and timing analysis information of the traffic; In S4, the specific process of the intrusion detection system detecting network attacks is as follows: When the master-slave data packets flow through the system, the relevant attributes are extracted and sent to the model for one-to-one matching; During the traffic detection process, the data packet must meet any rule in the abnormal data set. If it meets any rule, the behavior is judged to be abnormal or risky according to the situation, and then judged one by one whether it is abnormal according to the normal rule set; If new rules emerge, new data can be added or rules can be deleted by updating the rules in the database to achieve the maintainability and extensibility of the rules. The reflection mechanism of the class can be mainly used to dynamically manage the properties and methods of the class in combination with the database.