# Software Defined Network Enabled Fog-to-Things Hybrid Deep Learning Driven Cyber Threat Detection System

Authors: Ihtisham Ullah; Basit Raza; Sikandar Ali; Irshad Ahmed Abbasi; Samad Baseer; Azeem Irshad
Journal: Security and Communication Networks
 (2021)

---

## Abstract

Software Defined Network (SDN) is a next-generation networking architecture and its power lies in centralized control intelligence. The control plane of SDN can be extended to many underlying networks such as fog to Internet of Things (IoT). The fog-to-IoT is currently a promising architecture to manage a real-time large amount of data. However, most of the fog-to-IoT devices are resource-constrained and devices are widespread that can be potentially targeted with cyber-attacks. The evolving cyber-attacks are still an arresting challenge in the fog-to-IoT environment such as Denial of Service (DoS), Distributed Denial of Service (DDoS), Infiltration, malware, and botnets attacks. They can target varied fog-to-IoT agents and the whole network of organizations. The authors propose a deep learning (DL) driven SDN-enabled architecture for sophisticated cyber-attacks detection in fog-to-IoT environment to identify new attacks targeting IoT devices as well as other threats. The extensive simulations have been carried out using various DL algorithms and current state-of-the-art Coburg Intrusion Detection Data Set (CIDDS-001) flow-based dataset. For better analysis five DL models are compared including constructed hybrid DL models to distinguish the DL model with the best performance. The results show that proposed Long Short-Term Memory (LSTM) hybrid model outperforms other DL models in terms of detection accuracy and response time. To show unbiased results 10-fold cross-validation is performed. The proposed framework is so effective that it can detect several types of cyber-attacks with 99.92% accuracy rate in multiclass classification.


---

## Body

## 1. Introduction

THE traditional Internet architectures were very complex and almost failed in dynamic environment due to their decentralized nature. They are composed of too many devices, routers, and distributed nodes which was their main drawback. The advent of SDN with centralized control solved many problems. SDN can be enhanced to fog computing and it is programmable. It is used as a framework for flow-based anomaly detection but still, it needs intelligence to avoid attacks presented by Tan et al. [1]. The attack packet is classified by the use of Machine Learning (ML) in SDN environment by Santos et al. [2]. The authors proposed ML algorithms to detect DDoS attacks in three different categories. An entropy-based solution to detect DDoS attacks using an SDN plane is proposed by Galeano et al. [3]. The increase in the number of IoT devices produces large amount of data. Khan and Salah [4] predicted that more than 26 billion IoT devices will be connected to the Internet by the end of 2020. There will be an increase in the commercial value of IoT devices and securing the network in the future will be mandatory as billions of devices will be connected. The increase in the amount of IoT devices is a good thing but the important fact is that the amount of data generated by these devices needs intelligence. A threat model is used to secure an IoT network by Pacheco and Hariri [5] but the main problem is to process and deal with a huge amount of data. There is a need for an intelligent device near the data to control flow and analyze huge amount of data produced by IoT devices; for this purpose fog computing is used by authors. The role of fog is now of much importance which brought the Internet to a new era from the cloud as explained by Ali et al. [6]. Fog computing provides better administration service to end-users; the main reason is its services are distributed widely. Besides, another factor is unique in fog computing that it supports heterogeneous devices. The cyber-attacks are most dangerous for the open stack environment, especially carrying big and confidential data; Diro and Chilamkurti [7] designed an LSTM network to detect cyber-attacks with a high accuracy rate. Most IoT devices are vulnerable to such attacks and hence need a detection framework. The role of Intrusion Detection System (IDS) is very important in an organization to avoid cyber-attacks. Chockwanich and Visoottiviseth [8] presented an IDS-based deep learning approach for the detection of attacks. The authors used Recurrent Neural Network (RNN) and Convolutional Neural Network (CNN) to identify different kinds of attacks. The emerging field nowadays is fog-to-IoT computing, facing the great challenge of security. In this article the authors proposed SDN-based DL-architecture as shown in Figure 1, for early and efficient detection of new evolving multiple cyber-attacks in fog-to-IoT communication, using DL algorithms. The performance and evaluation are performed on the CIDDS-01 dataset.Figure 1
Architecture of SDN fog-to-IoT communication.


### 1.1. Contributions

The main contributions of article are as follows:(i)
The presentation of a robust SDN-enabled framework that is highly scalable, is programmable, and efficiently detects cyber-attacks is combined with the predictive power of DL algorithms and the proposed framework can be extended to any plane such as edge computing.(ii)
For better practical analysis and experimentation a flow-based state-of-the-art dataset CIDDS-01 has been used for a detection system consisting of multiclass attacks.(iii)
For the evaluation of the proposed system practically standard evaluation metrics have been used to monitor the system’s performance (i.e., accuracy, precision, recall, andF1-score, etc.).(iv)
We have compared our proposed technique with current standard algorithms and previous frameworks. The proposed technique outperforms other frameworks in terms of accuracy with the addition of providing a centralized controller overcoming the distributed nature combined with the intelligence of DL detecting attacks efficiently.


### 1.2. Structure

The other section of the paper is organized as follows. Background and related work are presented in Section2 and Section 3 consists of methodology. The results are explained in Section 4 and Section 5 consists of the conclusion and future work.


## 1.1. Contributions

The main contributions of article are as follows:(i)
The presentation of a robust SDN-enabled framework that is highly scalable, is programmable, and efficiently detects cyber-attacks is combined with the predictive power of DL algorithms and the proposed framework can be extended to any plane such as edge computing.(ii)
For better practical analysis and experimentation a flow-based state-of-the-art dataset CIDDS-01 has been used for a detection system consisting of multiclass attacks.(iii)
For the evaluation of the proposed system practically standard evaluation metrics have been used to monitor the system’s performance (i.e., accuracy, precision, recall, andF1-score, etc.).(iv)
We have compared our proposed technique with current standard algorithms and previous frameworks. The proposed technique outperforms other frameworks in terms of accuracy with the addition of providing a centralized controller overcoming the distributed nature combined with the intelligence of DL detecting attacks efficiently.


## 1.2. Structure

The other section of the paper is organized as follows. Background and related work are presented in Section2 and Section 3 consists of methodology. The results are explained in Section 4 and Section 5 consists of the conclusion and future work.


## 2. Background and Related Work

