Attack and defense method and system based on GRU variational autoencoder

By using the GRU variational autoencoder in the field of industrial control to learn sensor constraint relationships and generate adversarial samples, combined with the feature weight defense of the VAE anomaly detection model, the challenges of adversarial sample attacks and defenses are solved, and the robustness and robustness of the model are improved. attack effect.

CN118427704BActive Publication Date: 2024-10-29SHANDONG COMP SCI CENTNAT SUPERCOMP CENT IN JINAN +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410854924.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-10-29
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

The existing technology is not effective in adversarial sample attacks in the field of industrial control. It cannot generate adversarial samples that comply with protocol specifications and actual physical meanings. Moreover, the defense model cannot effectively generalize and learn the data distribution, and it is difficult to detect adversarial samples that do not conform to the distribution. Abnormal samples.

Method used

The GRU-based variational autoencoder is used to learn the constraint relationships between sensors by training the GRU model, combine with the FGSM attack method to generate adversarial samples with better attack effects, and learn the potential distribution and characteristic patterns of the data through the VAE anomaly detection model. Calculate feature weights for defense.

Benefits of technology

The generated adversarial samples are more in line with the protocol specifications and actual physical meaning, improving the attack effect; the VAE-FW defense method improves the robustness of the model, protects the model from attacks with the weakest features, and the experimental data set performs better than other advanced method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118427704B_ABST
    Figure CN118427704B_ABST
Patent Text Reader

Abstract

The present invention relates to an attack and defense method and system for a variational autoencoder based on GRU, and belongs to the technical field of industrial control system attack and defense. The method includes: dividing a data set into a training set and a test set; performing data preprocessing on the training set and the test set; using a trained GRU model to learn the constraint relationship between each sensor sequence; adding different disturbances to the sensor in the test data, using the learned constraint relationship between each sensor sequence and combining the FGSM attack method to generate adversarial samples; using the processed data set to train the VAE anomaly detection model to obtain the reconstruction error of the training of the VAE anomaly detection model; combining the reconstruction error of the VAE anomaly detection model training with the weight matrix to obtain an optimized reconstruction error, and using the optimized reconstruction error to detect whether it is normal or abnormal. The present invention improves the robustness of the model, is free from attacks on the weakest features, and has strong interpretability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an attack and defense method and a system based on a GRU variational autoencoder, and belongs to the technical field of industrial control system attack and defense. Background Art

[0002] With the rapid development of Internet technology and industrial automation, the previously relatively closed and independent industrial control systems (ICS) are gradually becoming open and interconnected. On the one hand, this has improved the remote management capabilities of ICS and brought great convenience to operators, but on the other hand, it has also exposed itself to the threat of various network attacks. As the "brain" of the key infrastructure of industrial production, the security of industrial control systems is related to the security of society and the country.

[0003] Intrusion detection technology plays an important role in protecting industrial control systems from intrusion attacks. In recent years, the attack detection algorithms based on deep learning (DL) have achieved excellent results in dealing with various intrusion attacks, greatly ensuring the security of related systems, such as long short-term memory network (LSTM), generative adversarial network (GAN), auto encoder, etc. These methods have achieved good detection results through proper training.

[0004] However, deep learning anomaly detection models are vulnerable to adversarial sample attacks. Early adversarial sample attack results were mostly concentrated on feature-rich datasets, but now adversarial sample attacks have been applied to many fields, including computer vision, medical image analysis, and natural language processing. For example, in the field of computer vision, after an attacker adds adversarial noise (some disturbances that are imperceptible to the human eye) to a sample image of a pufferfish, although the human eye still observes a pufferfish, the machine has already identified and classified it as a crab. Widely used in various fields, many adversarial sample attack algorithms have been generated, such as the fast gradient sign method (FGSM), the basic iterative method (BIM), and the projected gradient descent (PGD). In the field of industrial control, adversarial sample attack methods cannot clearly understand which sensors are related to each other, do not consider the complex dependencies between different features, cannot understand the connection between each other, and the generated samples do not meet the protocol specifications and the actual physical meaning. Therefore, it is impossible to reasonably generate better adversarial samples, resulting in a decrease in attack effectiveness.

[0005] Many defense mechanisms have been designed for existing adversarial sample attacks. Autoencoder-based defense methods have made great progress. However, when these traditional autoencoders are used for adversarial sample defense, their latent space is often discontinuous and cannot be better generalized to new input data. Moreover, they cannot model the probability model in the latent space, cannot learn the normal data distribution, and are not easy to detect adversarial abnormal samples that do not conform to the distribution.

[0006] In the prior art, after the perturbation value is introduced, the constraint relationship between each sensor sequence is not taken into account, and the uncertainty about which sensor and actuator will produce the most effective adversarial sample still exists. Summary of the invention

