Supervised Machine Learning-Based Intrusion Detection for 5G Networks: Evaluation on the 5G-NIDD Dataset
Abstract
1. Introduction
1.1. Motivation and Previous Works
1.2. Aims and Contributions
- Full-spectrum evaluation across all subsets of the 5G-NIDD dataset, covering diverse attack types including DoS, port scanning, and other intrusion scenarios.
- Replication and extension of federated learning systems, particularly those based on unsupervised time-series modeling, to validate their effectiveness in realistic 5G settings.
- Evaluation of supervised learning algorithms, including K-Nearest Neighbors, Support Vector Machines, Logistic Regression, and Naive Bayes, under consistent experimental conditions.
- Comparative analysis across benchmark datasets, namely CICIDS2017 and UNSW-NB15.
- Performance benchmarking using multiple evaluation metrics, including precision, accuracy, confusion matrix, and F1-score, to identify robust and scalable detection models for 5G networks.
1.3. Organization
2. Data Collection
- Train_subset_1.csv and Train_subset_2.csv: These comprise training data and can either be used individually or merged to create a larger training set.
- Test_Data.csv: A test set that consists of all traffic types is used to evaluate the final model.
3. Proposed ML Approaches
3.1. Data Preprocessing
- Data Consolidation: The two training subsets are merged to form a unified training set.
- Cleaning and Validation: Missing entries are accounted for, duplicate records are removed, and data types are verified.
- Feature and Label Separation: The target variable (label) is isolated from the feature set.
- Categorical Encoding: Non-numeric attributes are transformed via Label Encoding or One-Hot Encoding as required.
- Feature Scaling: StandardScaler is applied to normalize feature distributions and improve model convergence.
3.2. Mathematical Formulation of Supervised Learning Models
3.3. Performance Evaluation
- Accuracy: Percentage of correct predictions over the total predictions.
- Precision: Ability to avoid false positives.
- Recall: Capacity to correctly identify positive instances.
- F1-Score: The harmonic mean is used to capture the trade-off between precision and recall by a performance metric, especially useful for imbalanced datasets.
- Confusion Matrix: Detailed breakdown of classification outcomes per class.
4. Results and Discussion
4.1. Experimental Setup
4.2. Evaluation Metrics
- Accuracy measures the proportion of correctly classified instances:where TP denotes true positive, TN denotes true negative, FP denotes false positive, and FN denotes false negative.
- Precision measures the percentage of actual positives among all anticipated positives:
- Recall evaluates the percentage of valid positives that were correctly identified:
- F1-Score represents the harmonic mean of precision and recall:
4.3. Comparative Results and Discussion
4.3.1. Performance on 5G-NIDD Dataset
4.3.2. Cross-Dataset Comparison
4.3.3. Comparison with Unsupervised Learning Approaches
4.3.4. Discussion
4.4. Practical Computational Cost Analysis
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Sudhamani, C.; Roslee, M.; Tiang, J.J.; Rehman, A.U. A Survey on 5G Coverage Improvement Techniques: Issues and Future Challenges. Sensors 2023, 23, 2356. [Google Scholar] [CrossRef] [PubMed]
- Mijwil, M.M.; Abotaleb, M.; Dutta, P.K. The 5G Era: Transforming Connectivity and Enabling New Use Cases Across Industries. In Building Embodied AI Systems: The Agents, the Architecture; Springer: Berlin/Heidelberg, Germany, 2025; pp. 481–492. [Google Scholar] [CrossRef]
- Dias, J.; Pinto, P.; Santos, R.; Malta, S. 5G Network Slicing: Security Challenges, Attack Vectors, and Mitigation Approaches. Sensors 2025, 25, 3940. [Google Scholar] [CrossRef]
- Alnaim, A.K. Securing 5G Virtual Networks: A Critical Analysis of SDN, NFV, and Network Slicing Security. Int. J. Inf. Secur. 2024, 23, 3569–3589. [Google Scholar] [CrossRef]
- Trabelsi, Z.; Zeidan, S. IDS Performance Enhancement Technique Based on Dynamic Traffic Awareness Histograms. In Proceedings of the 2014 IEEE International Conference on Communications (ICC), Sydney, NSW, Australia, 10–14 June 2014; Available online: https://research.uaeu.ac.ae/en/publications/ids-performance-enhancement-technique-based-on-dynamic-traffic-aw (accessed on 18 December 2025).
- Zhang, C.; Chen, Y.; Meng, Y.; Ruan, F.; Chen, R.; Li, Y.; Yang, Y. A Novel Framework Design of Network Intrusion Detection Based on Machine Learning Techniques. Secur. Commun. Netw. 2021, 2021, 6610675. [Google Scholar] [CrossRef]
- Hamroun, C.; Fladenmuller, A.; Pariente, M.; Pujolle, G. Intrusion Detection in 5G and Wi-Fi Networks: A Survey of Current Methods, Challenges and Perspectives. IEEE Access 2025, 13, 40950–40976. [Google Scholar] [CrossRef]
- Zhao, Y.; Li, H.; Niu, K.; Shi, J.; Song, R. Application of Deep Learning-Based Intrusion Detection System (IDS) in Network Anomaly Traffic Detection. Appl. Comput. Eng. 2024, 8, 150–160. [Google Scholar] [CrossRef]
- Gümüşbaş, D.; Yıldırım, T.; Genovese, A.; Scotti, F. A Comprehensive Survey of Databases and Deep Learning Methods for Cybersecurity and Intrusion Detection Systems. IEEE Syst. J. 2021, 15, 1717–1731. [Google Scholar] [CrossRef]
- Liu, H.; Lang, B. Machine Learning and Deep Learning Methods for Intrusion Detection Systems: A Survey. Appl. Sci. 2019, 9, 4396. [Google Scholar] [CrossRef]
- Zhang, D.; Zhou, F.; Albu, F.; Wei, Y.; Yang, X.; Gu, Y.; Li, Q. Unleashing the power of self-supervised image denoising: A comprehensive review. arXiv 2023, arXiv:2308.00247. [Google Scholar] [CrossRef]
- Zhang, D.; Zhou, F.; Jiang, Y.; Fu, Z. Mm-bsn: Self-supervised image denoising for real-world with multi-mask based on blind-spot network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 18–22 June 2023; pp. 4188–4197. [Google Scholar]
- Tavallaee, M.; Bagheri, E.; Lu, W.; Ghorbani, A.A. A detailed analysis of the KDD CUP 99 data set. In Proceedings of the 2009 IEEE Symposium on Computational Intelligence for Security and Defense Applications, Ottawa, ON, Canada, 8–10 July 2009; pp. 1–6. [Google Scholar]
- Adel, A.M. NSL-KDD Dataset. GitHub. 2020. Available online: https://github.com/AhmedMohammedAdel/NSL_KDD (accessed on 18 December 2025).
- Moustafa, N.; Slay, J. UNSW-NB15: A comprehensive data set for network intrusion detection systems. In Proceedings of the 2015 MilCIS, Canberra, Australia, 10–12 November 2015; pp. 1–6. [Google Scholar]
- Islam, R.R. UNSW-NB15 Dataset. GitHub. 2020. Available online: https://github.com/rokibulroni/CIC-IDS-2017-Dataset (accessed on 18 December 2025).
- Sharafaldin, I.; Lashkari, A.H.; Ghorbani, A.A. Toward generating a new intrusion detection dataset and intrusion traffic characterization. In Proceedings of the ICISSP, Madeira, Portugal, 22–24 January 2018; pp. 108–116. [Google Scholar] [CrossRef]
- Pervez, N. CICIDS2017 Dataset. GitHub. 2020. Available online: https://github.com/noushinpervez/Intrusion-Detection-CICIDS2017 (accessed on 18 December 2025).
- Mishra, N.; Mishra, S. NSL-KDD Dataset Analysis: A Machine Learning Implementation to Detect Intrusions in the Computer Network. In Proceedings of the 2024 2nd International Conference on Signal Processing, Communication, Power and Embedded System (SCOPES), Parlakhemundi, India, 19–21 December 2024; pp. 1–6. [Google Scholar] [CrossRef]
- Siddique, K.; Akhtar, Z.; Aslam Khan, F.; Kim, Y. KDD Cup 99 Data Sets: A Perspective on the Role of Data Sets in Network Intrusion Detection Research. Computer 2019, 52, 41–51. [Google Scholar] [CrossRef]
- Kabir, M.H.; Rajib, M.S.; Rahman, A.S.M.T.; Rahman, M.M.; Dey, S.K. Network Intrusion Detection Using UNSW-NB15 Dataset: Stacking Machine Learning Based Approach. In Proceedings of the 2022 International Conference on Advancement in Electrical and Electronic Engineering (ICAEEE), Gazipur, Bangladesh, 24–26 February 2022; pp. 1–6. [Google Scholar] [CrossRef]
- Sharma, V.; Kumar, M. Improving Intrusion Detection with Hybrid Deep Learning Models: A Study on CIC-IDS2017, UNSW-NB15, and KDD CUP 99. J. Inf. Syst. Eng. Manag. 2022, 10, 633–650. [Google Scholar]
- Kurniabudi; Stiawan, D.; Darmawijoyo; Bin Idris, M.Y.; Bamhdi, A.M.; Budiarto, R. CICIDS-2017 Dataset Feature Analysis With Information Gain for Anomaly Detection. IEEE Access 2020, 8, 132911–132921. [Google Scholar] [CrossRef]
- Sheikhi, S.; Kostakos, P. DDoS Attack Detection Using Unsupervised Federated Learning for 5G Networks and Beyond. In Proceedings of the 2023 Joint EuCNC/6G Summit, Gothenburg, Sweden, 6–9 June 2023; pp. 1–6. [Google Scholar] [CrossRef]
- Sheikhi, S.; Kostakos, P. Advancing Security in 5G Core Networks through Unsupervised Federated Time Series Modeling. In Proceedings of the 2024 IEEE International Conference on Cyber Security and Resilience (CSR), London, UK, 2–4 September 2024; pp. 353–356. [Google Scholar] [CrossRef]
- Sheikhi, S. 5G-Intrusion-Detection-Dataset. GitHub. 2023. Available online: https://github.com/saeidsheikhi/5G-Intrusion-Detection-Dataset (accessed on 18 December 2025).
- Ghani, H.; Salekzamankhani, S.; Virdee, B. Critical Analysis of 5G Networks Traffic Intrusion using PCA, t-SNE and UMAP Visualization and Classifying Attacks. In Proceedings of ICDAM 2023; Lecture Notes in Networks and Systems; Springer: Berlin/Heidelberg, Germany, 2023; Volume 785, pp. 421–437. [Google Scholar] [CrossRef]
- Rao, V.S.; Balakrishna, R.; El-Ebiary, Y.A.B.; Thapar, P.; Saravanan, K.A.; Godla, S.R. AI Driven Anomaly Detection in Network Traffic Using Hybrid CNN-GAN. Int. J. Adv. Inf. Technol. 2024, 15, 886–895. [Google Scholar] [CrossRef]
- Zhang, H.; Zhao, S.; Liu, R.; Wang, W.; Hong, Y.; Hu, R. Automatic Traffic Anomaly Detection on the Road Network with Spatial-Temporal Graph Neural Network Representation Learning. Wirel. Commun. Mob. Comput. 2022, 2022, 4222827. [Google Scholar] [CrossRef]
- Ziya07. Network Traffic Anomaly Detection Dataset. Kaggle. 2023. Available online: https://www.kaggle.com/datasets/ziya07/network-traffic-anomaly-detection-dataset (accessed on 18 December 2025).
- Salem, A.H.; Azzam, S.M.; Emam, O.E.; Abohany, A.A. Advancing Cybersecurity: A Comprehensive Review of AI-Driven Detection Techniques. J. Big Data 2024, 11, 105. [Google Scholar] [CrossRef]
- Hoger, T.; Owezarski, P. Multi-domain anomaly detection in a 5G network. arXiv 2025, arXiv:2506.12070. [Google Scholar] [CrossRef]