In this section first the capabilities and role of SDN in Fog-to-IoT environment are highlighted and then different approaches for security of data are discussed most using DL for detection of cyber-attacks in IoT environment. Moreover, different types of attacks detection through different DL models are examined in different environments consisting of network architectures. The role of SDN in Fog-to-IoT environment is customer-friendly; they can locate all their devices. Most importantly slicing up a network through different applications using the data and some configurations, many users prefer using SDN in distributed networks like fog-to-IoT. Although due to the centralized nature of SDN, if the flow of the network during fog-to-IoT communication is disturbed, it can be controlled easily preventing the network from suffering from latency problems. There is a rapid increase in cyber-attacks throughout the world in IoT environment. The fog computing solved latency and bandwidth problems; fog computing is a vast field.There is a lot of research done on fog computing particularly on the security side such as cyber-attacks. The fog provides very good service and is having a very flexible architecture as compared to the cloud using low bandwidth. Furthermore, to identify malicious attacks in fog-to-IoT communication, Samy et al. [9] used different DL algorithms, but without any centralized controller, fog nodes will create overhead which may fail the whole system. The use of deep neural networks is gaining a lot of success but without a centralized controller still vulnerable to attacks, Almiani et al. [10] proposed neural network RNN using DL models providing intelligence in detecting attacks, but still lacking a centralized mechanism to avoid overhead in fog nodes. A greedy algorithm-based split finding approach is used by Reddy et al. [11] for intrusion detection in fog-IoT environment. The authors used different ML approaches to detect different types of cyber threats, but the system is still vulnerable to new evolving attacks with no presence of a centralized controller. Fog computing solved the bandwidth and latency problems which were the main concern for users dealing with the cloud, but fog can be targeted easily by attackers so Zuo et al. [12] present a CCE model to secure fog from sophisticated cyber-attacks.There is still a need for securing fog. Vishwanath et al. [13] proposed an AES algorithm encryption technique to detect attacks in fog nodes; the proposed technique performs well. The experiment is carried out on small datasets, but DL can work efficiently on large-scale data and can detect cyber threats with high accuracy rate detecting different types of malware attacks. There are some other concerns; for example, most anomaly-based intrusion detection systems lack quality datasets for evaluation and when problems like redundancy occur the error rate automatically increases. Ring et al. [14] present a labeled flow data CIDDS-01 which is the state-of-the-art dataset publicly available. A method to detect DDoS attacks is proposed by Azad et al. [15] using a mitigation algorithm in SDN-enabled framework but detection accuracy is low as compared to DL algorithms used in other proposed methodologies. The fog computing due to distributed nature is vulnerable to new evolving DDoS attacks. Hussain et al. [16] discussed the challenges faced by deploying fog nodes without any centralized mechanism and intelligence; to overcome problems like authentication and overhead there is still need for Artificial Intelligence (AI) to reduce the error rate. The use of SDN controller provided ease to control the whole system from a single point but it can be targeted by sophisticated attacks; to refine incoming traffic authors used ML algorithms; for example, Strecker et al. [17] used ML combined with SDN framework but still there is the chance of high error rate, which is alarming; to overcome such problem there is a need for centralized system combined with AI in the shape of DL. The new evolving cyber-attacks like Brute-Force and DDoS are a major threat to systems. Tang et al. [18] proposed a Deep Neural Network (DNN) algorithm for detection of DDoS attacks using the NSL-KDD dataset. The authors used a single model for detecting DDoS attacks.A DL model Recurrent Neural Network (RNN) with a hybrid of Intrusion Detection System (IDS) is used by Yin et al. [19] to detect anomalies and different types of intrusion inside a system but the proposed framework lacks a centralized controller. Furthermore, RNN and Long Short-Term Memory (LSTM) hybrid are used for intrusion detection with help of a unified optimization method for detecting different attacks by Jiang et al. [20]. However, there is a need for more study of the comparison between ML and DL algorithms in terms of time complexity, accuracy, and performance which is discussed by Xin et al. [21], after applying different models of ML and DL, hence proving that DL outclassed ML; nowadays due to usage of many IoT devices the communication storage is increasing and fog supports cloud in maintaining data with high bandwidth. Now dealing with a large scale of data DL algorithms showed great improvement as compared to other algorithms. To secure data from cyber-attacks, some organizations are focused on building their own network intrusion detection systems, but the performance of those systems is not suitable in dealing with a large amount of data.The need for fog computing is very essential especially for maintaining many IoT devices records and to deal with the huge amount of data produced by these devices, fog computing is used for the detection of attacks in IoT devices by Prabavathy et al. [22]. A fuzzy algorithm is used for the detection of cyber-attacks with an accuracy rate above 80% by Rathore et al. [23]. There is a need for centralized control to minimize the error rate. Thing [24] proposed a framework for analyzing and detecting several kinds of threats targeting the IEEE 802.11 network. Furthermore, for cyber threats detection, an anomaly-based framework is proposed by Yaseen et al. [25] using a deep learning approach. The flow of the Internet also sometimes suffers from serious malicious attacks, so the proposed model identifies nodes attacked by a virus moving from one system to another during data transfer in an IoT environment. The most important benefit of the proposed model is that it can bear the computation overhead, thus managing the whole data transfer process with ease.For the change from cloud to fog, initially fog architecture was somehow not so much robust to carry out some important operations; however with time it was developed and designed into the most beneficial architecture; Byers [26] emphasized architectural aspects of fog computing and told us about its role in coping big data in various fields. The performance of DL algorithms is remarkable in detecting threats. Abeshu and Chilamkurti [27] proposed another scheme for detecting threats in fog-to-IoT communication with the use of DL models but without any centralized controller. A Multilayer Perceptron (MLP) model is proposed by Khater et al. [28], using lightweight IDS with the help of vector representation on the Australian Defense Force Academy Linux (ADFA-LD) dataset for detection of attacks, resulting in 94% percent accuracy. This shows that the model is perfect for large datasets containing big data; in [3, 9, 10, 29, 30] the focus is on providing intelligence for detection of new evolving attacks; even different mechanisms are explained to deal with cyber-attacks, but some frameworks are designed without a centralized controller and others lack the use of intelligence. From the studies, it is proved that still there is a need for a centralized mechanism combined with intelligence to protect the system from new evolving attacks with a high accuracy rate. This article provides a mechanism to detect intrusions by focusing on many DL algorithms to show more efficiency and deliver results with a high accuracy rate using a centralized mechanism with intelligence provided by DL models to secure fog-to-IoT network from cyber-attacks. There are many findings from the literature review which are highlighted in Table 1.Table 1
Comprehensive comparison of existing related work.
RefYearDatasetAlgorithmsFindings[7]2018ISCX, AWIDLSTM, LR98.22% accuracy achieved in multiclass[8]2019MAWIRNN, CNN98% accuracy achieved in multiclass[9]2020NSL-KDDML and DL99% accuracy achieved in multiclass[10]2020NSL-KDDMultilayered RNN92.18% accuracy achieved in multiclass[11]2021IoTID20Exact greedy algorithm84.4% accuracy achieved in multiclass[12]20185G dataCCA security modelProposed model provides security using encryption method[13]2017Coca-Cola datasetAES algorithmData is secured through encryption[14]2016CIDDS-01NIDSData is protected through NIDS[15]2021SDN port dataIoT-DDoS algorithmDDoS SDN-enabled model successfully detects and prevents attacks[16]2021Survey paperIDS algorithmsFog models detect attacks with low accuracy rate[17]2021SOHO architecture dataDL algorithms99.66% anomaly detection network accuracy rate in IEEE 802.11