[0007] In order to solve the challenges of adversarial sample attack and defense in the field of industrial control mentioned above, the present invention proposes an adversarial sample attack method based on VAE of gated recurrent unit, and trains the GRU model with the training set so that it can learn the constraint relationship between each sensor, solving the problem of inefficient generation of adversarial samples that meet the protocol specification. At the same time, a feature extraction defense method based on VAE is proposed, which learns the probability distribution of data and obtains richer features, solves the problem of designing a defense model without adversarial sample information, and protects the model from attacks on the weakest features.

[0008] The present invention also proposes an attack and defense system based on a GRU variational autoencoder.

[0009] Terminology explanation:

[0010] 1. GRU model: The key to GRU (Gated Recurrent Unit) is to implement subtle regulation in the process of sequential information transmission. It achieves this goal with the help of two specially designed gating devices - update gate and reset gate. The former gives GRU the autonomy to decide whether to retain or discard historical state information, while the latter determines the degree of influence of the current input on the formation of the new state. By dynamically adjusting the opening and closing amplitude of these two gates, GRU can autonomously learn how to properly handle the interactive relationship between state and input, so as to more efficiently capture and characterize the inherent regularity of sequence data.

[0011] 2. FGSM attack method: The Fast Gradient Sign Method (FGSM) is an algorithm for generating adversarial samples based on gradients. For a given input sample, it makes slight adjustments to the gradient direction of the input data along the loss function to maximize the impact of the adjustment on the output result.

[0012] 3. SWaT: SWaT includes six processes to simulate a real-world water treatment plant, each of which contains a different number of sensors and actuators. During the data collection process, 51 features were collected and a total of 36 attacks were launched.

[0013] 4. WADI: WADI is an extension of SWaT, which forms a complete and realistic water treatment, storage and distribution network. WADI is controlled by 3 PLCs, which run on 103 network sensors, including 16 attacks, and WADI collects data from 127 sensors every second.

[0014] 5. Z-score normalization: Z-score normalization is a commonly used data normalization method used to convert raw data into a standard normal distribution with the same mean and standard deviation. Specifically, for a given set of data, Z-Score normalization subtracts the mean of the set of data from each data point and then divides it by the standard deviation of the set of data. Its process will make the mean of the standardized data set 0 and the standard deviation 1, and the distribution of the converted data is approximately a standard normal distribution, that is, a normal distribution with a mean of 0 and a standard deviation of 1.

[0015] The technical solution of the present invention is:

[0016] Attack and defense methods based on GRU variational autoencoders for industrial control systems, including:

[0017] Divide the data set into training set and test set; perform data preprocessing on the training set and test set;

[0018] Use the trained GRU model to learn the constraint relationship between each sensor sequence;

[0019] Add different disturbances to the sensor in the test data, use the learned constraint relationship between each sensor sequence and combine the FGSM attack method to generate adversarial samples;

[0020] The processed data set is used to train the VAE anomaly detection model to obtain the reconstruction error of the training of the VAE anomaly detection model;

[0021] The reconstruction error trained by the VAE anomaly detection model is combined with the weight matrix to obtain the optimized reconstruction error, and the optimized reconstruction error is used to detect whether it is normal or abnormal.

[0022] Further preferably, the data set includes a SWaT data set and a WAD data set.

[0023] Further preferably, data preprocessing is performed on the training set and the test set; including:

[0024] Read the training data and test data in the training set and test set;

[0025] Remove the first and last columns;

[0026] Calculate the mean and standard deviation of the training data and test data; after Z-score standardization of the training data and test data, save the training data, training data labels, test data, and test data labels.

[0027] Further preferably, the trained GRU model is used to learn the constraint relationship between each sensor sequence; including:

[0028] The GRU model is trained to learn the constraint relationship between each sensor sequence. The GRU model includes an update gate and a reset gate.

[0029] The encoder takes sequence data from multiple sensors as input and uses a GRU model to extract patterns and features in the sequence data from multiple sensors; the memory unit of the GRU model stores information from previous time steps and learns the temporal dependencies between sensors.

[0030] Further preferably, the attacker adds different disturbances to the sensor in the test data, and uses the learned constraint relationship between each sensor sequence and combines the FGSM attack method to generate adversarial samples; including:

[0031] Represents the GRU model, for an input sample: , 𝑥 includes the readings of N sensors, 𝑥 i represents the reading of the i-th sensor; the goal is to generate adversarial samples: ;

[0032] For the original input data x i Perturbations are added to the features, and the gradient of the loss function relative to the input data is calculated to obtain noise, thus generating adversarial samples. The standard formula for generating adversarial samples is shown in formula (1):