| Feature Type | Feature Name |
|---|---|
| ip | ip.flags.df, ip.ttl, ip.len, ip.flags.mf, ip.proto, ip.fragments, ip.fragment, ip.fragment.count |
| udp | udp.port, udp.length |
| tcp | tcp.time_delta, tcp.analysis.ack_rtt, tcp.urgent_pointer, tcp.window_size, tcp.port, tcp.ack, tcp.seq, tcp.len, tcp.flags, tcp.ack_raw, tcp.segments, tcp.reassembled.length, tcp.time_relative, tcp.window_size.1, tcp.stream |
| http | http.request |
| frame | frame.time_delta, frame.time_relative |
| gtp | gtp.flags.version, gtp.flags.payload, gtp.ext_hdr.pdu_ses_con.qos_flow_id, gtp.ext_hdr, gtp.ext_hdr.pdu_ses_cont.ppp, gtp.flags,gtp.length, gtp.ext_hdr.pdu_ses_con.pdu_type, gtp.ext_hdr.pdu_ses_cont.rqi, gtp.flags.e, gtp.flags.pn, gtp.ext_hdr.length, gtp.flags.s, gtp.message, gtp.teid, gtp.flags.reserved |
| label | 0 for Normal, 1 for Anomaly/Attack |
| Algorithm | Key Parameters |
|---|---|
| KNN | k = 5, Distance = Euclidean |
| SVM | Kernel = RBF, C = 1.0, Gamma = scale, random_state = 42 |
| LR | max_iter = 1000, random_state = 42 |
| NB | Gaussian NB |
| Model | Accuracy | Precision | Recall | F1-Score |
|---|---|---|---|---|
| KNN | 0.9979 | 1.00 | 0.99 | 0.99 |
| SVM | 0.7888 | 0.39 | 0.50 | 0.44 |
| LR | 0.8101 | 0.90 | 0.55 | 0.54 |
| NB | 0.6652 | 0.69 | 0.78 | 0.64 |
| Dataset | Model | Accuracy | Precision | Recall | F1-Score |
|---|---|---|---|---|---|
| UNSW-NB15 | KNN | 0.8267 | 0.84 | 0.81 | 0.82 |
| SVM | 0.7861 | 0.86 | 0.76 | 0.76 | |
| LR | 0.7756 | 0.81 | 0.76 | 0.76 | |
| NB | 0.7331 | 0.76 | 0.71 | 0.71 | |
| CICIDS2017 | KNN | 0.91 | 0.46 | 0.49 | 0.48 |
| SVM | 0.91 | 0.46 | 0.49 | 0.48 | |
| LR | 0.92 | 0.46 | 0.50 | 0.48 | |
| NB | 0.92 | 0.46 | 0.50 | 0.48 |
| Model | Accuracy | Precision | Recall | F1-Score |
|---|---|---|---|---|
| KNN (Supervised) | 0.9979 | 1.00 | 0.99 | 0.99 |
| K-Means (Unsupervised) | 0.92 | 0.94 | 0.78 | 0.85 |
| Autoencoder (Unsupervised) | 0.67 | 0.47 | 0.64 | 0.54 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Lassoued, N.; Filali, I.; Ejbali, R. Supervised Machine Learning-Based Intrusion Detection for 5G Networks: Evaluation on the 5G-NIDD Dataset. Computers 2026, 15, 362. https://doi.org/10.3390/computers15060362
Lassoued N, Filali I, Ejbali R. Supervised Machine Learning-Based Intrusion Detection for 5G Networks: Evaluation on the 5G-NIDD Dataset. Computers. 2026; 15(6):362. https://doi.org/10.3390/computers15060362
Chicago/Turabian StyleLassoued, Narjes, Imen Filali, and Ridha Ejbali. 2026. "Supervised Machine Learning-Based Intrusion Detection for 5G Networks: Evaluation on the 5G-NIDD Dataset" Computers 15, no. 6: 362. https://doi.org/10.3390/computers15060362
APA StyleLassoued, N., Filali, I., & Ejbali, R. (2026). Supervised Machine Learning-Based Intrusion Detection for 5G Networks: Evaluation on the 5G-NIDD Dataset. Computers, 15(6), 362. https://doi.org/10.3390/computers15060362