## 3. Methodology

This section consists of the proposed methodology of cyber threat detection system including system description, preprocessing of data, dataset, and deep learning algorithms.


### 3.1. Preprocessing and Detection of Attacks

To show the effectiveness of the proposed deep learning hybrid models the dataset CIDDS is preprocessed in order to remove Nan-infinity values and MinMax Scalar function is used to normalize dataset to improve the quality of used data. The preprocessing and detection are performed in three phases.


#### 3.1.1. Preprocessing Phase

In the initial phase the Nan and infinite values from the dataset are removed because the reason is that these values are the basic reason why the disappearance of the gradient can lead to many errors that slow down the network making it unsafe. The neural network models are used for performance evaluation. Furthermore, different scripts are used in Python for removing such values to denoise the data for better results. The data is split into training and test sets. With the train data consisting of 80%, models will better generalize the data because of the high percentage of training data, which is passed to learning algorithms and test data is 20% left for predicting values.


#### 3.1.2. Training Phase

In this phase, the preprocessed and refined data is passed to DL algorithms for intrusion detection. There are five DL models used including own constructed hybrid DL model and the comparison between the models is drawn for better analysis. The detail of technical setup of algorithms is explained in Table2. In both LSTM-GRU and LSTM-CNN hybrid models, two convolutional layers are used with two GRU layers using Rectified Linear Unit (ReLU) as activation function and softmax function in the final layer for linearity. The optimizer Adam is used; initially 10 epochs are applied with batch size 32 for better detection; the number of epochs is increased simultaneously.Table 2
Experimental technical setup of proposed algorithms.
Hybrid algorithmsLayersKernel/neuronsAF/lossOptimizerEBSLSTM-GRUConv (2)(30, 20, 10)ReLU/CC-EAdam1032GRU (2)(30, 20, 10)—Merge—Dense45—Dense20—Output5SoftmaxLSTM-CNNConv (2)(30, 20, 10)ReLU/CC-EAdam1032LSTM (2)(30, 20, 10)—Merge—Dense45—Dense20—Output5SoftmaxAF = activation function,E = epochs, BS = batch size.


#### 3.1.3. Detection Phase

In this phase deep learning models are used, including hybrid models which are highly scalable and accurately detecting attacks. The models detect the number of attacks in traffic generating from IoT devices collected by fog nodes. The framework used for prediction is composed of hybrid benchmark deep learning algorithms, which detect three kinds of attacks: DDoS, Brute-Force, and Port-Scan. The performance of the proposed framework is evaluated using some standard matrices like accuracy, precision, recall, andF1-score.


### 3.2. The Proposed Deep Learning Hybrid Framework

For detection of attacks SDN-based DL framework is designed as shown in Figure2. In the DL algorithms with the help of a confusion matrix predicting desired cyber-attacks with a high accuracy rate, the traffic is generated from different applications controlled by the control plane. The traffic from different IoT devices is monitored on South Bound known as data plane, the incoming traffic is benign with normal flow from different applications on North Bound, and the whole mechanism is controlled by SDN having centralized nature. The controller is enhanced to fog computing in proposed architecture which is highly cost-effective and dynamic. The goal is to detect new attacks efficiently in a fog-to-IoT environment, using DL algorithms and state-of-the-art flow-based dataset for rigorous evaluation. For verification purposes, benchmark DL-driven algorithms are compared to show the effectiveness of proposed framework. The preprocessing and detection are performed in three phases 1, 2, and 3, to detect new attacks like DDoS, Port-Scan, and Brute-Force efficiently.Figure 2
Proposed system model incorporated with SDN architecture.The evaluations for detection of attacks are performed in different phases shown in Figure3. In the first phase preprocessing of data is performed by removing Nan and infinite values from dataset to improve the quality of data to avoid redundancy and in the second phase the refined data is trained and tested. In final phase different models are used to detect cyber threats. The performance of the models is identified through better detection accuracy rate. The model with a high accuracy rate can better detect new evolving attacks.Figure 3
Proposed scheme preprocessing and detection phases.


### 3.3. Dataset

The dataset used is known as CIDDS-001; for the first time it was introduced in [14]. It is a labeled flow base dataset used for anomaly-based IDS. The traffic contains new evolving attacks in the shape of DDoS, Port-Scan, and Brute-Force. The overall data of network traffic is collected from the external and internal open stack environment. The main version of the dataset consists of 10 attributes and 5 classes, but in proposed work 2 classes included normal and attack in the final data set. The total number of instances taken are 180387 in which the normal records are 147073 and attacks are 33313 in number. The complete distribution of traffic is presented in Table 3. The features list that the dataset contains used by the proposed module for the detection of attacks is shown in Table 4.Table 3
Data distribution of CIDDS-01 for practical experimentation.
ClassesNo. of recordsBenign147073DDoS18542Port-Scan2168Brute-Force12603Total180387Table 4
CIDDS-01 dataset features list.
S. No.Names of features1Date first seen2Duration3Proto4Source IP address5Source port6Destination IP address7Destination port8Packets9Bytes10Flags11Class