[0033] (1);

[0034] in, represents the disturbance intensity coefficient, represents the magnitude of disturbance, represents the output of the GRU model for the i-th sensor, encoding the temporal correlation information between the i-th sensor and other sensors. Denotes the loss function J with respect to the i-th sensor reading x i gradient.

[0035] Further preferably, the processed data set is used to train the VAE anomaly detection model to obtain the reconstruction error of the training of the VAE anomaly detection model; including:

[0036] The VAE anomaly detection model includes an encoder and a decoder; both the encoder and the decoder are gated recurrent units;

[0037] During the training process, the VAE anomaly detection model is used to learn the potential distribution and characteristic patterns of normal data;

[0038] By analyzing the reconstruction error of the VAE anomaly detection model in different feature dimensions, the importance of each feature for the reconstruction of normal data is calculated, and the weight matrix is ​​calculated through the reconstruction error in different feature dimensions.

[0039] Further preferably, the VAE anomaly detection model is used to learn the potential distribution and characteristic patterns of normal data; including:

[0040] The encoder receives input data 𝑥 and outputs a latent variable z whose distribution parameters include mean μ and variance σ 2 , and then train by reparameterizing the sampled latent variable z. The decoder transforms the latent variable z back to the original data space to generate reconstructed data x'; The training goal of the VAE anomaly detection model is to maximize the similarity between the reconstructed data x' and the input data 𝑥, while minimizing the difference between the distribution of the latent variable z and the standard normal distribution N(0,I); During the training process, the VAE anomaly detection model continuously optimizes the parameters of the encoder and decoder through the back-propagation algorithm, so that the encoder learns the potential distribution parameters of the input data and captures the potential feature patterns of the data.

[0041] Further preferably, by analyzing the reconstruction error of the VAE anomaly detection model in different feature dimensions, the importance of each feature for the reconstruction of normal data is calculated, and the weight matrix is ​​calculated by the reconstruction error in different feature dimensions; including:

[0042] Using the trained VAE anomaly detection model, put the adversarial sample into the VAE anomaly detection model for data reconstruction, and calculate the reconstruction error of the feature median between the original data x and the reconstructed data x'; multiply the calculated reconstruction error with the corresponding weight matrix to calculate the optimal reconstruction error; the weight is equal to 1 divided by the reconstruction error of the median of each feature, plus a small constant , which means that features with smaller reconstruction errors will receive larger weights.

[0043] Further preferably, the weight matrix is ​​multiplied by the training error to obtain the final optimized test reconstruction error, and the weight matrix is ​​calculated to explain the differences in reconstruction errors between different features, as shown in formula (2):

[0044] (2);

[0045] in, is the weight matrix, for For example, The optimal value is 10 −3 to 10 −6 between, is the reconstruction error between the calculated original data 𝑥 and the reconstructed data x'.

[0046] Preferably, according to the present invention, anomaly detection is performed using feature-weighted anomaly scores, and the average value of the collected industrial control system data is calculated based on the reconstruction error as the anomaly score. If the anomaly score is greater than the anomaly threshold, it is determined to be abnormal, otherwise it is normal.

[0047] GRU-based variational autoencoder attack and defense system, including:

[0048] The data preprocessing module is configured to: divide the data set into a training set and a test set; perform data preprocessing on the training set and the test set;

[0049] The sensor sequence constraint relationship acquisition module is configured to: use the trained GRU model to learn the constraint relationship between each sensor sequence;

[0050] The adversarial sample generation module is configured to: add different disturbances to the sensors in the test data, and use the learned constraint relationship between the sensor sequences and the FGSM attack method to generate adversarial samples;

[0051] The reconstruction error acquisition module is configured to: train the VAE anomaly detection model using the processed data set to obtain the reconstruction error of the training of the VAE anomaly detection model;

[0052] The anomaly detection module is configured to: combine the reconstruction error trained by the VAE anomaly detection model with the weight matrix to obtain an optimized reconstruction error, and use the optimized reconstruction error to detect whether it is normal or abnormal.

[0053] The beneficial effects of the present invention are:

[0054] 1. The adversarial sample attack method used in the present invention generates samples by training a GRU model to learn the existing relationship between variables and adding disturbance values ​​to the sensor, thereby generating adversarial samples with better attack effects and conforming to protocol specifications and actual physical meanings.

[0055] 2. The present invention proposes a defense method VAE-FW for VAE feature weights in the absence of adversarial sample information. It learns the potential distribution and feature patterns of the data, and defends against adversarial sample attacks by calculating feature weights, ensuring that the anomaly scores are not dominated by the features with the worst prediction results, thereby improving the robustness of the model, protecting the model from attacks on the weakest features, and being highly interpretable.

