A Hybrid Intrution Detection Approach Based On Deep Learning
A Hybrid Intrution Detection Approach Based On Deep Learning
net/publication/359310270
CITATIONS READS
0 20
3 authors, including:
Some of the authors of this publication are also working on these related projects:
ST-CAV: Servicios de T-learning para soportar una comunidad académica virtual View project
All content following this page was uploaded by Diego F. Rueda on 18 March 2022.
1 2 3
*
Diego F. Rueda , Juan C. Caviedes , and Wilmar Yesid Campo Muñoz
1
Institute of Informatics and Applications, Universitat de Girona, Girona, Spain
[email protected]
2
Department of Systems and Industrial Engineering, Universidad Nacional de Co-
lombia, Bogotá D.C., Colombia
[email protected]
3
Department of Electronic Engineering, Universidad del Quindío, Armenia, Co-
lombia
[email protected]
* Corresponding Author
1 Introduction
Network security is a key aspect of any company's data policy nowadays. Roughly,
these policies contemplate from application deployments, transfer of sensitive
2
data processing, and data classification is considered emergent and has many
potentialities. Although there are several proposals for intrusion detection, most of
them have been tested on old datasets such as NLS-KDD [20] that do not consider
the diversity of contemporary attacks as well current changes in traffic behavior.
This work aims to implement a hybrid intrusion detection model using deep
learning and other traditional machine learning technique. Thus, the major
contributions of this paper are the use of image recognition based on Convolutional
Neural Networks (CNN) to perform feature extraction of traffic patterns, and image
classification using an SVM to identify the type of attack. Furthermore, the model
has been trained and tested by using a modern dataset called CIC-IDS2017 [16] that
contains several types of attack and allows its performance to be measured in order
to compare the proposed model with previous approaches.
The rest of this paper is structured as follows: Section 2 contains a general
review of previous work. The proposed intrusion detection model is described in
Section 3. In Section 4 dataset description and preparation are provided.
Performance analysis and detection results are also discussed. Finally, the
conclusions and future work are presented in Section 5.
2 Related Work
script executed in the operating system may be malicious based on a short sample
of the data it manipulates. Consequently, the authors propose a Recurrent Neural
Network (RNN) to predict malicious behavior based on data from the operating
system. The scope was to study the ability of the model for detecting malware
families and variants that have not been previously stored known as Zero-Day
attacks. In training the model, around 3000 malware samples are used, reaching
95% accuracy when one second of malicious code execution has passed.
Regardless of the type of technique used for the implementation of intrusion
detection systems, in Table 1 can be seen that there is a trend towards the use of
deep learning techniques to enhance the models accuracy compared to traditional
methods. On the other hand, the possibility of implementing techniques based on
image processing is highlighted to transform each data record of the dataset into an
image. Most of the works reviewed can provide a guide to design an intrusion
detection model applying deep learning techniques. But, to evaluate the perfor-
mance model, it is relevant to use a dataset that includes modern attack types and
traffic patterns rather than just data contained in legacy dataset such as NSL-KDD.
In this paper, the proposed hybrid method for intrusion detection is supported
on a CNN to perform feature extraction of traffic patterns. Furthermore, in order to
provide the capability to detect several types of attack, a SVM based classifier is
incorporated into the proposed model, because SVM has proven to be effective in
intrusion classification problems [7], [9], [23]. Therefore, unlike previous works, a
hybrid intrusion detection model using deep learning and a classification algorithm
is proposed to address the detection of several contemporary types of attack. To
train and test the proposed hybrid model, the CIC-IDS2017 dataset is considered.
Note that this dataset is cleaned and normalized, eliminating out-of-range data, and
using a common data scale for used features.
3 Proposed Method
In order to take advantage of deep learning and traditional machine learning tech-
6
niques for intrusion detection, a hybrid model is proposed. The key to the imple-
mentation of this model arises in image recognition and a classifier algorithm. In
this section, the hybrid model implementation process is described.
Fig. 1 summarizes the overall framework used to detect and classify attacks using
the proposed hybrid model. The model implementation considers six fundamental
steps:
A Convolutional Neural Network (CNN) processes data with a grid pattern, such as
images, and to automatically and adaptively learn spatial hierarchies of features,
from low-to high-level patterns. The CNN is built as a set of three layers between
the input and output layers: a convolutional layer, a pooling layer and, a fully-
connected layer. The number of convolution layers as well as the number of pooling
layers defines the CNNs structure. Suppose the CNN input feature is feature map
of the layer i is Mi (M0 = X). Then, the Equation (1) expresses the convolution
process as [23]:
In order to test and evaluate the accuracy of the proposed hybrid model for intrusion
detection, we have implemented the model in MatlabR2020b using a machine with
4 CPU, 16GB of RAM and 1 TB of storage. This section describes the data prepa-
ration and normalization processes and the image creation to consolidate the image
bank. Finally, the performance analysis of the hybrid model is presented.
Sharafaldin et al. [16] proposed the CIC-IDS2017 dataset with the eleven most
significant characteristics required by the Canadian Institute for Cybersecurity
(CIC): attack diversity, anonymity, available protocols, full capture, full interaction,
full network configuration, full traffic, feature set, heterogeneity tagging and
metadata. Compliance with these characteristics makes the dataset contains 13 up-
to-date attacks that resemble data from networks deployed in reality. In addition, it
9
has records for benign traffic, and all of them are labeled [16]. The network
architecture used to collect data is based on two networks: attack and victim [16].
The selected dataset consists of 78 columns, an additional column labeled the
type of attack, and 2.8 millions of records. In this work, all the fields in the dataset
are not used for the analysis of our hybrid approach because they have no relevance
to the intrusion detection case study. For this reason, columns 1 and 44 to 51 of the
dataset were removed, leaving a total of 69 columns. The cleaning process
(presented in Fig. 1), has the main objective to preserve the features in the dataset
that generate more variability, delete duplicated records and keep the attacks with
more diversity of records. It is important to note how the features that represent
attributes of the size of the packets (either sent or received), duration of the traffic
session during attacks and other time variables, such as inter-arrival time, that have
high variability in the dataset. The result is a dataset with 24 features and about 2.5
million records that can be grouped 4 types of measurements:
1. Four measures of traffic for total packets and their lengths: Total Fwd/Bwd
Packets, and Total Length Of Fwd/Bwd Packets
2. Eight measures of forwarding and backwarding packages involved in com-
munication: Fwd Packet Length Max/Min/Mean/Std, and Bwd Packet Len-gth
Max/Min/Mean/Std
3. Four measures of duration time of the flows in communication: Flow Dura-
tion, Flow Bytes_s, Flow Packets_s
4. Eight measures of inter-arrival time for the communication flows and the
forwarding packets: Flow IAT Mean/Std/Max/Min and Fwd IAT To-
tal/Mean/Std/Max/Min
At this point, the dataset is still labeled with eleven different attacks. However,
analyzing the dataset it can observe that there exist some attacks with several sub-
types, but globally these represent a single attack e.g. DoS Hulk, DoS Goldeneye,
and DoS Slowloris can be represented as a DoS attack. The difference between them
is the script that generates them. Moreover, some attacks such as Heartbleed, Infil-
tration, and Botnet have irrelevant representation in the dataset as they have less
than 0.01% of total dataset size so the associated records are excluded from the
analysis of this work. After filtering and grouping procedure, the attacks were thus
classified in the seven classes as shown in Table 2.
(a) Histogram before balancing procedure (b) Histogram after balancing procedure
Fig. 3. Data balancing result per each traffic label.
When a histogram is generated to see how many records belong to each label, it
becomes evident that the data is unbalanced as shown in Fig. 3a. In order to balance
the amount of data per attack, the type with the fewest number of records is taken
into account as a reference to others. Thus, Web Attack with a total of 2.1 thousand
records is selected to limit the number of data records per attack class. Then, from
each class, a random sample of the same amount of records is taken, so a new dataset
is built with near 15 thousand records which contain the six types of attack and an
additional class for benign traffic. Balancing the data allows avoiding bias in the
training of a neural network, in this case, the ResNet-50 CNN. The result of balanc-
ing the number of records per attack is shown in Fig. 3b.
For dataset normalization, it is considered that the range between maximum and
minimum values in some features is too large and needs some preprocessing. First,
we apply a logarithmic function to shorten the range. Note that all features are in
the positive domain because their measures are related to lengths, time, or
quantities. However, zero value is possible. Therefore, before applying the
logarithmic function, a unit is added to all values. The next step is to perform a
linear normalization using the Equation (2).
𝑥 ′ −min(𝑥 ′ )
𝑥𝑖′′ = max(𝑥
𝑖 𝑖
′ )−min(𝑥 ′ ) (2)
𝑖 𝑖
where xi’ = ln(xi + 1) and xi’’ is the normalized value. With this normalization, all
features in the dataset are compressed to a range from 0 to 1. When a descriptive
analysis is performed separating the benign from the malign traffic (i.e., grouping
all attacks in one unique class) the result shows that attacks typically have more
packets sent but fewer packets received which is to be expected in attacks such as
a DoS attack. Also, the total size of packets sent shows that in the attacks there is
greater variability towards values closer to zero. These considerations are key for
11
(a) Intervals for one-hot encoding. (b) Binary to decimal map for
constructing an 8*8 matrix.
Fig. 4. Encoding procedure performed on each data record.
Each record of the cleansed and normalized dataset is converted in an 8*8 image
with 8 bit depth in concordance with the method presented in [10]. Thus, 20
intervals are set for encoding the values of the features using one-hot encoding as
shown in Fig. 4a, i.e. each normalized value of 24 features or metrics is considered
as a symbol that is encoded into a word of 20 bits. Once this is applied to each record
of the normalized traffic dataset, the result is a new binary dataset with 480 columns.
Considering the target dimensions of the image, 32 columns with zero values are
added to dataset to complete 512 columns. After that, an 8*8 matrix is constructed
using a binary to decimal conversion each 8-bits in the record as shown in Fig. 4b.
It is important to have in mind that the same procedure is applied to all data records
in the cleansed dataset to generate an image bank with six types of attack and also
being traffic.
Then, the decimal values in the matrix are converted to an image using a
grayscale conversion with 8 bits of depth. With this method, for each class of attack
in the dataset, at least two thousand images are obtained to be used as input of the
deep learning model. An example of the resulting images for some data records is
shown in Fig. 5. Since the ResNet50 has 224*224 RGB images as input, an image
scaling method is applied, as well as a summer type color map. This ensures that
the images meet the ResNet50 entry conditions.
respectively. In this sense, four groups (TP, TN, FP, and FN) are considered to
categorize the output of the hybrid model. If the detection result of the hybrid model
is an attack for testing data, and the detection result is correct then the result is TP,
i.e. the model has detected and classified appropriately the attack; TN indicates that
the detection result of the model is positive and correct, i.e. benign traffic is not
detected as an attack; FP means that the model predicts the data as an attack, but the
detection result is incorrect, i.e. the benign traffic is detected as attack; FN indicates
that the model predicts the data as benign traffic, but the detection result is
erroneous, i.e. attack traffic is classified as benign traffic. As can be seen in the
Equation (3), accuracy (AC) represents the probability that the samples are correctly
classified by the hybrid model with respect to the total number of samples.
𝑇𝑃+𝑇𝑁
𝐴𝐶 = TP+TN+FP+FN (3)
The Fig. 6. shows that our model can achieve 86.7% detection accuracy in the
case of benign traffic (B), 95.3% in the DoS (A2) case, 96.8% for Web Attack (A6),
and 97.5% for SSH Patator (A5) when it is applied to a contemporary dataset such
B A1 A2 A3 A4 A5 A6
B 86.7% 2.6% 3.7% 0% 3.0% 1.2% 2.8%
A1 0% 100% 0% 0% 0% 0% 0%
A2 3.7% 0% 95.3% 0.2% 0% 0.2% 0.6%
A3 0% 0% 0% 99.7% 0% 0% 0.3%
A4 0% 0% 0% 0% 99.7% 0% 0.3%
A5 0.8% 0.5% 0.3% 0.3% 0% 97.5% 0.6%
A6 1.9% 0% 0.8% 0% 0% 0.5% 96.8%
13
In this work, a hybrid intrusion detection model was implemented using a deep
learning framework in combination with traditional machine learning techniques on
a modern dataset. Our approach uses Convolutional Neural Networks (CNN) to
perform feature extraction of traffic patterns, and classification using Support
Vector Machines (SVM) to identify the type of attack. Experimental results
demonstrated that it is possible to use image processing techniques to characterize
network traffic in order to detect anomalies related to intrusion attacks.
Moreover, with the proposed hybrid approach, it was possible to obtain a global
accuracy of 96.53% and more than 99% accuracy in the recognition of attacks such
as DDoS, FTP-Patator, and PortScan. Compared with previous works, the global
precision reaches similar values in the recognition of attacks with the advantage that
it was tested to a contemporary dataset that contemplates several types of behavior
in network traffic. Therefore, the combination of deep learning techniques can be
considered an interesting strategy to improve the effectiveness of intrusion detection
systems.
An intrusion detection that is not applied to a real environment does not show
its true functionality to protect a network. For this reason, in future work the
deployment of the proposed hybrid model in some network environment either real
or simulated will be carried out. Also, some attacks can be included in the approach
such as zero-day attacks. The aim is to build a zero-day attack system and retrain
the proposed approach to detect it. Last, new techniques to create images from the
dataset (e.g. RGBA) and other classifiers models (e.g. K-Nearest Neighbors (KNN)
or Random Forest (RF)) can be considered to address a new comparative study with
the proposed model and other contemporary datasets (e.g. UNSW-NB15 or
BOUN).
References
1. Akiba, T., Suzuki, S., Fukuda, K.: Extremely Large Minibatch SGD: Training ResNet-
50 on ImageNet in 15 Minutes. In: 2017 Conference on Neural Information Processing
Systems. NIPS (2017)
2. Basly, H., et al.: Cnn-svm learning approach based human activity recognition. In: Image
and Signal Processing. pp. 271-281. Springer (2020)
3. Bianco, S., et al.: Benchmark analysis of representative deep neural network
architectures. IEEE Access 6(4), 64270-64277 (2018)
4. Chiba, Z., et al.: Intelligent approach to build a Deep Neural Network based IDS for cloud
environment using combination of machine learning algorithms. Computers and Security
86, 291-317 (2019)
5. Chih-Fong, T., et al.: Intrusion detection by machine learning: A review. Expert Systems
with Applications 36, 11994-12000 (2009)
6. Ferrag, M.A., et al.: Deep learning for cyber security intrusion detection: Approaches,
datasets, and comparative study. Journal of Information Security and Applications 50,
102419 (2020)
15
7. Gu, J., et al.: A novel approach to intrusion detection using SVM ensemble with feature
augmentation. Computers and Security 86, 53-62 (2019)
8. Jonsson, P., et al.: Ericsson Mobility Report June 2021. Tech. rep., Ericsson (2021)
9. Kuang, F., Xu, W., Zhang, S.: A novel hybrid kpca and svm with ga model for intrusion
detection. Applied Soft Computing 18, 178-184 (2014)
10. Li, Z., et al.: Intrusion detection using convolutional neural networks for representation
learning. In: Lecture Notes in Computer Science (LNCS). pp. 858-866. Springer Verlag
(2017)
11. Ludwig, S.A.: Intrusion detection of multiple attack classes using a deep neural net
ensemble. In: 2017 IEEE SSCI. pp. 1-7. IEEE (2017)
12. Mell, P., Grance, T.: The NIST Definition of Cloud Computing (2011),
https://csrc.nist.gov/publications/detail/sp/800-145/final
13. Mohammed, M., Pathan, A.S.K.: Intrusion Detection and Prevention Systems (IDPSs).
In: Automatic Defense Against Zero-day Polymorphic Worms in Communication
Networks, chap. 3, pp. 47-84. Auerbach Publications, 2 edn. (2013)
14. Rafter, D.: Cyberthreat trends: 2019 cybersecurity threat review (2019)
15. Rhode, M., Burnap, P., Jones, K.: Early-stage malware prediction using recurrent neural
networks. Computers and Security 77, 578-594 (2018)
16. Sharafaldin, I., et al.: Toward generating a new intrusion detection dataset and intrusion
traffic characterization. In: ICISSP 2018 - 4th International Conference on Information
Systems Security and Privacy. pp. 108-116 (2018)
17. Smys, S., Basar, A., Wang, H.: Hybrid intrusion detection system for internet of things
(iot). Journal of ISMAC 2(4), 190-199 (2020)
18. Stallings, W.: Network security essentials: applications and standards. Pearson
Education, 6 edn. (2017)
19. Tao, W., et al.: A Network Intrusion Detection Model Based on Convolutional Neural
Network. In: Security with Intelligent Computing and Big-data Services. pp. 771-783.
Springer (2020)
20. Tavallaee, M., et al.: A detailed analysis of the KDD CUP 99 data set. In: IEEE
Symposium on Computational Intelligence for Security and Defense Applications,
CISDA 2009. pp. 1-6. IEEE (2009)
21. Toldinas, J., et al.: A novel approach for network intrusion detection using multistage
deep learning image recognition. Electronics 10(15) (2021)
22. Wu, Z.,Wang, J., Hu, L., Zhang, Z.,Wu, H.: A network intrusion detection method based
on semantic re-encoding and deep learning. Journal of Network and Computer
Applications 164, 102688 (2020)
23. Xiao, Y., et al.: An intrusion detection model based on feature reduction and
convolutional neural networks. IEEE Access 7, 42210-42219 (2019)
24. Yin, C., et al.: A Deep Learning Approach for Intrusion Detection Using Recurrent
Neural Networks. IEEE Access 5, 21954-21961 (2017)
25. Zhang, Y., et al.: A network intrusion detection method based on deep learning with
higher accuracy. Procedia Computer Science 174, 50-54 (2020)