### 3.4. Evaluation Metrics

The performance parameters the authors considering in this article are accuracy, precision, recall,F1-score, and ROC (Receiver Operating Characteristics). These are state-of-the-art metrics used to find how efficiently the proposed model works. The other metrics used are FNR (False Negative Rate), FPR (False Positive Rate), FDR (False Discovery Rate), and FOR (False Omission Rate) for better error detection rate.


#### 3.4.1. Accuracy

The accuracy is calculated to find out the ratio between the total number of input samples and the total number of correct predictions. A model accuracy is to analyze which model is working best. The model performance is evaluated through considering different patterns and relation between some variables in a dataset. It is based on some input, training data. The number of correctly predicted points is related to accuracy. If a specific algorithm is used for classification of data point which is false, then it would be counted as a false positive. The accuracy is shown in(1)A=records accurately classifiedTotal number of records∗100.


#### 3.4.2. Precision

It is the fraction of relevant substances among the retrieved substances. The model predicts a few correct classifications and many incorrect ones; in this way the increase comes in the denominator and the precision becomes small. In another case the precision remains with higher rate when many correct predictions are made by model; in this case the number of true positive values remains high. In another condition a fewer incorrect positive predictions are made. By using the confusion matrix CM for each classk, the precision is shown in(2)Pk=TPkTPk+FPk∗100.


#### 3.4.3. Recall

The recall function is used to measure the quality of predictions. In matrix for prediction the recall counts the number of false negative values. The rate of recall goes up whenever the prediction of False Negative Rate increased. By using the confusion matrix CM for each classk, the recall is shown in(3)Rk=TPkTPk+FNk∗100.


#### 3.4.4.F1-Score

It combines precision and recall to a positive class. TheF1 score is also known as F score or measurement of F. The selection of model depends on balance of a model; if a model is selected on basis of balance between recall and precision rate then F1 measurement suggestion is important feature in model selection. For each class k, it is shown in(4)Fk=2∗Pk∗RkPk+Rk∗100.


#### 3.4.5. ROC Curve

It shows the trade-off between false positive rate and true positive rate. It is used to plot true positive values in trade-off with false positive values at different threshold classification. The points in ROC curve are calculated by Area under the ROC curve known as AUC, which measures the area consisting of two dimensions below the ROC curve. Among all threshold classification the performance overall measurement in terms of aggregate is provided by AUC. The AUC is also known as scale invariant used for measurement of predictions rather than using absolute type of values.


### 3.5. Evaluation Algorithms

In proposed work 5 different DL algorithms, DNN, CNN, and LSTM as well as constructed hybrid algorithms, are used and applied to the CIDDS-001 dataset; all performed well in detecting new attacks.


#### 3.5.1. CNN

This neural network has shown good performance in image recognition; the author has used CNN in [9] on numerical data to detect attacks in fog-to-IoT communication but still, it needs a centralized controller to show more accurate results. It consists of a convolutional layer and fully connected layers as shown in Figure 4. There are mainly three types of layers in CNN network: convolutional layer, pooling layer, and fully connected layer. The first layer is convolutional layer where filters are applied to the image whose main objective is to extract high features.Figure 4
CNN layers architecture and distribution.For the reduction of network dimension, the second layer used is max-pooling or average pooling. In filter region to select maximum value max-pooling is used and to select average value average pooling is used. The fully connected layers are used only to flatten the results.


#### 3.5.2. LSTM

When the RNN algorithm was facing issues of vanishing gradient then LSTM as shown in Figure5 was introduced. The LSTM consists of input, output, and memory gates. It consists of connections mainly used for feedback. The data is processed by LSTM through the information it backpropagates. The main role in LSM structure is held by a central cell known as cell state; the information is exchanged by cell state and carried by gates. A layer known as sigmoid produces the number between 0 and 1. If a person wants to modify any type of calendar, the LSTM is used for small modifications using its states. The LSTM networks are used to solve such problems which are left by previous networks like RNN. These are big steps in the field of deep learning as LSTM provides much better results as compared to RNN.Figure 5
LSTM gates internal architecture.The mathematical equation of LSTM can be derived where forp is forget gate, Inp stands for input gate, and Oup stands for output gate. The cell state is represented by Celp and hip is used for the hidden state. Similarly, W is used for weights, b for base value, αsig for sigmoid and αtan for tanh, respectively. Finally, equation (5) becomes(5)forp=αsigWforp×xt+Uforp×ht−1+bforp,Inp=αsigWInp×xt+UInp×ht−1+bInp,Oup=αsigWOup×xt+UOup×ht−1+bOup,Celp′=αtanWCelp′×xt+UCelp′×ht−1+bCelp′,Celp=forp⋅Celp−1+Inp⋅Celp′,hip=Oup⋅αtanCelp.


#### 3.5.3. LSTM-GRU

The Gated Recurrent Unit’s (GRU) working is like LSTM but consists of fewer components and for large-scale data, the performance of LSTM is better as compared to the GRU, but GRU is showing good performance on small datasets avoiding lengthy training time. The hybrid of LSTM and GRU shows good performance as compared to solemn use. The hybrid of LSTM with GRU is shown in Figure6.Figure 6
LSTM and GRU hybrid architecture.


#### 3.5.4. LSTM-CNN

The LSTM performance is good on time sequence prediction and CNN is the best for feature extraction of images. The hybrid of both LSTM and CNN showed better performance. In this model, 1D CNN is used; convolutional layer and pooling are merged with LSTM layers after applying LSTM layers; the flattened data is passed through for prediction as shown in Figure7.Figure 7
LSTM and CNN hybrid architecture.


### 3.6. Experimental Setup

The experiment is carried out on the state-of-the-art dataset using CIDDS-01 and Python for different models (DNN, CNN, LSTM, LSTM-GRU, and LSTM-CNN). The authors implemented the detection system using the refined data which was refined in the earlier step. The CPU used is 5th generation and the GPU is NVIDIA version 5.33. The programming language used is Python and the IDE environment is Anaconda. The RAM consists of 16 GB. A brief comparison is drawn for the deeper analysis and a better understanding of the results. The settings of the hardware and software are mentioned in Table5, for the practical experiment of our proposed model.Table 5
Hardware and software setting for practical experimentation.
IDEAnaconda SypderCPUCore-i5 (2.0 GHz), 5th generation, model 6600KMemory (RAM)16 GB-2400 MHzLibrariesPandas, Keras, tensor-flowOperating systemWindows 10, 64-bitLanguagePython