[0056] 3. The industrial control system attack and defense method proposed in the present invention performs better than other existing advanced methods on the experimental data set, with improvements in F1 score, precision, recall rate and AUC value. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 Schematic diagram of the implementation architecture of the attack and defense method of the GRU-based variational autoencoder of the present invention;

[0058] Figure 2 It is a schematic diagram of the overall process of the attack and defense method of the GRU-based variational autoencoder of the present invention;

[0059] Figure 3 Schematic diagram of the comparison of Precision, Recall, and F1-score of the VAE-FW of the present invention and four anomaly detection baseline methods on the SWaT dataset;

[0060] Figure 4 Schematic diagram of the comparison of Precision, Recall, and F1-score of the VAE-FW of the present invention and four anomaly detection baseline methods on the WADI dataset;

[0061] Figure 5 Schematic diagram of the comparison of AUC of VAE-FW of the present invention and five anomaly detection baseline methods on the SWaT dataset;

[0062] Figure 6 Schematic diagram of the comparison of AUC of VAE-FW of the present invention and five anomaly detection baseline methods on the WADI dataset. DETAILED DESCRIPTION

[0063] The present invention will be further defined below in conjunction with the accompanying drawings and embodiments, but is not limited thereto.

[0064] Example 1

[0065] Attack and defense methods based on GRU variational autoencoders for industrial control systems, such as Figure 1 and Figure 2 As shown, including:

[0066] Divide the data set into training set and test set; use Z-score normalization to preprocess the training set and test set;

[0067] Use the trained GRU model to learn the constraint relationship between each sensor sequence;

[0068] The attacker adds different disturbances to the sensor in the test data, and uses the learned constraint relationship between each sensor sequence and the FGSM attack method to generate adversarial samples with better attack effects and in line with protocol specifications and actual physical meanings;

[0069] The processed data set is used to train the VAE anomaly detection model to obtain the reconstruction error of the training of the VAE anomaly detection model;

[0070] The reconstruction error trained by the VAE anomaly detection model is combined with the weight matrix to obtain the optimized reconstruction error, and the optimized reconstruction error is used to detect whether it is normal or abnormal.

[0071] Example 2

[0072] The attack and defense method based on the GRU variational autoencoder described in Example 1 is different in that:

[0073] In order to prove the effectiveness of the present invention, the data sets include SWaT and WAD, which are commonly used in the field of industrial control.

[0074] Perform data preprocessing on the training set and test set; including:

[0075] Read the training data and test data in the training set and test set;

[0076] Extract data features, remove the first column (which may be a timestamp or ID) and the last column (which may be a label);

[0077] Calculate the mean and standard deviation of the training data and test data; after Z-score standardization of the training data and test data, save the training data, training data labels, test data, and test data labels.

[0078] Use the trained GRU model to learn the constraint relationship between each sensor sequence; including:

[0079] In real ICS, it has a very complex structure, consisting of multiple continuous sensors and discrete actuators. The traditional FGSM attack method only considers the gradient information of a single input sample, but ignores the intrinsic correlation between input features. This invention proposes an improved FGSM method;

[0080] The GRU model is trained to learn the constraints between each sensor sequence. The GRU model includes an update gate and a reset gate. The GRU model has two specially designed gates: an update gate and a reset gate. The former gives the GRU the autonomy to decide whether to retain or discard historical state information, while the latter determines the degree of influence of the current input on the formation of the new state. The memory unit is like a memory storage. It can remember what has been learned before and update it according to new information.

[0081] The encoder takes sequence data from multiple sensors as input and uses a GRU model to extract patterns and features in the sequence data from multiple sensors; the memory unit of the GRU model stores information from previous time steps and learns the temporal dependencies between sensors.

[0082] Learning temporal dependencies between sensors; including:

[0083] Train a VAE anomaly detection model based on the GRU model through the training set;

[0084] Call the trained VAE anomaly detection model, send the adversarial sample after the perturbation to the trained VAE anomaly detection model, and predict the new adversarial sample;

[0085] The GRU model controls the flow of information in the GRU unit through the update gate and the reset gate. The update gate controls the degree of fusion of the current input information and the previous state information, and the reset gate controls the degree of retention of the previous state information. Through these two gating mechanisms, the GRU model can learn which sensor information is relevant and which is irrelevant, thereby extracting important sensor relationships.

[0086] The attacker adds different disturbances to the sensor in the test data, and uses the learned constraint relationship between each sensor sequence and the FGSM attack method to generate adversarial samples; including:

[0087] Represents the GRU model, for an input sample: , 𝑥 includes the readings of N sensors, 𝑥 i represents the reading of the i-th sensor; the goal is to generate adversarial samples: ; to deceive the monitoring system or control decision module. Among them, the hidden layer of the variational autoencoder is set to 5, the number of training rounds is 20, the number of samples in each training batch is 20, and the length of the input sequence is set to 30.

