Transfer learning based intrusion detection in 5G and IoT networks
Abstract
Development of a transfer learning system for the detection of cyber-attacks in 5G and IoT networks. Transfer learning will improve the accuracy and precision of cyber-attacks detection in 5G /IoT networks with limited computing capability and datasets with scarce labeled data. First, existing datasets for IoT networks will be studied to choose the best option for the source and target domains. Then, DL and transfer learning methods will be analyzed to choose the more adequate for the system. Finally, the system will be developed.
Full text
Transfer Learning Based Intrusion Detection in 5G and IoT Networks A Degree Thesis Submitted to the Faculty of the Escola Tècnica d'Enginyeria de Telecomunicació de Barcelona Universitat Politècnica de Catalunya by Pol Valls Balfagón In partial fullment of the requirements for the degree in Telecommunications Technologies and Services Engineering Advisor Eva Rodríguez Barcelona, June 2022
Abstract The widespread use of smart devices has dramatically increased the number of cyberattacks on the Internet of Things (IoT) due to the security weaknesses on these networks. Detecting and classifying malicious trac is key to ensure the reliability of those systems, keeping them secure for their use. To solve this, Deep learning (DL) techniques have recently been proposed for enhancing the accuracy of network intrusion detection systems (NIDS). However, DL-based NIDS are dependent on the dataset in which they are trained, resulting ineective in the detection of new attacks (zero-day attacks) or even in the detection of known mutations and behaviour change attacks. In this work, we investigate the viability of Transfer Learning (TL), an approach that enables transferring learned features and knowledge from a trained source model to a target model with minimal new training data. We compare the performance of a NIDS model trained from scratch with a NIDS model trained using TL. The results demonstrate that TL enables detection models to perform much better at identifying new attacks, even when there is relatively less training data available. 1
Resum L'ús generalitzat de dispositius intel·ligents ha augmentat dràsticament el nombre d'atacs cibernètics a la Internet of Things (IoT) a causa de les debilitats de seguretat d'aquestes xarxes. Detectar i classicar el trànsit maliciós és clau per garantir la abilitat d'aquests sistemes, mantenint-los segurs per al seu ús. Per solucionar-ho, recentment s'han proposat tècniques d'aprenentatge profund per millorar la precisió dels sistemes de detecció d'intrusions en xarxa (NIDS). No obstant, els NIDS basats en DL depenen del conjunt de dades en el que són entrenats, resultant inecaços en la detecció de nous atacs (zero-day attacks) o incús en la detecció de mutacions conegudes i atacs que canvien de comportament. En aquest treball, investigarem la viabilitat de Transfer Learning (TL), un enfocament que permet transferir característiques i coneixements apresos d'un model font entrenat a un model objectiu amb dades d'entrenament noves mínimes. Compararem el rendiment d'un model entrenat des de zero amb un model entrenat amb TL. Els resultats demostren que l’ús de TL millora la detecció d’atacs no coneguts, inclús quan no es disposa de grans volums de dades per a l’entrenament. 2
Resumen El uso generalizado de dispositivos inteligentes ha incrementado drásticamente el número de ciberataques en el Internet (IoT) debido a las debilidades de seguridad de estas redes. Detectar y clasicar el tráco malicioso es clave para garantizar la abilidad de esos sistemas, manteniéndolos seguros para su uso. Para solucionar esto, recientemente se han propuesto técnicas de aprendizaje profundo (DL) para mejorar la precisión de los sistemas de detección de intrusiones en redes (NIDS). Sin embargo, los NIDS basados en DL dependen del conjunto de datos en el que son entrenados, resultando inecaces en la detección de nuevos ataques (ataques de día cero) o incluso en la detección de mutaciones conocidas y ataques de cambio de comportamiento. En este trabajo, investigaremos la viabilidad del Transfer Learning (TL), un enfoque que permite transferir las características y los conocimientos aprendidos de un modelo de origen entrenado a un modelo de destino con un mínimo de nuevos datos de entrenamiento. Compararemos el rendimiento de un modelo NIDS entrenado desde cero con un modelo NIDS entrenado mediante TL. Los resultados demuestran que el uso de TL mejora la detección de ataques no conocidos, incluso cuando no se dispone de grandes cantidades de datos para el entrenamiento. 3
This thesis work is dedicated to my family and many friends. A special feeling of gratitude to my parents, Jordi and Montse, who have always loved me unconditionally and whose good examples have taught me to work hard for the things that I aspire to achieve. My brothers Nil and Jan have never left my side and are very special. They have been a constant source of support and encouragement during the challenges of graduate school and life. I also dedicate this thesis to my many friends who have supported me throughout the process. I will always appreciate all they have done, especially Víctor for accompanying me and helping me throughout the whole career, Biel for his fantastic advice and constant support, and Ariadna for constantly helping and encouraging me to achieve my goals. 4
Acknowledgements I would like to express my deepest gratitude to my project supervisor, Eva Rodríguez, who guided me throughout this project and for her invaluable feedback and support. I would also like to thank my friends and family who supported me and oered deep insight into the study. 5
Revision history and approval record Revision Date Purpose 0 13/03/2022 Document creation 1 10/05/2022 Document revision 2 02/06/2022 Document revision Document Distribution List Name e-mail Pol Valls Balfagón [email protected] Eva Rodríguez Luna [email protected] Written by: Reviewed and approved by: Date 13/03/2022 Date 15/06/2022 Name Pol Valls Name Eva Rodríguez Position Project Author Position Project Supervisor 6
Table of contents 1. Introduction 10 2. Review of the Literature 12 2.1 Fundamentals 12 2.1.1 Convolutional Neural Networks (CNN) 12 2.1.2 Transfer Learning (TL) 13 2.1.3 Validation and Evaluation 14 2.2 State of the Art 16 2.2.1 IoT Datasets 16 2.2.1.1 BoT-IoT Dataset 16 2.2.1.2 UNSW-NB15 Dataset 17 2.2.2 Related work 18 3. Project development 19 3.1 Development environment 19 3.2 Domain and target set 19 3.3 10% BoT-IoT Dataset 20 3.4 UNSW-NB15 sub-datasets generation 20 3.5 Preprocessing 24 3.6 Model structure 26 3.7 Methodology 28 4. Results 30 4.1 Evaluate the IDS model 30 4.2 Model evaluation on new data 31 4.3 Evaluation of TL based solution – Updated model 33 5. Budget 37 6. Conclusions 38 6.1 Future development 38 Bibliography 39 Glossary 40 7
List of Figures Figure 1 Work Plan 11 Figure 2 Gantt Diagram of the project 11 Figure 3 Graphical Representation of a Convolutional Neural Network 12 Figure 4 The idea of Transfer Learning 13 Figure 5 Confusion Matrix structure of a binary classier 14 Figure 6 TL-CNN Training Platform 19 Figure 7 10% BoT-IoT category attack distribution 20 Figure 8 UNSW-NB15-Basic sub-dataset category attack distribution 21 Figure 9 UNSW-NB15-Test+ sub-dataset category attack distribution 21 Figure 10 UNSW-NB15-Test sub-dataset category attack distribution 22 Figure 11 Data Preprocessing Steps 25 Figure 12 CNN-B model structure 26 Figure 13 CNN-TL model structure 27 Figure 14 Methodology diagram block 29 Figure 15 Loss and accuracy function evaluating the IDS model CNN-B 30 Figure 16 IDS Model CNN-B Confusion Matrix 30 Figure 17 Loss and accuracy function evaluating the model on new data with NON-TL 31 Figure 18 Attack type detection in UNSW-NB15-Test+ dataset 32 Figure 19 Confusion Matrix comparison using NON-TL and TL in UNSW-NB15-Test+ 34 Figure 20 Confusion Matrix comparison using NON-TL and TL in UNSW-NB15-Test 35 8
FPR represents the ratio of items incorrectly classied (attack or normal) in the sixth equation, and F1-score is the weighted harmonic mean of precision and recall in Equation 7. 𝐹𝑃𝑅 = 𝐹𝑃 𝑇𝑁 + 𝐹𝑃 (6) 𝐹1𝑠𝑐𝑜𝑟𝑒=2*𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛*𝑅𝑒𝑐𝑎𝑙𝑙 𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 + 𝑅𝑒𝑐𝑎𝑙𝑙 (7) 15
2.2. State of the Art 2.2.1. IoT Datasets This work is focused on building a model capable of detecting and classifying dierent IoT cyber-attacks (known, variations and unknown families). The, we will focus on two datasets in the IoT eld called Bot-IoT and UNSW-NB15. That is why this framework will be able to detect cyber-attacks, in general, in IoT environment. More specically, we will use the dataset called UNSW-NB15 to evaluate the behaviour of the model created with the Bot-IoT dataset against new attacks using Transfer Learning. Table 1 describes the main characteristics of the two datasets. Dataset Number of samples Attacks/Normal (%) Dierent category attack Bot-IoT 73,000,000 99/1% 4 UNSW-NB15 2,540,044 13/87% 9 Table 1 Datasets Structure The BoT-IoT dataset, is used in the source domain, since it is a large IoT network activity dataset. While, the UNSW-NB15 dataset is used in the target domain, since it has scarce labelled data, with IoT network trac that comprises modern and contemporary cyber-attacks. 2.2.1.1. BoT-IoT Dataset The Bot-IoT dataset [4] was developed in a testbed consisting of multiple virtual machines with various operating systems, network rewalls, network taps, the Node-red tool, and the Argus network security tool. Bot-IoT is composed of multiple sets and subsets that are dierent in le format, size, and feature count. The rst set is composed of 70 GB of packet capture (Pcap) les, which contain the information captured on the testbed environment, being Pcap les, they have to be treated with frameworks such as Argus or Wireshark. The second set is known as Full Set, which contains comma-separated values (CSV) les, totalling 73 million records of network activity in a simulated IoT environment, including both normal trac ows and several cyber-attack trac ows. Category Records Description Normal 9,543 Natural transaction data. DoS 38,532,480 A malicious attempt to make a server or a network resource unavailable to users, usually by temporarily interrupting or suspending the services of a host connected to the Internet. DDoS 33,005,194 A malicious attempt to disrupt the normal trac of a given server, service, or network by overloading the target or its associated 16
Category Records Description infrastructure with a ood of Internet trac. Reconnaissance 1,821,639 Contains all strikes that can simulate attacks that gather information. Information Theft 1,587 Theft of personal user information. Table 2 BoT-IoT dataset description 2.2.1.2. UNSW-NB15 Dataset The UNSW-NB15 dataset [5] was created by the IXIA PerfectStorm tool in the Cyber Range Lab of UNSW Canberra for generating a hybrid of real modern normal activities and synthetic contemporary attack behaviours. Tcpdump tool is utilized to capture 100 GB of the raw trac (e.g., Pcap les). The Argus, Bro-IDS tools are utilized, and twelve algorithms are developed to generate a total of 49 features with the class label. It has a total of 2,540,044 records which are stored in 4 dierent CSV les. The major categories of the records are normal and attack. The attack records are further classied into nine families according to the nature of the attacks. The distribution between normal trac and attacks is 87/13%. Attack Type Records Description Normal 2,218,764 Natural transaction data. Fuzzers 24,246 Attempting to cause a program or network suspended by feeding it the randomly generated data. Analysis 2,677 It contains dierent attacks of port scan, spam, and HTML les penetrations. Backdoors 2,329 A technique in which a system security mechanism is bypassed stealthily to access a computer or its data. DoS 16,353 A malicious attempt to make a server or a network resource unavailable to users, usually by temporarily interrupting or suspending the services of a host connected to the Internet. Exploits 44,525 The attacker knows of a security problem within an operating system or a piece of software and leverages that knowledge by exploiting the vulnerability. Generic 215,481 A technique works against all blockciphers (with a given block and key size), without consideration about the structure of the block-cipher. Reconnaissance 13,987 Contains all strikes that can simulate attacks that gather information. Shellcode 1,511 A small piece of code used as the payload in the exploitation of software vulnerability. Worms 174 The attacker replicates itself in order to spread to other computers. Often, it uses a computer network to spread itself, relying on security failures on the target computer to access it. Table 3 UNSW-NB15 dataset description 17
2.2.2. Related work Deep learning (DL) techniques have recently been proposed for enhancing the accuracy of network intrusion detection systems (NIDS). However, keeping the DL based detection models up to date requires large amounts of new labelled training data, which is often expensive and time-consuming to collect. Singla et al. (2019) [6] investigate the viability of transfer learning (TL), an approach that enables transferring learned features and knowledge from a trained source model to a target model with minimal new training data. They compare the performance of a NIDS model trained using TL with a NIDS model trained from scratch. They show that TL enables detection models to perform much better at identifying new attacks when there is relatively less training data available. They generate dierent sub-datasets from the UNSW-NB15 dataset [7], one for each type of attack, a total of 9 dierent sub-datasets for the TL analysis. In this work, the same UNSW-NB15 is used as source domain, but when generating the sub-datasets for each type of attack, the rest of the records that are not that type of attack are put in the source domain. In our case we propose to use the BoT-IoT as source dataset, we use the records of another dataset dierent from the target domain. The results show that TL is eective in reducing the amount of labelled data required for training NN models for NIDS. This allows for quick, easy and ecient training of NN models to detect new attacks and malware. Hui et al. (2019) [8] propose a ConvNet model using transfer learning for network intrusion detection. The model consists of two concatenated ConvNets and is built on a two-stage learning process: learning a base dataset and transferring the learned knowledge to the learning of the target dataset. They use UNSW-NB15 as domain set and NSL-KDD [9] as target set, from the NSL-KDD dataset they create one with mostly known attacks and another with many novel attacks. Their experiments on the NSL-KDD dataset show that the proposed model can improve the detection accuracy not only on the test dataset containing mostly known attacks (KDDTest+) but also on the test dataset featuring many novel attacks (KDDTest-21). About 2.68% improvement on KDDTest+ and 22.02% on KDDTest-21 can be achieved, as compared to the traditional CNN model. We propose to use two datasets for validation of the model, the sub-dataset generated for us, UNSW-NB15-Test+ with 100% new attacks and the complete UNSW-NB15 dataset called as UNSW-NB15-Test, which contains 9.63% of new attacks compared to the training dataset. This way we will see how our model performs in front of new attacks in Test+ and in a more realistic case with a lower percentage of novel attacks. 18
3. Project development 3.1. Development environment The evaluation platform is built on the Lenovo IdeaPad 320-15IKB with Intel ® Core ™ i7-8850U CPU @ 1.80 GHz processor and 8.0 GB RAM. The CNNs models are implemented using the TensorFlow backend [10], and the frontend Keras [11] and Pandas, Scikit-learn packages. The project code is uploaded and available in the following GitHub repository [12]: github.com/polvalls9/Transfer-Learning-Based-Intrusion-Detection-in-5G-and-IoT-Networks 3.2. Domain and target set In order to apply the TL, a domain set and a target set must be established. The domain set will be the dataset that will be taken as a base and the model that will be trained rst; this is usually a large dataset, with many records, in a similar domain as the target set, that is with IoT network records containing normal trac and attacks. On the other hand, the target dataset will be where the TL is to be applied, the dataset is usually small and with fewer registries. The previously trained model is used, the convolutional base of the pretrained model is frozen and trained. Because of this, in this work, we will use the BoT-IoT dataset as the domain set and the UNSW-NB15 dataset as the target set. Figure 6 TL-CNN Training Platform 19
3.3. 10% BoT-IoT Dataset The original dataset has a volume of 73 million records, to make a more portable version and balance a little bit the dataset, we have generated a new dataset from the BoT-IoT dataset, the result is a sub-dataset containing 10% of the Full Set, obtaining a total of approximately 6 million records. To generate it, we have taken into account all the normal trac of the complete dataset and the Reconnaissance and Information Theft attacks. Since the original dataset contained about 30 million records of DoS and DDoS attacks, it has been decided to select fewer samples of these two types of attacks, taking two million records of these two types of attacks, in order to generate a slightly more balanced dataset in terms of the proportion of attacks and normal trac and the proportion of dierent attacks. The distribution between normal trac and attacks is 99.84/0.16%, the distribution of the dataset can be seen in more detail in Figure 7. Figure 7 10% BoT-IoT category attack distribution 3.4. UNSW-NB15 sub-datasets generation As explained in the previous section, the UNSW-NB15 will be the target dataset to apply the TL. To test the eectiveness of the solution in terms of detection of new attacks (zero-day attacks), 4 sub-datasets are generated. The idea is to generate one sub-dataset for training purposes, and the other three for testing, one which will include attacks already known by the system, that is the attacks considered in the training sub-dataset, and the other testing sub-dataset with attacks dierent from the training sub-dataset, that is, new attacks. The generated sub-datasets are named as follows: UNSW-NB15-Train-Basic, UNSW-NB15-Test-Basic, UNSW-NB15-Test+ and UNSW-NB15-Test. To generate the rst two datasets, the UNSW-NB15-Basic dataset is created, which contains normal trac and the DoS, exploits, generic and reconnaissance attacks. The result is an unbalanced sub-dataset, it has many more normal records than attacks, exactly there is an 20
87.58% of normal trac and 12.42% of attacks. Thus, we balance it to get a 50/50% attack/normal. Figure 8 shows the nal result after balancing the sub-dataset. Figure 8 UNSW-NB15-Basic sub-dataset category attack distribution From the sub-dataset UNSW-NB15-Basic, we generate the sub-datasets for training and testing with a ratio of 75/25 %, so from this partition the sub-datasets UNSW-NB15-Train-Basic and UNSW-NB15-Test-Basic are generated. The following sub-dataset, UNSW-NB15-Test+, is intended to incorporate new attacks, namely, attacks not seen by the previous two sub-datasets. The UNSW-NB15-Test+ sub-dataset contains normal trac and the fuzzers, analysis, backdoor, shellcode and worms attacks. As before, the sub-dataset was unbalanced and is balanced at 50/50% attacks/normal trac. Figure 9 UNSW-NB15-Test+ sub-dataset category attack distribution The remaining sub-dataset, UNSW-NB15-Test, is intended to incorporate known attacks and zero-day attacks, this sub-dataset is constructed using the full UNSW-NB15, then balanced so that the dataset contains 50% attacks and 50% normal trac, leaving all the attacks that the dataset originally contained and discarding normal trac for balancing. 21
Figure 10 UNSW-NB15-Test sub-dataset category attack distribution In Table 4 and Table 5, it can be seen in summary mode more detailed descriptions of the generated sub-datasets, such as their volume and percentage. UNSW-NB15-Train-Basic UNSW-NB15-Test-Basic Name Records % Name Records % Normal 217,552 49.95 Normal 72,794 50.14 Generic 161,865 37.17 Generic 53,616 36.93 Exploits 33,408 7.67 Exploits 11,117 7.66 DoS 12,196 2.80 DoS 4,157 2.86 Reconnaissance 10,498 2.41 Reconnaissance 3,489 2.40 Table 4 UNSW-NB15-Basic sub-datasets description 22
UNSW-NB15-Test+ UNSW-NB15-Test Name Records % Name Records % Normal 30,937 50.00 Normal 321,283 50.00 Fuzzers 24,246 39.19 Fuzzers 24,246 3.77 Analysis 2,677 4.33 Analysis 2,677 0.42 Backdoor 2,329 3.76 Backdoors 2,329 0.36 Shellcode 1,511 2.44 DoS 16,353 2.54 Worms 174 0.28 Exploits 44,525 6.93 Generic 215,481 33.53 Reconnaissance 13,987 2.18 Shellcode 1,511 0.24 Worms 174 0.03 Table 5 UNSW-NB15-Test+ and UNSW-NB15-Test sub-datasets description Table 6 shows the summary statistics of the datasets that we will use in the dierent experiments. Dataset Normal Attack % Attack % Novel attack BoT-IoT 9,543 5,823,226 99.84 % - UNSW-NB15-Basic-Train 217,800 217,719 49.99 % - UNSW-NB15-Basic-Test 72,546 72,627 50.02 % 0.00 % UNSW-NB15-Test+ 30,937 30,937 50.00 % 100.00 % UNSW-NB15-Test 321,283 321,283 50.00 % 50.00 % Table 6 Datasets statistics 23
3.5. Preprocessing The two datasets considered in the framework, BoT-IoT and UNSW-NB15, have dierent elds. The BoT-IoT has 46 features, while the UNSW-NB15 has 49. In order to apply the TL correctly, the models have to be trained with the same input shape and with the same features. Then, we select the features that the two datasets have in common. Then, for the training of the model, we will use a total of 14 features. Table 7 describes them. Feature Type Description Proto Nominal Textual representation of transaction protocols present in network ow Saddr Nominal Source IP address Sport Integer Source port number Daddr Nominal Destination IP address Dport Integer Destination port number Spkts Float Source-to-destination packet count Dpkts Float Destination-to-source packet count Sbytes Float Source-to-destination byte count Dbytes Float Destination-to-source byte count State Nominal Transaction state Stime Timestamp Record start time Ltime Timestamp Record last time Dur Float Record total duration Attack Binary Class label: 0 for Normal trac, 1 for Attack Trac Table 7 Selected features description The preprocessing of the datasets results as follows. First of all, since the ‘proto’ and ‘state’ elds are strings, we are going to use the One Hot Encoding (OHE) method to transform these elds to numeric format. The two datasets have dierent types of values in the two features, then when doing the OHE the number of columns generated would not coincide, therefore, we choose the values that the two datasets have in common. In the case of BoT-IoT it has a total of 44 features, and UNSW-NB15 has a total of 47 features, in both cases 14 features are selected, approximately 30% of the features available in both datasets are used, in fact half of these features are considered to be the best features according to the dataset creators. In the case of ‘proto’ we choose the type [tcp, udp, icmp, igmp, arp] and in state we select the values [RST, REQ, INT, FIN, CON, ECO, ACC, PAR]. 24
Trac Detection Rate % Detected Samples Non-detected Samples Model Statistics Normal 99.32 % 9,381 64 Accuracy 99.99 % Precision 99.99 % Recall 99.99 % FPR 0.001 % F1-Score 99.99 % DDoS 100.00 % 1,999,989 0 DoS 100.00 % 1,999,980 0 Reconnaissance 99.99 % 1,791,216 94 Theft 99.50 % 1,579 8 Table 10 IDS Model CNN-B Evaluation Results in BoT-IoT dataset 4.2. Model evaluation on new data In this experiment, we will see how capable the IDS-Base model is of detecting zero-day attacks. We will do two tests, in the rst one we will use as training dataset the UNSW-NB15-Train-Basic and as testing dataset the UNSW-NB15-Test-Basic, in this way we will see the detection capacity of the model in front of already known attacks. Consecutively, we will use as testing dataset the UNSW-NB15-Test+, which contains attacks dierent from the considered in the training set, in this way we will be able to observe the detection capacity against zero-day attacks. The results in Figure 17 show that the model is not able to correctly detect new attacks, both accuracy and loss diverge more and more as the training epochs increase. This is reected in the model, as it has an accuracy of 99.25% in the rst case, and an accuracy of 71.85% in the second test. In order to see the ability to detect new attacks, we have analysed the results of testing with Test+ in more depth, as shown in Figure 18 and Table 11. It can be seen that normal trac is highly detected, but attacks, especially analysis and backdoor attacks, have a very low detection rate, 18.33 % and 28.57% respectively. The FPR is 63.64%, which means that much of the attacks are detected as normal trac. The overall results are not good, in the next section we will see if the use of TL can improve them. Figure 17 Loss and accuracy function evaluating the model on new data with NON-TL 31
Figure 18 Attack type detection in UNSW-NB15-Test+ dataset Trac Detection Rate % Detected Samples Non-detected Samples Model Statistics Normal 99.65 % 30,763 108 Accuracy 71.85 % Precision 80.77 % Recall 71.85 % FPR 63.64 % F1-Score 68.14 % Analysis 18.33 % 114 508 Backdoor 28.57 % 102 255 Fuzzers 34.13 % 7,343 14,174 Shellcode 74.85 % 1,131 380 Worms 59.20 % 103 71 Table 11 Attack detection in UNSW-NB15-Test+ dataset with NON-TL Once the detection of unknown attacks has been seen, a validation will be performed on the UNSW-NB15 dataset to see the detection capability for new attacks (zero-day attacks) and attacks already known by the model. Looking at Table 12 we can see that the behaviour is very similar to the previous case, but we can see that the attacks already known by the model, i.e., attacks contained in the train and test dataset, have in general a higher detection rate, as is the case of generic, exploits, reconnaissance and DoS. Due to the poor detection of zero-day attacks, the model has an accuracy of 98.26%, which is a considerable improvement over the previous result of 71.85% with only zero-day attacks. Looking at the metrics of the model, as the F1-Score, it can be seen that it is a model that perform correctly, but it can be improved, it has a score of 98.26%. Therefore, when there is a combination of known and unknown attacks, the model's metrics improve slightly, but there is still potential for improvement. 32
Trac Detection Rate % Detected Samples Non-detected Samples Model Statistics Normal 98.97 % 317,295 3,288 Accuracy 98.26 % Precision 98.27 % Recall 98.26 % FPR 2.55 % F1-Score 98.26 % Analysis 97.91 % 609 13 Backdoor 81.79 % 292 65 Fuzzers 72.61 % 15,624 5,893 Shellcode 99.40 % 1,502 9 Worms 93.10 % 162 12 Generic 99.90 % 213,511 207 Exploits 98.18 % 27,802 515 Reconnaissance 97.68 % 11,579 275 DoS 94.75 % 3,660 203 Table 12 Attack detection in UNSW-NB15-Test dataset summary with NON-TL 4.3. Evaluation of TL based solution – Updated model In this last experiment, but the most important, we want to demonstrate that the use of TL helps to detect zero-day attacks, so we will perform two tests. In the rst one we will use as training dataset the UNSW-NB15-Train-Basic and for testing the UNSW-NB15-Test+, which only contains new attacks, but this time applying the TL. In the second experiment we will use the same training dataset, but for testing we will consider the UNSW-NB15-Test dataset comprising known and zero-day attacks. The results in the rst experiment show an improvement in the detection of all dierent types of new attacks, as can be seen in Figure 19. The use of TL has allowed the detection of almost all zero-day attacks, exactly 99.96% of attacks are detected compared to 57.43% previously, while detection of normal trac has decreased from 99.58% to 98.30%. We would like to highlight the detection of analysis and backdoor attacks, as they had a detection rate of approximately 20% and when applying the TL they have a detection rate of 100%, which is a huge improvement. Normal trac is detected slightly worse due to the fact that the pre-training is done with the BoT-IoT dataset, which is basically made up of attacks as it has a very small percentage of normal trac. 33
Figure 19 Confusion Matrix comparison using NON-TL and TL in UNSW-NB15-Test+ Trac Detection Rate % Detected Samples Non-detected Samples Model Statistics Normal 98.34 % 30,358 513 Accuracy 99.04 % Precision 99.06 % Recall 99.04 % FPR 0.05 % F1-Score 99.05 % Analysis 100.00 % 622 0 Backdoor 100.00 % 357 0 Fuzzers 99.95 % 21,507 10 Shellcode 99.93 % 1,510 1 Worms 98.85 % 172 2 Table 13 Attack detection in UNSW-NB15-Test+ dataset summary using TL Once the nal model has been built by applying the TL, it is validated on the same model using the UNSW-NB15 dataset, to evaluate the detection of known and unknown cyber-attacks. Figure 20 and Table 14 show the results of testing the model on the complete dataset, the UNSW-NB15-Test. The results are promising, most of the attacks have a detection rate that is close to 100%, only worms and DoS attacks have a detection rate a little lower than the rest. If we compare this results with the obtained when not using TL, we can see that the detection rate for all the dierent families of zero-day attacks have improved, for example the fuzzers and backdoor attacks have improved by 27% and 17% respectively. The detection of normal trac has not undergone signicant changes, it has worsened by 0.40%, thus obtaining a detection rate of 98.54%, despite the small decrease, it is still a fairly high detection. The metrics obtained from the model are very good, the accuracy, recall and F1-Score are approximately 99.20%, the FPR is 0.06%. It provides high eciency to the system, since very few attacks are detected as normal trac. 34
Figure 20 Confusion Matrix comparison using NON-TL and TL in UNSW-NB15-Test Trac Detected % Detected Samples No Detected Samples Model Statistics Normal 98.54 % 315,902 4,681 Accuracy 97.89 % Precision 99.20 % Recall 99.19 % FPR 0.06 % F1-Score 99.19 % Analysis 99.84 % 621 1 Backdoor 99.44 % 355 2 Fuzzers 99.79 % 21,472 45 Shellcode 99.93 % 1,510 1 Worms 98.85 % 172 2 Generic 99.98 % 213,678 40 Exploits 99.76 % 28,249 68 Reconnaissance 99.95 % 11,848 6 DoS 99.43 % 3,841 22 Table 14 Attack detection in UNSW-NB15-Test dataset summary using TL 35
The following table, Table 15, summarizes the detection rates obtained in all experiments, showing the increase in the detection rate generated by the use of TL in the detection of new attacks. The nal results are excellent, the attacks are detected almost perfectly and the increase in most cases exceeds 50% in the case of the UNSW-NB15-Test+ and close to 5% in the majority of cases in the UNSW-NB15-Test. Trac UNSW-NB15-Test+ UNSW-NB15-Test NON-TL TL DR Improve NON-TL TL DR Improve Normal 99.65 % 98.34 % -1.31 % 98.97 % 98.54 % -0.43 % Analysis 18.33 % 100.00 % 81.67 % 97.91 % 99.84 % 1.93 % Backdoor 28.57 % 100.00 % 71.73 % 81.79 % 99.44 % 17.65 % Fuzzers 34.13 % 99.95 % 65.82 % 72.61 % 99.79 % 27.18 % Shellcode 74.85 % 99.93 % 25.08 % 99.40 % 99.93 % 0.53 % Worms 59.20 % 98.86 % 39.66 % 93.10 % 98.85 % 5.75 % Generic 99.90 % 99.98 % 0.08 % Exploits 98.18 % 99.76 % 1.58 % Reconnaissance 97.68 % 99.95 % 2.27 % DoS 94.75 % 99.43 % 4.68 % Table 15 Attack detection rate improvement using TL in all datasets 36
5. Budget The realization of the project has required a long development task. An open source programming environment was used, using a workspace environment with VS Code, and TensorFlow as backend, and using Keras, Pandas and Scikit-learn packages in frontend. Therefore, the costs only include the time worked by the junior engineer, the computer where the development has been done and other costs like electricity. The cost related to the workforce come from the salary of a junior engineer proportional to four-hundred work hours. The duration of the project has been 5 months, where the working time of the junior engineer is 20 hours per week. The salary of the junior engineer is 12€/h, so the total salary is 4,800€. In addition, a computer was needed for the realization of the project, which has a cost of 800€. Other expenses, such as electricity and internet connection, are also added in Table 16, which shows the summary of the total budget. Item Cost Junior Engineer Salary 4,800 € Computer 800 € Software 0 € Electricity & Internet Connection 100 € TOTAL 5,700 € Table 16 Cost summary 37
6. Conclusions The aim of this thesis was the development of a Transfer Learning system for the detection of cyber-attacks in 5G and IoT networks, with an ultimate goal of achieving the highest possible detection of unknown (zero-day) attacks using the TL method. Of the four objectives set out in this project, we have successfully completed all of them. We began by researching the state of the art of datasets for intrusion detection in 5G/IoT networks, together with the study of dierent models with DL and the application of TL. Then, after applying the preprocessing and generating the dierent sub-datasets successfully, we built and evaluated the IDS model with DL, with which we obtained very good attack detection results, the model detected 99.99% of the known attacks. However, this model does not achieve good detection rates for unknown attacks, as it has an accuracy of 71.85% against these attacks. After seeing the poor results in detecting new attacks using DL techniques, TL has been applied and the results have been magnicent. Attacks that were not detected before, with the help of TL are detected almost perfectly, in exchange for a little loss of normal trac, a detection rate of at least 99% has been achieved for each type of attack, in some cases reaching 100% detection. Thus, the model is able to detect all types of trac, whether known or unknown, with high accuracy. After seeing the results obtained, it can be said that the objectives have been met successfully and with very promising results. Due to the successful results, an article on this work will be submitted in the leading international open access journal Sensors, where the improvement in the detection of unknown attacks in 5G and IoT networks will be discussed. 6.1. Future development The next steps we want to take involve improving the model performance: ●Apply the TL-based solution on another IoT dataset with dierent attacks to see if the model continues to work correctly. ●Use Data Augmentation techniques, trying to improve the results obtained by balancing the datasets with articial generated data. ●Evaluate the solution performance on lightweight IoT devices with real IoT network trac data. ●Study the development of a distributed TL-based system. 38
Bibliography [1] Roopak, M.; Yun Tian, G.; Chambers, J. Deep learning models for cyber security in IoT networks. In Proceedings of the 9th IEEE Annual Computing and Communication Workshop and Conference (CCWC), Las Vegas, NV, USA (7 Jan. 2019); 452–457. [2] Lotfollahi, M.; et al. Deep packet a novel approach for encrypted trac classication using deep learning. Soft Computing, Vol 14. 2019. pp, 1–14. [3] Yosinski, J.; et al. How transferable are features in deep neural networks?. Advances in Neural Information Processing Systems 2014, 27, 1–9. [4] BoT IoT Dataset. Available online: https://research.unsw.edu.au/projects/bot-iot-dataset (accessed on 27-05-2022). [5] UNSW-NB15 Dataset. Available online: https://research.unsw.edu.au/projects/unsw-nb15-dataset (accessed on 27-05-2022). [6] Singla, A.; Bertino, E.; Verma, D. Overcoming the Lack of Labeled Data: Training Intrusion Detection Models Using Transfer Learning. In Proceedings of the IEEE International Conference on Smart Computing (SMARTCOMP), Washington, USA (12 June 2019); 69–74. [7] Moustafa, N.; Slay, J. UNSW-NB15: a comprehensive data set for network intrusion detection systems (UNSW-NB15 network data set). In Proceedings of the Military Communications and Information Systems Conference (MilCIS), Canberra, Australia (10 Nov. 2015); 1–6. [8] Wu, P.; Guo, H.; Buckland, R. A Transfer Learning Approach for Network Intrusion Detection. In Proceedings of the IEEE 4th International Conference on Big Data Analytics (ICBDA), Suzhou, China (15 March 2019); 281–285. [9] NSL-KDD. Available online: http://kdd.ics.uci.edu/databases/kddcup99/kddcup99.html (accessed on 27-05-2022). [10] TensorFlow. Available online: https://www.tensorow.org/ (accessed on 27-05-2022). [11] Keras: The Python Deep Learning library. Available online: https://keras.io/ (accessed on 27-05-2022). [12] TL-Based IDS Framework GitHub repository. Available online: http://github.com/polvalls9/Transfer-Learning-Based-Intrusion-Detection-in-5G-and-IoT-Networks (accessed on 27-05-2022). 39
Glossary IoT Internet of Things NIDS Network Intrusion Detection Systems IDS Intrusion Detection System DL Deep Learning TL Transfer Learning CNN Convolutional Neural Network NN Neural Network OHE One Hot Encoding DDoS Distributed Denial of Service DoS Denial of Service ACC Accuracy DR Detection Rate FN False Negative FP False Positive TN True Negative TP True Positive FPR False Prediction Rate HTTP Hypertext Transfer Protocol TCP Transfer Control Protocol UDP Datagram Protocol CSV Comma-separated values 40