## 3.1. Preprocessing and Detection of Attacks

To show the effectiveness of the proposed deep learning hybrid models the dataset CIDDS is preprocessed in order to remove Nan-infinity values and MinMax Scalar function is used to normalize dataset to improve the quality of used data. The preprocessing and detection are performed in three phases.


### 3.1.1. Preprocessing Phase

In the initial phase the Nan and infinite values from the dataset are removed because the reason is that these values are the basic reason why the disappearance of the gradient can lead to many errors that slow down the network making it unsafe. The neural network models are used for performance evaluation. Furthermore, different scripts are used in Python for removing such values to denoise the data for better results. The data is split into training and test sets. With the train data consisting of 80%, models will better generalize the data because of the high percentage of training data, which is passed to learning algorithms and test data is 20% left for predicting values.


### 3.1.2. Training Phase

In this phase, the preprocessed and refined data is passed to DL algorithms for intrusion detection. There are five DL models used including own constructed hybrid DL model and the comparison between the models is drawn for better analysis. The detail of technical setup of algorithms is explained in Table2. In both LSTM-GRU and LSTM-CNN hybrid models, two convolutional layers are used with two GRU layers using Rectified Linear Unit (ReLU) as activation function and softmax function in the final layer for linearity. The optimizer Adam is used; initially 10 epochs are applied with batch size 32 for better detection; the number of epochs is increased simultaneously.Table 2
Experimental technical setup of proposed algorithms.
Hybrid algorithmsLayersKernel/neuronsAF/lossOptimizerEBSLSTM-GRUConv (2)(30, 20, 10)ReLU/CC-EAdam1032GRU (2)(30, 20, 10)—Merge—Dense45—Dense20—Output5SoftmaxLSTM-CNNConv (2)(30, 20, 10)ReLU/CC-EAdam1032LSTM (2)(30, 20, 10)—Merge—Dense45—Dense20—Output5SoftmaxAF = activation function,E = epochs, BS = batch size.


### 3.1.3. Detection Phase

In this phase deep learning models are used, including hybrid models which are highly scalable and accurately detecting attacks. The models detect the number of attacks in traffic generating from IoT devices collected by fog nodes. The framework used for prediction is composed of hybrid benchmark deep learning algorithms, which detect three kinds of attacks: DDoS, Brute-Force, and Port-Scan. The performance of the proposed framework is evaluated using some standard matrices like accuracy, precision, recall, andF1-score.


## 3.1.1. Preprocessing Phase

In the initial phase the Nan and infinite values from the dataset are removed because the reason is that these values are the basic reason why the disappearance of the gradient can lead to many errors that slow down the network making it unsafe. The neural network models are used for performance evaluation. Furthermore, different scripts are used in Python for removing such values to denoise the data for better results. The data is split into training and test sets. With the train data consisting of 80%, models will better generalize the data because of the high percentage of training data, which is passed to learning algorithms and test data is 20% left for predicting values.


## 3.1.2. Training Phase

In this phase, the preprocessed and refined data is passed to DL algorithms for intrusion detection. There are five DL models used including own constructed hybrid DL model and the comparison between the models is drawn for better analysis. The detail of technical setup of algorithms is explained in Table2. In both LSTM-GRU and LSTM-CNN hybrid models, two convolutional layers are used with two GRU layers using Rectified Linear Unit (ReLU) as activation function and softmax function in the final layer for linearity. The optimizer Adam is used; initially 10 epochs are applied with batch size 32 for better detection; the number of epochs is increased simultaneously.Table 2
Experimental technical setup of proposed algorithms.
Hybrid algorithmsLayersKernel/neuronsAF/lossOptimizerEBSLSTM-GRUConv (2)(30, 20, 10)ReLU/CC-EAdam1032GRU (2)(30, 20, 10)—Merge—Dense45—Dense20—Output5SoftmaxLSTM-CNNConv (2)(30, 20, 10)ReLU/CC-EAdam1032LSTM (2)(30, 20, 10)—Merge—Dense45—Dense20—Output5SoftmaxAF = activation function,E = epochs, BS = batch size.


## 3.1.3. Detection Phase

In this phase deep learning models are used, including hybrid models which are highly scalable and accurately detecting attacks. The models detect the number of attacks in traffic generating from IoT devices collected by fog nodes. The framework used for prediction is composed of hybrid benchmark deep learning algorithms, which detect three kinds of attacks: DDoS, Brute-Force, and Port-Scan. The performance of the proposed framework is evaluated using some standard matrices like accuracy, precision, recall, andF1-score.


## 3.2. The Proposed Deep Learning Hybrid Framework

For detection of attacks SDN-based DL framework is designed as shown in Figure2. In the DL algorithms with the help of a confusion matrix predicting desired cyber-attacks with a high accuracy rate, the traffic is generated from different applications controlled by the control plane. The traffic from different IoT devices is monitored on South Bound known as data plane, the incoming traffic is benign with normal flow from different applications on North Bound, and the whole mechanism is controlled by SDN having centralized nature. The controller is enhanced to fog computing in proposed architecture which is highly cost-effective and dynamic. The goal is to detect new attacks efficiently in a fog-to-IoT environment, using DL algorithms and state-of-the-art flow-based dataset for rigorous evaluation. For verification purposes, benchmark DL-driven algorithms are compared to show the effectiveness of proposed framework. The preprocessing and detection are performed in three phases 1, 2, and 3, to detect new attacks like DDoS, Port-Scan, and Brute-Force efficiently.Figure 2
Proposed system model incorporated with SDN architecture.The evaluations for detection of attacks are performed in different phases shown in Figure3. In the first phase preprocessing of data is performed by removing Nan and infinite values from dataset to improve the quality of data to avoid redundancy and in the second phase the refined data is trained and tested. In final phase different models are used to detect cyber threats. The performance of the models is identified through better detection accuracy rate. The model with a high accuracy rate can better detect new evolving attacks.Figure 3
Proposed scheme preprocessing and detection phases.


## 3.3. Dataset