[0088] For the original input data x iPerturbations are added to the features, and the gradient of the loss function relative to the input data is calculated to obtain noise, thus generating adversarial samples. The standard formula for generating adversarial samples is shown in formula (1):

[0089] (1)

[0090] in, represents the disturbance intensity coefficient, represents the magnitude of disturbance, represents the output of the GRU model for the i-th sensor, encoding the temporal correlation information between the i-th sensor and other sensors. Denotes the loss function J with respect to the i-th sensor reading x i gradient.

[0091] The key to the attack method of the present invention is to use the relationship between various sensors while adding noise along the gradient direction. The present invention not only considers the gradient information of each sensor reading, but also incorporates the temporal association knowledge extracted by the GRU model, and uses a fast and effective method to generate adversarial samples.

[0092] The processed data set is used to train the VAE anomaly detection model to obtain the reconstruction error of the training of the VAE anomaly detection model; including:

[0093] The VAE anomaly detection model includes an encoder and a decoder; both the encoder and the decoder are gated recurrent units;

[0094] The present invention proposes a VAE feature weight defense method VAE-FW in the absence of adversarial sample information.

[0095] During the training process, the VAE anomaly detection model is used to learn the potential distribution and characteristic patterns of normal data; including:

[0096] The encoder receives input data 𝑥 and outputs a latent variable z with distribution parameters including mean μ and variance σ 2 , and then train by reparameterizing the sampled latent variable z. The decoder transforms the latent variable z back to the original data space to generate the reconstructed data x'; The training goal of the VAE anomaly detection model is to maximize the similarity between the reconstructed data x' and the input data 𝑥, while minimizing the distribution of the latent variable z and the standard normal distribution N(0, I ) during the training process, the VAE anomaly detection model continuously optimizes the parameters of the encoder and decoder through the back propagation algorithm, so that the encoder learns the potential distribution parameters of the input data and captures the potential characteristic patterns of the data.

[0097] By analyzing the reconstruction errors of the VAE anomaly detection model in different feature dimensions, the importance of each feature for normal data reconstruction is calculated, and the weight matrix is ​​calculated through the reconstruction errors in different feature dimensions. Including:

[0098] Using the trained VAE anomaly detection model, put the adversarial sample into the VAE anomaly detection model for data reconstruction, and calculate the reconstruction error of the feature median between the original data x and the reconstructed data x'; multiply the calculated reconstruction error with the corresponding weight matrix to calculate the optimal reconstruction error; the weight is equal to 1 divided by the reconstruction error of the median of each feature, plus a small constant , which means that features with smaller reconstruction errors will receive larger weights.

[0099] The weight matrix is ​​multiplied by the training error to obtain the final optimized test reconstruction error, which ensures that the anomaly score is not dominated by the feature with the worst prediction result. The weight matrix is ​​calculated to explain the differences in reconstruction errors between different features, as shown in formula (2):

[0100] (2);

[0101] in, is the weight matrix, for For example, The optimal value is 10 −3 to 10 −6 between, is the reconstruction error between the calculated original data 𝑥 and the reconstructed data x'.

[0102] The present invention uses the potential representation that can be learned by the VAE anomaly detection model to better capture the distribution characteristics and structural information of the data, and can generate new samples similar to the original data. The input data is mapped to the latent space through the encoder, and the samples are generated from the latent space through the decoder. In addition, the VAE anomaly detection model introduces latent variables to represent the implicit information of the data, and these variables can be used to represent the uncertainty and diversity of the data. The present invention replaces the encoder and decoder of the VAE anomaly detection model with a gated recurrent unit, which has fewer parameters and faster training speed, can make the model more lightweight, have better generalization ability, can better process sequence data, and can learn patterns and features in the data more quickly.

[0103] Anomaly detection is performed using the feature-weighted anomaly score. The average value of the collected industrial control system data is calculated based on the reconstruction error as the anomaly score. If the anomaly score is greater than the anomaly threshold, it is judged as an anomaly, otherwise it is normal.

[0104] The key to the defense method of the present invention is to use the VAE model to learn the potential distribution and feature patterns of the data, and to defend against adversarial sample attacks by calculating feature weights. The method of the present invention not only does not require adversarial sample information, but also protects the model from attacks targeting the weakest features.

[0105] This embodiment uses the safe water treatment (SWaT) dataset and the water distribution (WADI) dataset provided by the Cyber ​​Security Research Center of the National University of Singapore (NUS) to evaluate the adversarial sample attack and defense method of the present invention.

