1. Introduction
The rising cyberattacks on various critical infrastructure sectors indicate the concerning issues of the automated and digitized monitoring and decision-making systems. Concretely, internet-of-things (IoT) sensors, recently adopted by various aspects of the water sector, have allowed advanced monitoring and control of smart water systems, yet they have made cybersecurity an emerging concern. Cyberattacks on the U.S. power plants and water facilities in 2018 [
1], and the most recent cyberattack on the water treatment plant in Florida in 2021 (
https://www.nytimes.com/2021/02/08/us/oldsmar-florida-water-supply-hack.html accessed on 8 June 2022) are only two examples of such attacks. Cyberattacks in the water sector can be conducted in different forms, including hijacking private consumers or a water utility’s information for ransom requests, generating reversible or irreversible damages to pumps, valves, or tanks in water systems, cutting off, reducing or poisoning water supply to a region or an entire city, and even manipulating a dam to cause flooding [
2,
3].
Cyberattacks in water distribution systems (WDS) are mainly carried out in the form of false data injections (FDIs) on smart meters’ measurements. State estimation is one of the most commonly implemented detection methods of false data injection in water systems [
4,
5], which has also been vastly studied in power grids [
6,
7,
8]. However, if left undetected, false data injection attacks can lead to a false state estimation in the system, which ultimately will result in wrong operational decisions and system failures [
9]. In addition to state-estimation methods, there are other techniques in the literature to detect cyberattacks. In [
10], a model-based detection approach using mixed integer linear programming was proposed, where the the nodal demands were estimated to be used in EPANET (a hydraulic design software). Simulation results were compared to the given data to identify potential false data injections. In [
11], the information flow pattern sent out by sensors to actuators was modified, and the number of redundant cyber components were increased to enhance the protection of WDS against cyber–physical attacks. In [
12], a detection model incorporating a pressure-driven hydraulic simulation was proposed and verified against 15 failure set scenarios adopted from the model developed in [
13].
However, deep learning methods have been adopted in many areas to solve complicated problems, and given their promising performance in generating efficient and accurate solutions to these complex problems, their applications in detecting cyberattacks have gained attention in recent years [
14,
15,
16,
17].
In water systems, also, some studies used deep learning-based methods to detect cyberattacks. For example, Ref. [
18] proposed a data-driven detection algorithm to identify and localize cyberattacks based upon the hydraulic processes patterns of the water distribution system (WDS) using the data sets from the battle of the attack detection algorithms (BATADAL). However, the results suggest the high dependency of the detection performance on the threshold defined for the reconstruction errors. Additionally, the BATADAL data sets were used in [
19] to train a 3-layer anomaly detection algorithm to identify two types of anomalies in WDS, including local anomalies affecting individual sensors and global anomalies impacting more than one sensor at the same time. While the trained models in [
19] successfully detected the cyberattacks featured in the BATADAL historical data, the detection performance was sensitive to high measurement noise levels in the sensory data. In addition, the BATADAL attack scenarios and data were used in [
20] to develop learning-based algorithms, including k-nearest neighbor, support vector machine, artificial neural network, and extreme learning machine (ELM). Even though the improved ELM versions proposed in [
20] demonstrated much better results compared to other studied algorithms, the highest accuracy was reported only as 92.4% using an improved ELM including 10 hidden neurons. The BATADAL data sets were also used in [
21] to train and evaluate learning-based anomaly detection techniques, combining density-based and parametric algorithms. Nevertheless, the large size of the training data set (i.e., hourly readings for 365 days) used in [
18,
19,
20,
21] can slow down the deep neural network (DNN) training procedure, which can also become computationally costly. In [
22], multimodal data fusion and adaptive deep learning were used to develop a cyberattack detection model in WDS, where various weighted channels of information were considered, and deep learning approach was used to estimate the weight of each channel. However, the best accuracy and performance levels achieved using the proposed DNN-based detection model in [
22] were 87.62% and 85.41%, respectively, meaning that more than 10% of cyberattacks could potentially bypass the proposed model and damage the WDS. In [
23], multilayer perception (MLP) and support vector machine (SVM) were used to predict the measurement parameters and to identify and classify the outliers in WDS. In [
24] also, supervised and unsupervised detection models were developed to identify anomalies in water treatment plants. Nonetheless, these last two studies were focused on training the DNN model based on the water quality parameters, and hydraulic features of the system were not contemplated. As such, the proposed models in [
23,
24] cannot detect any cyberattacks targeting the hydraulic-related readings of a WDS, such as the tank’s level measurements.
Despite significant efforts by previous studies in the application of deep learning and artificial intelligence on detection of different forms of cyberattacks in water systems, there are considerable limitations yet to be addressed to improve the performance and efficacy of the DNN-based cyberattack detection models. Firstly, the number and size of the input data to train the deep neural networks is so large and their architecture is so deep that make implementing and training DNNs very costly and time consuming. Moreover, while the sensitivity of DNNs to noisy measurements has been acknowledged in the past, efforts are to be made to improve the detection performance in presence of various levels of noise in the measurements to reduce sensitivity and enhance the resilience of the proposed DNNs. Furthermore, effective methods should be implemented to accurately update the weights and prevent overfitting.
To address the aforementioned limitations, hyper-parameters are tuned and multiple overfitting control techniques are implemented in the present study to generate the highest detection performance, using the smallest depth DNNs possible. In particular, the paper aims at the following:
Developing and training supervised deep neural network algorithms that can detect false data injections targeting storage tanks’ water level in water distribution systems using the minimum number of input data;
Implementing regularization and momentum techniques to efficiently update the weights and prevent overfitting;
Evaluating the performance of the proposed neural-network-based detection methodology for shallow and deep neural networks;
Strengthening the performance of the proposed neural-network-based detection methodology by evaluating various activation functions such as sigmoid, rectified linear unit (ReLU), and softmax functions;
Enhancing the performance of the proposed deep neural-network-based detection methodology in the presence of various measurement noise levels.
The paper is organized as follows: deep learning-based detection framework is developed in
Section 1, numerical results are listed in
Section 2 and
Section 3 concludes the research.
2. Deep Neural Network-Based Detection Method Formulation
Deep learning is a subset of machine learning structured and designed based on the brain’s neurons and how they are getting trained to function in various applications. Deep neural networks are composed of input and output layers, with a number of hidden layers stacked in between [
25]. The architecture of a shallow neural network is made of one hidden layer (overall three layers), while deep neural networks include two or more hidden layers. The performance of DNNs are highly dependent on the number of hidden layers and hyper-parameters that are selected to transfer data from one layer to the next in a forward direction, while nodes (also known as neurons) in each layer are fully connected via connection weights.
The proposed learning-based detection algorithm is illustrated in
Figure 1 and in Algorithm 1. Herein, the input data, which are the hourly level of water in the tanks, will be sent to the proposed bad data detection (BDD) model of the water distribution system. The BDD is a deep neural network which is trained using the historical data of the tanks’ measurements. The historical data are split into
“training",
“cross-validation" (CV), and
“testing" data sets. The training and CV data sets are introduced to the proposed deep learning algorithm to train the hyper-parameters and update the weights, while the testing data set is used to evaluate the performance of the trained network. Provided the trained network is efficient and effective, it will be used to identify the FDI cyberattacks in the WDS. Because both the inputs and outputs (i.e., the labels in this study) are known in this study, the proposed deep learning algorithm is considered
supervised. Supervised deep learning has two steps; forward propagation and backward (or back) propagation to predict output
from an input vector,
. In this case, the input
includes the vector of tanks’ water levels which may or may not include false data injections. The output (i.e., label)
is a vector of binary values indicating bad data in the measurement by assigning 1 to the label of the data. Implementing a multiclass classification, the size of the output vector will be the same size as vector of the measurements, with 0 and 1 indicating the clean and bad data, respectively. To find the highest computational efficiency of the proposed deep learning algorithm, fully connected learning algorithms including various number of hidden layers are examined for this study.
Algorithm 1: Proposed deep learning detection framework. |
Input: Training set () Input: Validation set () Input: Initialize the learning rates, Compute: , , J
1 for with 0.01 step size 2 for with 0.01 step size 3 for with 0.01 step size 4 for 5 Calculate the 6 Update during training steps, 7 Calculate J on training 8 Calculate J on cross-validation 9 Validation Error 10 if 11 12 13 14 15 16 else 17 18 19 20 21 end if 22 end for 23 end for 24 end for 25 Output: Optimal values for 26 Output: Best number of training steps, 27 Output: Best learning rate values, , , |
2.1. Forward Propagation
The output of each neuron of the DNN is predicated in the forward propagation procedure. For instance, the output vector of the first set of nodes can be calculated as the following:
where
is the hypothesis,
is the bias vector associated with layer 1,
k is the number of neurons in each layer,
is the
jth tank level measurement vector on
m hours including clean and bad data,
W is a weight matrix. Calculations of each layer are done via the following set of equations [
26]
where
and
denotes the size of the input,
is the vector of input values,
is the matrix of the weights, with
corresponding to the inputs of the
ith layer, and
is the vector of biases with
corresponding to the
ith layer. The function
represents the activation function of each layer, chosen from one or a combination of the following linear and nonlinear correlations
where (
3)–(5) are known as
sigmoid,
ReLU, and
softmax functions, respectively. A sample calculation of an element-wise nonlinear application of (
3) in (
2) and (
1) for the
jth tank level measurement would be
where
f is the sigmoid activation function of the 1st layer. The output of the neural network for the
jth tank measurement,
, will include the predictions at the second layer such that
Thereafter, the error between the predicted and actual output will be used to update and optimize the weight matrices using the back propagation algorithm, explained in the following subsection. It is noted that while sigmoid and ReLU activation functions correspond to the input and hidden layers considering the weighted sum of inputs to each neuron, the softmax activation function is associated with the output layer. In (5), M represents the number of output nodes. Following (5), the softmax activation function will satisfy .
2.2. Back Propagation
The gradient (i.e., derivative) of the cost function is estimated via the back propagation procedure, which will update the weights of the neural network and enhance the training process [
27]. While the forward propagation is proceeded from left to right, taking in the inputs to calculate the output of each layer, the back propagation is directed from right to left, starting from the output nodes to minimize the errors between the estimated and actual output values.
2.3. Cost Function, Regularization, and Momentum
In training a DNN,
and
in (
2) are acquired via solving an optimization problem such that the difference between the estimated
and the actual output
of the
jth tank measurements, the latter is also known as the set of labels for each input
, is minimal. In this model, the
cross-entropy function of
j-th training set
is used to define the cost function (
) such that [
28]
In order to minimize the error between the estimated and the actual output values of the NN, the cost function should be minimized. However, this can be obtained at the risk of overfitting. To tackle this issue,
regularization is incorporated by adding the sum of weights,
, to the cost function. The cost function along with regularization is minimized for the training set, as well as the cross validation set via the
stochastic gradient descent (SGD) method. The SGD estimates the error for each layer and adjusts the weights accordingly. The term stochastic refers to the random selection of data to be processed for the gradient descent. Stochastic gradient decent allows for an efficient performance of the DNNs for large training sets, including the FDI cyberattacks on the measurements of a large-scale water distribution system.
where
Following SGD,
, where
is the
of the previous step, and
represents the learning rate. Here, the gradient ∇ is the derivative of the cost function over output prediction and hypothesis. Subsequently, the weights in each
k layer will be updated as
where the
th element of the
kth layer weight matrix will be updated based on the selected learning rate
and the regularization term
. The SGD calculates the errors for each training data and updates the weights immediately.
Moreover, to further enhance the training process, an advanced weight adjustment known as
momentum,
m, is implemented. Momentum is responsible to guide the direction of the weight adjustment by adding the momentum term to the weight update process. The algorithm is expressed as [
25]:
where
is the momentum for element
of the weight matrix of the
kth layer,
is a positive constant to adjust the momentum rate, and
is the momentum value in the previous step. The algorithm of the proposed optimized deep learning method is shown below.
2.4. Statistical Metrics
Performance of the NN algorithm in detecting cyberattacks of the water distribution system is commonly evaluated in terms of statistical measures, including the accuracy, precision, recall, and
F1-score, expressed as the following.
Accuracy in (15) calculates the correctly estimated output over the entire test data set, where
represents the true positive (TP),
denotes the true negative (TN),
is the false positive (FP), and
represents the false negative (FN) rate. Precision in (16) evaluates the cyberattacks that are accurately identified to all detected attacks. Recall in (17) estimates the number of accurately detected cyberattacks over all the attacks (those that are correctly identified and those that are falsely undetected).
F1-score in (18) is the harmonic mean of the precision and recall values. Furthermore, the receiver operating characteristic curve (ROC) is plotted to evaluate the performance of the classification framework for various scenarios in terms of the true positive rate (TPR) and false positive rate (FPR) such that
ROC integrates the area under curve (AUC) as , such that AUC of 1 denotes 100% correct predictions.
3. Case Studies
The proposed deep learning based detection algorithm (described in Algorithm 1) is evaluated using partial data sets (80 out of 365 days) of the C-Town designed for the BATADAL, a WDS cybersecurity competition held at the World Environmental and Water Resources Congress in 2017 [
29]. Herein, the data related to the level measurements of tanks 1, 2, 3, 4, and 7 are considered as the input data under three different attack scenarios of attack 1 on tank 7 only, attack 2 on tank 1 only, and attacks 1 and 2 on both tanks 1 and 7, simultaneously. This means that the SCADA readings associated to the tanks other than 1 and 7 are always considered clean data. The total number of measurements is 2119 for each tank, and hence the input samples and their associated labels
and
are
matrices. Out of these measurements, 2017 are clean and 102 contain false data injections, thus
is a
matrix and
is a
matrix, where
and
. Both clean and bad data sets are shuffled and then split by 80:10:10 for training, cross-validation, and testing, respectively [
30]. Initial randomization is used to estimate the initial
W values. The input data, i.e., hourly tank’s level, are normalized as
, where
and
are the mean and standard deviation values of the
jth tank level measurements, respectively.
3.1. Impact of Activation Functions and Number of Hidden Layers
Impacts of number of hidden layers, as well as implementing sigmoid, ReLU, and softmax activation functions on the training errors and statistic metrics of the proposed detection algorithms are investigated.
The training errors represent the root-mean-square errors in the training and cross-validation data sets.
Figure 2 demonstrates the training errors for a shallow neural network, including 1 hidden layer, which will result in an overall of 3 layers, using the sigmoid function.
Figure 3 shows the errors for a 4-layer DNN, where the left column shows results with sigmoid and softmax functions for the first and second hidden layers, respectively; the middle column shows results of using ReLU and softmax in the first and second hidden layers, respectively; and the right column shows results using ReLU function in both hidden layers.
Figure 4 demonstrates the errors for a 5-layer DNN, where the left column shows results using sigmoid for the first and the second hidden layers and softmax for the third hidden layer; the right column using ReLU in the first hidden layer, sigmoid in the second layer, and softmax in the third hidden layer. The DNN was not trainable when ReLU was used for more than one hidden layer. (Results are not shown).
As can be seen in these figures, increasing the hidden layers with sigmoid as the primary activation function significantly enhances the convergence of the errors to zero. Moreover, more layers resolve the overfitting issues observed in
Figure 2a,b.
However, in the 4-layer DNN associated with the attacks 1 and 2 scenario, overfitting occurs when ReLU is used in the first hidden layer. The worst overfitting occurs in the 5-layer DNN associated with attack 1 when ReLU is used in the first hidden layer. These results indicate that while adding more hidden layers to the DNN can prevent and resolve overfitting, the selection of the activation function is as critical and effective.
Figure 5,
Figure 6 and
Figure 7 present the AUC of the proposed model in the training, cross-validation, and testing data sets under the three attack scenarios for various hidden layers and activation functions.
Despite the overfitting observed in
Figure 2, the ROC of the 3-layer DNN verifies the efficiency of the DNN to detect cyberattacks in all three scenarios. This is justified because the average error in
Figure 2 is in the scale of
, thus overfitting does not significantly affect the performance of the DNN. The accuracy of the DNN in training, CV, and testing data sets are 1.0.
Figure 6 indicates the effectiveness of the 4-layer DNN-based detection model, where the bad data is accurately detected in all attack scenarios regardless of the selected activation function, except in attacks 1 and 2, when ReLU is used in both hidden layers. In this case, the proposed model detects all the bad data with 100% accuracy in the training data sets of both tanks 1 and 7, but it detects 92% and 95% of the bad data in the CV and testing data sets of the tank7’s measurements (LT7), respectively, and 97% of bad data in the CV data set associated with tank1’s measurements (LT1). These findings agree with the overfitting observed in
Figure 3 using ReLU in both layers under the attacks 1 and 2 scenario.
The results demonstrated in
Figure 7 suggest that for the attack 1 scenario, the 5-layer DNN offers an effective detection method only when sigmoid is used for the first two hidden layers. For the attack 2 scenario, the 5-layer DNN-based detection model is effective, regardless of whether sigmoid or ReLU is used in the first two hidden layers. For a simultaneous attack on both tanks (i.e., attacks 1 and 2), the detection model can identify bad data of all data sets on tank 7’s measurements, but can only detect 96% of the bad data in the CV data set related to tank 1’s measurements, using either activation functions in the first two hidden layers.
Numerical results tabulated in
Table 1 indicate that the proposed model can detect the bad data in tank 7’s measurements with 100% accuracy and precision, even using a shallow neural network containing 3 layers. However, the same performance can be achieved with the 4- and 5-layer DNNs with input data including 1000 samples fewer than that of the 3-layer model, except for a 5-layer DNN using ReLU in the first 2 hidden layers. This agrees with
Figure 4 and
Figure 7, where the training and validation errors do not converge to zero and AUC values are very weak in the Attack1-ReLU1, respectively. The accuracy and precision of the 5LR DNN remain as low as 20% and 30% even when the sample size is increased to the size used in 3L, respectively. (Data are not shown.) Similar results are obtained for the attack 2 scenario, presented in
Table 2, where the proposed model as shallow as the 3-layer neural network is able to identify all the FDI in tank 1’s measurements, but the number of input samples required to achieve the same performance is significantly smaller as the number of hidden layers of the DNN is increased. For the attack scenario where the readings of both tanks 1 and 7 are tampered with simultaneously, the results in
Table 3 indicate a lower precision and accuracy by a 3-layer neural network model compared to those for the attack 1 and attack 2 scenarios. Similar performance is achieved including an extra hidden layer but much smaller sample size, using sigmoid and softmax functions in the first and second hidden layers (refer to 4LS
Table 3). However, 4-layer DNNs with sigmoid and ReLU in the first and second hidden layers, or ReLU in all hidden layers demonstrate 100% accuracy and precision with sample inputs smaller than 4LS. The number of required input samples to accomplish 100% efficacy in detecting bad data in this attack scenario decreases even further as the number of layers is increased to 5, and the sigmoid function in the first hidden layer is replaced with ReLU (refer to 5LS and 5LR
Table 3).
3.2. Impact of Noise
In this case study, the performance of the proposed DNN to identify cyberattacks in the presence of the noise in the readings received by SCADA is investigated. The measurement noise results in stochastic characteristics of the tank’s readings, which potentially can worsen the prediction accuracy of the DNN. The noise function is characterized as a Gaussian distribution with zero mean and a specific standard deviation (
) [
31]. The level of the noise in the tank’s readings is expressed as signal-to-noise ratio (SNR), defined as the signal of the readings without noise to that with noise such that
. In this case study, the noisy measurements are generated as the following:
where
is the
ith reading of the
jth tank’s measurements including noise
,
is the noise magnitude randomly generated by the Gaussian distribution
in
, and
is the original
ith reading of the
jth tank’s measurements without noise
.
A sample input data set for the studied tanks including clean and bad data without and with 10% noise is plotted in
Figure 8.
In
Figure 9,
Figure 10 and
Figure 11, a variety of noise magnitudes are generated to evaluate the resilience and reliability of various DNN architectures in detecting cyberattacks. To that end, even though in practical applications measurement noise levels often do not occur beyond 30%, higher noise magnitudes are also considered to evaluate the proposed DNNs. Results associated with noise magnitudes less than 10% are not presented because they had no impact on the performance of the DNNs. DNNs contain only a sigmoid function in the 3-layer and sigmoid–softmax functions in the 4- and 5-layer DNNs, where softmax is used only in the last hidden layer.
For a SNN,
does not impact the performance of the detection model under either attack scenarios. However, when the noise level is increased to 15%, the AUC of prediction drops to 96% in both attack scenarios. Moreover, numerical results shown in
Table 4 and
Table 5 show that accuracy and recall are also deteriorated from 1.00 to 0.99 and 0.67 in attack 1 and 0.99 and 0.50 in attack 2, respectively. This is also true when the noise level is further increased to 30%.
However, when the number of hidden layers is increased, the DNNs become more resilient against higher levels of measurement noise. For instance, results in
Figure 10 and
Figure 11 indicate that noise levels up to 30% have no impact on performance of the 4- and 5-layer DNNs under attack 1, and the AUC of predictions become slightly impaired in the presence of 30% noise when under attack 2. Moreover, the results numerated in
Table 4 and
Table 5 indicate that noise levels up to 50% do not affect the precision, accuracy, and recall of these DNNs under any of the studied attack scenarios. As the noise level is increased to 50% or higher, the performance of the proposed DNNs can no longer be trusted. For instance, although
Figure 10 and
Figure 11 indicate great AUC in training and CV data sets and more than 90% AUC in prediction for the two studied attack scenarios, numerical results presented in
Table 4 and
Table 5 do not suggest the same. As such, for such high measurement noise levels, the operators are out to verify the performance of the DNN-based detection models with ROC graphs, as well as statistical measures.
A comparison between the results shown in
Table 3 and the best performance reported by previous studies, tabulated in
Table 6, who also used BATADAL data, confirm a much better detection performance by the 5LS and 5LR DNNs proposed in this work. Furthermore, the size of the training data for the 5-layer DNN proposed in the present work is collected from hourly readings over 21 days as opposed 365 days used in previous studies. Even for the shallowest DNN (i.e., 3-layer) developed in the present study, the readings associated with 80 days of the BATADAL database is used as input data. Finally, tuning the activation functions and the architecture of the proposed DNNs along with regularization and momentum techniques to efficiently update the weights have allowed us to develop an optimal and resilient detection model, which is nearly insensitive against noisy measurements or other parameters. However, the model proposed in [
18] was highly sensitive toward the error reconstruction threshold (i.e.,
), while [
19] was sensitive to high background noise of the sensors.