The dataset used is known as CIDDS-001; for the first time it was introduced in [14]. It is a labeled flow base dataset used for anomaly-based IDS. The traffic contains new evolving attacks in the shape of DDoS, Port-Scan, and Brute-Force. The overall data of network traffic is collected from the external and internal open stack environment. The main version of the dataset consists of 10 attributes and 5 classes, but in proposed work 2 classes included normal and attack in the final data set. The total number of instances taken are 180387 in which the normal records are 147073 and attacks are 33313 in number. The complete distribution of traffic is presented in Table 3. The features list that the dataset contains used by the proposed module for the detection of attacks is shown in Table 4.Table 3
Data distribution of CIDDS-01 for practical experimentation.
ClassesNo. of recordsBenign147073DDoS18542Port-Scan2168Brute-Force12603Total180387Table 4
CIDDS-01 dataset features list.
S. No.Names of features1Date first seen2Duration3Proto4Source IP address5Source port6Destination IP address7Destination port8Packets9Bytes10Flags11Class


## 3.4. Evaluation Metrics

The performance parameters the authors considering in this article are accuracy, precision, recall,F1-score, and ROC (Receiver Operating Characteristics). These are state-of-the-art metrics used to find how efficiently the proposed model works. The other metrics used are FNR (False Negative Rate), FPR (False Positive Rate), FDR (False Discovery Rate), and FOR (False Omission Rate) for better error detection rate.


### 3.4.1. Accuracy

The accuracy is calculated to find out the ratio between the total number of input samples and the total number of correct predictions. A model accuracy is to analyze which model is working best. The model performance is evaluated through considering different patterns and relation between some variables in a dataset. It is based on some input, training data. The number of correctly predicted points is related to accuracy. If a specific algorithm is used for classification of data point which is false, then it would be counted as a false positive. The accuracy is shown in(1)A=records accurately classifiedTotal number of records∗100.


### 3.4.2. Precision

It is the fraction of relevant substances among the retrieved substances. The model predicts a few correct classifications and many incorrect ones; in this way the increase comes in the denominator and the precision becomes small. In another case the precision remains with higher rate when many correct predictions are made by model; in this case the number of true positive values remains high. In another condition a fewer incorrect positive predictions are made. By using the confusion matrix CM for each classk, the precision is shown in(2)Pk=TPkTPk+FPk∗100.


### 3.4.3. Recall

The recall function is used to measure the quality of predictions. In matrix for prediction the recall counts the number of false negative values. The rate of recall goes up whenever the prediction of False Negative Rate increased. By using the confusion matrix CM for each classk, the recall is shown in(3)Rk=TPkTPk+FNk∗100.


### 3.4.4.F1-Score

It combines precision and recall to a positive class. TheF1 score is also known as F score or measurement of F. The selection of model depends on balance of a model; if a model is selected on basis of balance between recall and precision rate then F1 measurement suggestion is important feature in model selection. For each class k, it is shown in(4)Fk=2∗Pk∗RkPk+Rk∗100.


### 3.4.5. ROC Curve

It shows the trade-off between false positive rate and true positive rate. It is used to plot true positive values in trade-off with false positive values at different threshold classification. The points in ROC curve are calculated by Area under the ROC curve known as AUC, which measures the area consisting of two dimensions below the ROC curve. Among all threshold classification the performance overall measurement in terms of aggregate is provided by AUC. The AUC is also known as scale invariant used for measurement of predictions rather than using absolute type of values.


## 3.4.1. Accuracy

The accuracy is calculated to find out the ratio between the total number of input samples and the total number of correct predictions. A model accuracy is to analyze which model is working best. The model performance is evaluated through considering different patterns and relation between some variables in a dataset. It is based on some input, training data. The number of correctly predicted points is related to accuracy. If a specific algorithm is used for classification of data point which is false, then it would be counted as a false positive. The accuracy is shown in(1)A=records accurately classifiedTotal number of records∗100.


## 3.4.2. Precision

It is the fraction of relevant substances among the retrieved substances. The model predicts a few correct classifications and many incorrect ones; in this way the increase comes in the denominator and the precision becomes small. In another case the precision remains with higher rate when many correct predictions are made by model; in this case the number of true positive values remains high. In another condition a fewer incorrect positive predictions are made. By using the confusion matrix CM for each classk, the precision is shown in(2)Pk=TPkTPk+FPk∗100.


## 3.4.3. Recall

The recall function is used to measure the quality of predictions. In matrix for prediction the recall counts the number of false negative values. The rate of recall goes up whenever the prediction of False Negative Rate increased. By using the confusion matrix CM for each classk, the recall is shown in(3)Rk=TPkTPk+FNk∗100.


## 3.4.4.F1-Score

It combines precision and recall to a positive class. TheF1 score is also known as F score or measurement of F. The selection of model depends on balance of a model; if a model is selected on basis of balance between recall and precision rate then F1 measurement suggestion is important feature in model selection. For each class k, it is shown in(4)Fk=2∗Pk∗RkPk+Rk∗100.


## 3.4.5. ROC Curve

It shows the trade-off between false positive rate and true positive rate. It is used to plot true positive values in trade-off with false positive values at different threshold classification. The points in ROC curve are calculated by Area under the ROC curve known as AUC, which measures the area consisting of two dimensions below the ROC curve. Among all threshold classification the performance overall measurement in terms of aggregate is provided by AUC. The AUC is also known as scale invariant used for measurement of predictions rather than using absolute type of values.


## 3.5. Evaluation Algorithms

In proposed work 5 different DL algorithms, DNN, CNN, and LSTM as well as constructed hybrid algorithms, are used and applied to the CIDDS-001 dataset; all performed well in detecting new attacks.


### 3.5.1. CNN

This neural network has shown good performance in image recognition; the author has used CNN in [9] on numerical data to detect attacks in fog-to-IoT communication but still, it needs a centralized controller to show more accurate results. It consists of a convolutional layer and fully connected layers as shown in Figure 4. There are mainly three types of layers in CNN network: convolutional layer, pooling layer, and fully connected layer. The first layer is convolutional layer where filters are applied to the image whose main objective is to extract high features.Figure 4
CNN layers architecture and distribution.For the reduction of network dimension, the second layer used is max-pooling or average pooling. In filter region to select maximum value max-pooling is used and to select average value average pooling is used. The fully connected layers are used only to flatten the results.


### 3.5.2. LSTM