[0106] The present invention uses Accuracy, F1, Precision, Recall and AUC values ​​as performance evaluation indicators for adversarial samples and normal samples. The AUC value is used on the test data set and its ground truth to evaluate the performance of the defense method of the present invention and the baseline model.

[0107] Accuracy=(TP+TN) / (TP+TN+FP+FN);

[0108] Recall = TP / (TP+FN);

[0109] Precision = TP / (TP+FP);

[0110] F1=2×Precision×Recall / (Precision+Recall);

[0111] True Positives (TP): The number of samples correctly predicted as having vulnerabilities. True Negatives (TN): The number of samples correctly predicted as not having vulnerabilities. False Positives (FP): The number of samples incorrectly classified as having vulnerabilities. False Negatives (FN): The number of samples incorrectly classified as not having vulnerabilities.

[0112] The AUC value shows the trade-off between the model's TPR and FPR as the classification threshold changes. The AUC-ROC score is defined as the area under the ROC curve, TPR is the true positive rate, and FPR is the false positive rate.

[0113] The present invention compares the accuracy, precision, recall, and f1 score of the SWaT and WADI datasets in the normal and attack states. The most successful attack results in each dataset are highlighted in bold compared to the normal state. At the same time, in the attack state, we compare the adversarial samples generated by only setting the perturbation value of the sensor to 0.1 without using GRU to learn the constraint relationship between each sensor and the case of using GRU for attack.

[0114] At the same time, the present invention is also compared with an existing attack method, an adversarial sample attack method based on LSTM-ED. As shown in Table 1, the adversarial sample attack method of the present invention has the best attack effect after adding disturbances after using GRU to learn the relationship between sensors under the variational autoencoder. The Accuracy of SWaT and WADI is reduced by 39.14% and 14.82% respectively, the Precision is reduced by 82.84% and 75.29% respectively, and the F1 score is reduced by 48.97% and 6.27% respectively. The experimental results show that the proposed GRU learning sensor relationship is very useful, which can better utilize the intrinsic correlation between sensors, making the disturbance more targeted and efficient. The present invention can generate more robust adversarial samples, thereby bringing greater challenges to anomalies and improving the adversarial robustness of the system.

[0115] Table 1 Accuracy, precision, recall, and f1 score of SWaT and WADI datasets under normal and attack conditions;

[0116]

[0117] In order to verify the effectiveness of the VAE-FW defense method proposed in this paper, the performance of VAE-FW is compared with the five most popular anomaly detection methods. Figure 3 Schematic diagram of the comparison of Precision, Recall, and F1-score of the VAE-FW of the present invention and four anomaly detection baseline methods on the SWaT dataset; Figure 4 The figure is a comparison diagram of Precision, Recall, and F1-score of the VAE-FW of the present invention and four anomaly detection baseline methods on the WADI dataset. In the SWaT and WADI datasets, the Precision is improved by an average of 36.04% and 41.13% respectively, the Recall is improved by an average of 40.67% and 59.74%, and the F1 score is improved by an average of 40.24% and 60.44%. Figure 5 Schematic diagram of the comparison of AUC of VAE-FW of the present invention and five anomaly detection baseline methods on the SWaT dataset; Figure 6The figure is a comparison diagram of the AUC of the VAE-FW of the present invention and five anomaly detection baseline methods on the WADI dataset. VAE-FW achieved higher AUC in both datasets, outperforming other baselines by an average of 24.8% in SWaT and 34% in WADI. The experimental results show that the performance of the VAE-FW detection model of the present invention is better in the WADI dataset because WADI has more features than SWaT, and VAE-FW can extract richer feature information. In addition, when the detection model does not require adversarial sample information, it can verify the effectiveness of the VAE-FW model, and also proves that the detection model of the present invention has better performance and higher robustness under the influence of adversarial sample attacks.

[0118] Example 3

[0119] GRU-based variational autoencoder attack and defense system, including:

[0120] The data preprocessing module is configured to: divide the data set into a training set and a test set; use Z-score normalization to perform data preprocessing on the training set and the test set;

[0121] The sensor sequence constraint relationship acquisition module is configured to: use the trained GRU model to learn the constraint relationship between each sensor sequence;

[0122] The adversarial sample generation module is configured as follows: the attacker adds different disturbances to the sensor in the test data, and uses the learned constraint relationship between each sensor sequence and the FGSM attack method to generate adversarial samples with better attack effects and in line with protocol specifications and actual physical meanings;

[0123] The reconstruction error acquisition module is configured to: train the VAE anomaly detection model using the processed data set to obtain the reconstruction error of the training of the VAE anomaly detection model;

[0124] The anomaly detection module is configured to: combine the reconstruction error trained by the VAE anomaly detection model with the weight matrix to obtain an optimized reconstruction error, and use the optimized reconstruction error to detect whether it is normal or abnormal.