When the RNN algorithm was facing issues of vanishing gradient then LSTM as shown in Figure5 was introduced. The LSTM consists of input, output, and memory gates. It consists of connections mainly used for feedback. The data is processed by LSTM through the information it backpropagates. The main role in LSM structure is held by a central cell known as cell state; the information is exchanged by cell state and carried by gates. A layer known as sigmoid produces the number between 0 and 1. If a person wants to modify any type of calendar, the LSTM is used for small modifications using its states. The LSTM networks are used to solve such problems which are left by previous networks like RNN. These are big steps in the field of deep learning as LSTM provides much better results as compared to RNN.Figure 5
LSTM gates internal architecture.The mathematical equation of LSTM can be derived where forp is forget gate, Inp stands for input gate, and Oup stands for output gate. The cell state is represented by Celp and hip is used for the hidden state. Similarly, W is used for weights, b for base value, αsig for sigmoid and αtan for tanh, respectively. Finally, equation (5) becomes(5)forp=αsigWforp×xt+Uforp×ht−1+bforp,Inp=αsigWInp×xt+UInp×ht−1+bInp,Oup=αsigWOup×xt+UOup×ht−1+bOup,Celp′=αtanWCelp′×xt+UCelp′×ht−1+bCelp′,Celp=forp⋅Celp−1+Inp⋅Celp′,hip=Oup⋅αtanCelp.


### 3.5.3. LSTM-GRU

The Gated Recurrent Unit’s (GRU) working is like LSTM but consists of fewer components and for large-scale data, the performance of LSTM is better as compared to the GRU, but GRU is showing good performance on small datasets avoiding lengthy training time. The hybrid of LSTM and GRU shows good performance as compared to solemn use. The hybrid of LSTM with GRU is shown in Figure6.Figure 6
LSTM and GRU hybrid architecture.


### 3.5.4. LSTM-CNN

The LSTM performance is good on time sequence prediction and CNN is the best for feature extraction of images. The hybrid of both LSTM and CNN showed better performance. In this model, 1D CNN is used; convolutional layer and pooling are merged with LSTM layers after applying LSTM layers; the flattened data is passed through for prediction as shown in Figure7.Figure 7
LSTM and CNN hybrid architecture.


## 3.5.1. CNN

This neural network has shown good performance in image recognition; the author has used CNN in [9] on numerical data to detect attacks in fog-to-IoT communication but still, it needs a centralized controller to show more accurate results. It consists of a convolutional layer and fully connected layers as shown in Figure 4. There are mainly three types of layers in CNN network: convolutional layer, pooling layer, and fully connected layer. The first layer is convolutional layer where filters are applied to the image whose main objective is to extract high features.Figure 4
CNN layers architecture and distribution.For the reduction of network dimension, the second layer used is max-pooling or average pooling. In filter region to select maximum value max-pooling is used and to select average value average pooling is used. The fully connected layers are used only to flatten the results.


## 3.5.2. LSTM

When the RNN algorithm was facing issues of vanishing gradient then LSTM as shown in Figure5 was introduced. The LSTM consists of input, output, and memory gates. It consists of connections mainly used for feedback. The data is processed by LSTM through the information it backpropagates. The main role in LSM structure is held by a central cell known as cell state; the information is exchanged by cell state and carried by gates. A layer known as sigmoid produces the number between 0 and 1. If a person wants to modify any type of calendar, the LSTM is used for small modifications using its states. The LSTM networks are used to solve such problems which are left by previous networks like RNN. These are big steps in the field of deep learning as LSTM provides much better results as compared to RNN.Figure 5
LSTM gates internal architecture.The mathematical equation of LSTM can be derived where forp is forget gate, Inp stands for input gate, and Oup stands for output gate. The cell state is represented by Celp and hip is used for the hidden state. Similarly, W is used for weights, b for base value, αsig for sigmoid and αtan for tanh, respectively. Finally, equation (5) becomes(5)forp=αsigWforp×xt+Uforp×ht−1+bforp,Inp=αsigWInp×xt+UInp×ht−1+bInp,Oup=αsigWOup×xt+UOup×ht−1+bOup,Celp′=αtanWCelp′×xt+UCelp′×ht−1+bCelp′,Celp=forp⋅Celp−1+Inp⋅Celp′,hip=Oup⋅αtanCelp.


## 3.5.3. LSTM-GRU

The Gated Recurrent Unit’s (GRU) working is like LSTM but consists of fewer components and for large-scale data, the performance of LSTM is better as compared to the GRU, but GRU is showing good performance on small datasets avoiding lengthy training time. The hybrid of LSTM and GRU shows good performance as compared to solemn use. The hybrid of LSTM with GRU is shown in Figure6.Figure 6
LSTM and GRU hybrid architecture.


## 3.5.4. LSTM-CNN

The LSTM performance is good on time sequence prediction and CNN is the best for feature extraction of images. The hybrid of both LSTM and CNN showed better performance. In this model, 1D CNN is used; convolutional layer and pooling are merged with LSTM layers after applying LSTM layers; the flattened data is passed through for prediction as shown in Figure7.Figure 7
LSTM and CNN hybrid architecture.


## 3.6. Experimental Setup

The experiment is carried out on the state-of-the-art dataset using CIDDS-01 and Python for different models (DNN, CNN, LSTM, LSTM-GRU, and LSTM-CNN). The authors implemented the detection system using the refined data which was refined in the earlier step. The CPU used is 5th generation and the GPU is NVIDIA version 5.33. The programming language used is Python and the IDE environment is Anaconda. The RAM consists of 16 GB. A brief comparison is drawn for the deeper analysis and a better understanding of the results. The settings of the hardware and software are mentioned in Table5, for the practical experiment of our proposed model.Table 5
Hardware and software setting for practical experimentation.
IDEAnaconda SypderCPUCore-i5 (2.0 GHz), 5th generation, model 6600KMemory (RAM)16 GB-2400 MHzLibrariesPandas, Keras, tensor-flowOperating systemWindows 10, 64-bitLanguagePython


## 4. Simulations and Results

We used the technique of 10-fold cross-validation to show the performance of our proposed framework. Mainly three different classes of attacks (i.e., DDoS, Port-Scan, and Brute-Force) are identified correctly and with a very low false rate by our proposed technique. Initially a training dataset is used to develop DNN, CNN, LSTM, LSTM-GRU, and LSTM-CNN models and test dataset for performance evaluation. The simulations were performed to achieve desired results for accuracy, precision, recall, andF1-score. Furthermore, DNN, CNN, LSTM, LSTM-GRU, and LSTM-CNN models are used for 4-class traffic classification, including benign. We also find False Negative Rate (FNR) and False Positive Rate (FPR) of our proposed work for better evaluation as shown in Figure 8. The performance of accuracy, precision, and recall is evaluated for each traffic class as shown in Figure 9.Figure 8
FNR, FPR, FDR, and FOR rate of our proposed hybrid models.Figure 9
Proposed models accuracy, precision, and recall values.The performance of the proposed hybrid models is shown in Figure10. The confusion matrix for DL model and proposed models is labeled in Figures 11–13, respectively.Figure 10
Proposed hybrid models performance evaluation.Figure 11
LSTM confusion matrix.Figure 12
LSTM-GRU confusion matrix.Figure 13
Proposed model LSTM-CNN confusion matrix.To show unbiased results 10-fold cross-validation technique is performed as shown in Table6. The comparison of proposed technique with other existing techniques is shown in Table 7. The performance of standard metrics is summarized in Table 8. The detection accuracy of 99.92% of hybrid DL framework (LSTM-CNN) outperforms other DL frameworks (DNN, CNN, and LSTM) and hybrid constructed framework (LSTM-GRU).Table 6
10-fold accuracy, precision, recall, andF1-score for LSTM, LSTM-GRU, and LSTM- CNN.
FAccuracy (%)Precision (%)Recall (%)F1-score (%)++∗∗@@!!++∗∗@@!!++∗∗@@!!++∗∗@@!!199.6899.9999.8999.8199.0999.8799.7999.9799.5999.5899.6099.91297.4499.8799.9397.2399.9899.7899.6799.0999.9799.5399.7299.82399.5399.8799.9699.7999.9999.9099.6399.0799.8399.6499.7499.85499.6499.3499.9500.7499.8299.8199.8199.3099.8199.5699.6699.82599.5699.0299.9999.7799.8599.7599.6999.2399.7999.8799.7299.85699.6799.3299.9299.7299.8299.8199.8399.8799.7399.7899.0999.70799.2799.5999.9799.5399.8599.0999.5799.7699.9799.8799.9799.78899.6599.9399.9599.7399.2399.9799.8399.5799.9499.7899.9999.64999.2999.8899.9499.3199.7399.9999.8099.6799.9299.8799.8199.771098.8999.0099.9399.8699.7299.8899.7799.8799.9899.2799.8399.70Used signs ++ (LSTM),∗∗@@ (LSTM-GRU), !! (LSTM-CNN), K (constant-number), F (folds).Table 7
Proposed framework comparison with existing state-of-the-art solutions for cyber threats detection.
FrameworksAlgorithmDatasetAccuracy (%)Precision (%)Recall (%)F1-score (%)TimeProposedLSTM-CNNCIDDS201799.9299.8599.8599.9129[7]LSTMAWID98.2298.998.598.38—[8]RNN, CNNMAWI99.5699.1199.0199.21—[9]CNN-LSTMCIDDS201798.8898.4199.899.1549[10]RNNNSL-KDD92.1890.2390.892.29—[11]MLPIoTID202084.4789184—XGBoost—98916375—Table 8
Comparison of proposed work with previous frameworks in terms of accuracy, precision, recall, andF1-score.
Accuracy (%)Precision (%)Recall (%)F1-score (%)DNN99.6899.6999.6599.65CNN99.2699.7899.7199.25LSTM99.5999.3599.7499.58LSTM-GRU99.6199.7899.8099.60LSTM-CNN99.9299.8599.8599.91It is analyzed that there is above 99% true positive rate and a very less below 1% rate is of false positive for all the traffic. The confusion matrix plays a vital role in measuring classification problems. The number of higher true positive values shows how accurate the model is working. The accuracy rate of each model is above 99%, which shows the effectiveness of the proposed work in detecting attacks.The authors in [7–11] used different DL models but without any centralized feature these frameworks are vulnerable to attacks. The distributed nature of these frameworks creates overhead and authentication problems and the percentage of error rate is high. In proposed work a centralized controller is used and accuracy is much improved as compared to previous techniques using state-of-the-art dataset. The architecture and performance differences of proposed and previous frameworks are shown in Table 9. The proposed hybrid technique LSTM-CNN is also compared with previous schemes in terms of accuracy, recall, and F1-score which outperformed other proposed frameworks as shown in Figure 14. The proposed scheme is detecting attacks efficiently and with the additional feature of a centralized controller avoiding overhead created by fog nodes.Table 9
Proposed technique architecture and performance comparison with previous frameworks.
FeaturesPrevious schemes [7–12]Proposed techniqueArchitecture designFog nodes distributedCentralizedDL algorithms used1, 2, 2, 1, 25 modelsDatasetAnomaly basedCIDDS-01Detection accuracy99.82%, 98%, 99%, 98%, 92.94% in multiclass99.92% in multiclassProblemsOverhead, authentication issues, bad predictions, high error rateSolvedFigure 14
Proposed hybrid model comparison with previous techniques.The ROC curve for the proposed hybrid framework is shown in Figure15 which shows how efficiently the proposed framework is working.Figure 15
ROC curve of proposed hybrid model.


## 5. Conclusion

The SDN-enabled deep learning models have a strong ability to detect new evolving attacks in fog-to-IoT environment. The proposed technique compared to previous methodologies achieves a high detection accuracy rate with use of centralized controller. The control plane of SDN is flexible and cost-effective extended to fog network. In proposed framework DL models are used for the detection of cyber-attacks. The hybrid models performed well as compared to other models in detecting attacks. The LSTM-CNN hybrid model identifies the class of attacks with an accuracy of 99.92%, a precision rate of 99.85%, and a very low false positive rate in multiclass classification as compared to other models. In terms of accuracy, precision, and recall the LSTM hybrid models performed well as compared to CNN and LSTM. So, the proposed detection scheme is working accurately in detecting attacks as well as providing a centralized control mechanism in the shape of an SDN controller to reduce computation overhead. Currently, the work is done on detection and in the future other deep learning hybrid algorithms can be proposed for the detection of new evolving attacks. The existing work can be extended to prevention and medication.



---

*Source: 6136670-2021-12-03.xml*