Claims

1. The attack and defense method based on GRU variational autoencoder is characterized by: For industrial control systems, including: Divide the data set into training set and test set; perform data preprocessing on the training set and test set; Use the trained GRU model to learn the constraint relationship between each sensor sequence; including: The GRU model is trained to learn the constraint relationship between each sensor sequence. The GRU model includes an update gate and a reset gate. The encoder takes sequence data from multiple sensors as input and uses the GRU model to extract patterns and features in the sequence data from multiple sensors; the memory unit of the GRU model stores information from previous time steps and learns the temporal dependencies between sensors; Add different disturbances to the sensor in the test data, use the learned constraint relationship between each sensor sequence and combine the FGSM attack method to generate adversarial samples; including: φ represents the GRU model. For an input sample: x = (x1, x2, .., x i .., x N ), x includes the readings of N sensors, x i represents the reading of the i-th sensor; the goal is to generate adversarial samples: x′=(x′1, x′2, .., x′ i , .., x′ N ); For the original input data x i Perturbations are added to the features, and the gradient of the loss function relative to the input data is calculated to obtain noise, thus generating adversarial samples. The standard formula for generating adversarial samples is shown in formula (1): Among them, ∈ represents the disturbance intensity coefficient, α represents the magnitude of the disturbance, φ(x i ) represents the output of the GRU model for the i-th sensor, encoding the temporal correlation information between the i-th sensor and other sensors. Denotes the loss function J with respect to the i-th sensor reading x i The gradient of The processed data set is used to train the VAE anomaly detection model to obtain the reconstruction error of the training of the VAE anomaly detection model; including: The VAE anomaly detection model includes an encoder and a decoder; both the encoder and the decoder are gated recurrent units; During the training process, the VAE anomaly detection model is used to learn the potential distribution and characteristic patterns of normal data; By analyzing the reconstruction error of the VAE anomaly detection model in different feature dimensions, the importance of each feature for the reconstruction of normal data is calculated, and the weight matrix is ​​calculated through the reconstruction error in different feature dimensions; The reconstruction error trained by the VAE anomaly detection model is combined with the weight matrix to obtain the optimized reconstruction error, and the optimized reconstruction error is used to detect whether it is normal or abnormal; Use the VAE anomaly detection model to learn the underlying distribution and characteristic patterns of normal data; including: The encoder receives input data x and outputs a latent variable z whose distribution parameters include mean μ and variance σ 2 , and then train by reparameterizing the sampled latent variable z. The decoder transforms the latent variable z back to the original data space to generate reconstructed data x″; the training goal of the VAE anomaly detection model is to maximize the similarity between the reconstructed data x″ and the input data x, while minimizing the difference between the distribution of the latent variable z and the standard normal distribution N(0, I); during the training process, the VAE anomaly detection model continuously optimizes the parameters of the encoder and decoder through the back-propagation algorithm, so that the encoder learns the potential distribution parameters of the input data and captures the potential feature patterns of the data; By analyzing the reconstruction error of the VAE anomaly detection model in different feature dimensions, the importance of each feature for normal data reconstruction is calculated, and the weight matrix is ​​calculated through the reconstruction error in different feature dimensions; including: Using the trained VAE anomaly detection model, the adversarial sample is put into the VAE anomaly detection model for data reconstruction, and the reconstruction error of the feature median between the original data x and the reconstructed data x″ is calculated; the calculated reconstruction error is multiplied by the corresponding weight matrix to calculate the optimal reconstruction error; the weight is equal to 1 divided by the reconstruction error of the median of each feature, plus a small constant ε.

2. The attack and defense method of the GRU-based variational autoencoder according to claim 1, characterized in that: Perform data preprocessing on training and test sets; include: Read the training data and test data in the training set and test set; Remove the first and last columns; Calculate the mean and standard deviation of the training data and test data; after Z-score standardization of the training data and test data, save the training data, training data labels, test data, and test data labels.

3. The attack and defense method of the GRU-based variational autoencoder according to claim 1, characterized in that: The weight matrix is ​​multiplied by the training error to obtain the final optimized test reconstruction error. The weight matrix is ​​calculated to explain the differences in reconstruction errors between different features, as shown in formula (2): Among them, W is the weight matrix. For ε, the value of W is between 10 -3 to 10 -6 Where |xx″| is the reconstruction error between the calculated original data x and the reconstructed data x″.

4. The attack and defense method of the GRU-based variational autoencoder according to any one of claims 1 to 3, characterized in that: Anomaly detection is performed using the feature-weighted anomaly score. The average value of the collected industrial control system data is calculated based on the reconstruction error as the anomaly score. If the anomaly score is greater than the anomaly threshold, it is judged as an anomaly, otherwise it is normal.

5. GRU-based variational autoencoder attack and defense system, characterized in that: include: The data preprocessing module is configured to: divide the data set into a training set and a test set; Perform data preprocessing on training and test sets; The sensor sequence constraint relationship acquisition module is configured to: use the trained GRU model to learn the constraint relationship between each sensor sequence; The adversarial sample generation module is configured to: add different disturbances to the sensors in the test data, and use the learned constraint relationship between the sensor sequences and the FGSM attack method to generate adversarial samples; The reconstruction error acquisition module is configured to: train the VAE anomaly detection model using the processed data set to obtain the reconstruction error of the training of the VAE anomaly detection model; The anomaly detection module is configured to: combine the reconstruction error trained by the VAE anomaly detection model with the weight matrix to obtain an optimized reconstruction error, and use the optimized reconstruction error to detect whether it is normal or abnormal; Use the trained GRU model to learn the constraint relationship between each sensor sequence; including: The GRU model is trained to learn the constraint relationship between each sensor sequence. The GRU model includes an update gate and a reset gate. The encoder takes sequence data from multiple sensors as input and uses the GRU model to extract patterns and features in the sequence data from multiple sensors; the memory unit of the GRU model stores information from previous time steps and learns the temporal dependencies between sensors; The attacker adds different disturbances to the sensor in the test data, and uses the learned constraint relationship between each sensor sequence and the FGSM attack method to generate adversarial samples; including: φ represents the GRU model. For an input sample: x = (x1, x2, .., x i .., x N ), x includes the readings of N sensors, x i represents the reading of the i-th sensor; the goal is to generate adversarial samples: x′=(x′1, x′2, .., x′ i , .., x′ N ); For the original input data x i Perturbations are added to the features, and the gradient of the loss function relative to the input data is calculated to obtain noise, thus generating adversarial samples. The standard formula for generating adversarial samples is shown in formula (1): Among them, ∈ represents the disturbance intensity coefficient, α represents the magnitude of the disturbance, φ(x i ) represents the output of the GRU model for the i-th sensor, encoding the temporal correlation information between the i-th sensor and other sensors. Denotes the loss function J with respect to the i-th sensor reading x i The gradient of The processed data set is used to train the VAE anomaly detection model to obtain the reconstruction error of the training of the VAE anomaly detection model; including: The VAE anomaly detection model includes an encoder and a decoder; both the encoder and the decoder are gated recurrent units; During the training process, the VAE anomaly detection model is used to learn the potential distribution and characteristic patterns of normal data; By analyzing the reconstruction error of the VAE anomaly detection model in different feature dimensions, the importance of each feature for the reconstruction of normal data is calculated, and the weight matrix is ​​calculated through the reconstruction error in different feature dimensions; Use the VAE anomaly detection model to learn the underlying distribution and characteristic patterns of normal data; including: The encoder receives input data x and outputs a latent variable z whose distribution parameters include mean μ and variance σ 2 , and then train by reparameterizing the sampled latent variable z. The decoder transforms the latent variable z back to the original data space to generate reconstructed data x″; the training goal of the VAE anomaly detection model is to maximize the similarity between the reconstructed data x″ and the input data x, while minimizing the difference between the distribution of the latent variable z and the standard normal distribution N(0, I); during the training process, the VAE anomaly detection model continuously optimizes the parameters of the encoder and decoder through the back-propagation algorithm, so that the encoder learns the potential distribution parameters of the input data and captures the potential feature patterns of the data; By analyzing the reconstruction error of the VAE anomaly detection model in different feature dimensions, the importance of each feature for normal data reconstruction is calculated, and the weight matrix is ​​calculated through the reconstruction error in different feature dimensions; including: Using the trained VAE anomaly detection model, the adversarial sample is put into the VAE anomaly detection model for data reconstruction, and the reconstruction error of the feature median between the original data x and the reconstructed data x″ is calculated; the calculated reconstruction error is multiplied by the corresponding weight matrix to calculate the optimal reconstruction error; the weight is equal to 1 divided by the reconstruction error of the median of each feature, plus a small constant ε.

Citation Information

Patent Citations

  • Robust space-time trajectory modeling method based on automatic gating circulation unit

    CN116047901A

  • ARMA (autoregressive moving average) model-based defense method and system for resisting sample black box attack

    CN117669651A

  • Industrial control system attack detection method based on lightweight neural network and storage medium

    CN118074948A

  • Method for automatically executing a vehicle function, method for training a machine learning defense model and defense unit for a vehicle

    EP4120136A1

  • Assistive-GAN based defence on black-box and white-box attacks

    IN202421021076A