Enhancing IoT Security: A Machine Learning-Based Intrusion Detection System for Real-Time Threat Detection and Mitigation

Section: Article
Published
Oct 1, 2025
Pages
45-61

Abstract

Rapid growth in usage of Internet of Things (IoT) devices has created a situation where security is highly vulnerable, and people require more sophisticated and evolving solutions. Conventional security solutions cannot overcome the issue of heterogeneity, resource scarcity, and dynamism of IoT environments. This paper suggests the use of a machine learning-based Intrusion Detection System (IDS) to identify and attempt to reduce the presence of real-time threats within IoT networks. The results of different machine learning models which include the Logistic Regression, the Decision Tree, the Random Forest, the XGBoost, the AdaBoost, the Gradient Boosting, Bagging, K-Nearest Neighbors (KNN), and the Naive Bayes are compared based on some of the key performance indicators that are accuracy, precision, recall, F1-score, ROC-AUC, and log loss. Our findings indicate that ensemble algorithms, especially Random Forest, Decision Tree, and Bagging, can be more effective than other models in identifying a large number of detections with low false positives, and Random Forest offers an accuracy of 99.99%, precision of 99.96%, a recall rate of 99.96% and ROC-AUC of 99.99%. By contrast, the results of Naive Bayes were much worse, showing an accuracy rate of 74.28 %, a precision rate of 23.32% and an F1-score of 37.71. These findings underline that ensemble algorithms, in particular Random Forest, are also very successful in real-time intrusion detection on IoT systems. The given approach proves that ensemble learning, which possesses the capability to merge several classifiers, is an effective solution to enhancing the IoT safety of systems.

References

  1. T. Alam, “A Reliable Communication Framework and Its Use in Internet of Things ( IoT ),” Int. J. Sci. Res. Comput. Sci. Eng. Inf. Technol., no. May, 2018.
  2. I. Coston, E. Plotnizky, and M. Nojoumian, “Comprehensive Study of IoT Vulnerabilities and Countermeasures,” Appl. Sci., vol. 15, no. 6, 2025, doi: 10.3390/app15063036.
  3. A. Zafar, F. Samad, H. J. Syed, A. O. Ibrahim, M. Alohaly, and M. Elsadig, “An Advanced Strategy for Addressing Heterogeneity in SDN-IoT Networks for Ensuring QoS,” Appl. Sci., vol. 13, no. 13, 2023, doi: 10.3390/app13137856.
  4. L. Tawalbeh, F. Muheidat, M. Tawalbeh, and M. Quwaider, "Applied Sciences IoT Privacy and Security : Challenges and Solutions," Mdpi, pp. 1–17, 2020.
  5. T. Sasi, A. H. Lashkari, R. Lu, P. Xiong, and S. Iqbal, “A comprehensive survey on IoT attacks: Taxonomy, detection mechanisms and challenges,” J. Inf. Intell., vol. 2, no. 6, pp. 455–513, 2023, doi: 10.1016/j.jiixd.2023.12.001.
  6. H. Sebestyen, D. E. Popescu, and R. D. Zmaranda, “A Literature Review on Security in the Internet of Things: Identifying and Analysing Critical Categories,” Computers, vol. 14, no. 2, 2025, doi: 10.3390/computers14020061.
  7. A. Alotaibi, H. Aldawghan, and A. Aljughaiman, “A Review of the Authentication Techniques for Internet of Things Devices in Smart Cities: Opportunities, Challenges, and Future Directions,” Sensors, vol. 25, no. 6, 2025, doi: 10.3390/s25061649.
  8. E. Dritsas and M. Trigka, “A Survey on Cybersecurity in IoT,” Futur. Internet, vol. 17, no. 1, 2025, doi: 10.3390/fi17010030.
  9. I. Coston and E. Plotnizky, “Comprehensive Study of IoT Vulnerabilities and Countermeasures,” Appl. Sci., 2025.
  10. A. Alfahaid, E. Alalwany, A. M. Almars, F. Alharbi, E. Atlam, and I. Mahgoub, “Machine Learning-Based Security Solutions for IoT Networks: A Comprehensive Survey,” Sensors, vol. 25, no. 11, pp. 1–48, 2025, doi: 10.3390/s25113341.
  11. S. I. Amgbara, C. Akwiwu-uzoma, and O. David, “Exploring lightweight machine learning models for personal internet of things ( IOT ) device security Exploring lightweight machine learning models for personal internet of things ( IOT ) device security,” World J. Adv. Res. Rev.., no. November 2024, doi: 10.30574/wjarr 2024.24.2.3449.
  12. A. K. Dinkar and A. Haque, “Enhancing IoT Data Analysis with Machine Learning : A Comprehensive Overview Mejora del análisis de datos IoT con aprendizaje automático : Una visión global,” LatIA, 2024, doi: 10.62486/latia20249.
  13. M. B. Bankó et al., “Advancements in Machine Learning-Based Intrusion Detection in IoT : Research Trends and Challenges,” Algorithms Rev., 2025.
  14. Y. Zhou, G. Cheng, S. Jiang, and M. Dai, “Building an efficient intrusion detection system based on feature selection and ensemble classifier,” Comput. Networks, vol. 174, 2020, doi: 10.1016/j.comnet.2020.107247.
  15. X. Gao, C. Shan, C. Hu, Z. Niu, and Z. Liu, “An Adaptive Ensemble Machine Learning Model for Intrusion Detection,” IEEE Access, vol. 7, pp. 82512–82521, 2019, doi: 10.1109/ACCESS.2019.2923640.
  16. T. Su, H. Sun, J. Zhu, S. Wang, and Y. Li, “BAT: Deep Learning Methods on Network Intrusion Detection Using NSL-KDD Dataset,” IEEE Access, vol. 8, pp. 29575–29585, 2020, doi: 10.1109/ACCESS.2020.2972627.
  17. Y. V. Kumar and K. Kamatchi, "Anomaly-Based Network Intrusion Detection Using Ensemble Machine Learning Technique," en. Int. J. Res. Eng. …, vol. 6, no. 4, pp. 216–220, 2020, [Online]. Available: http://www.ijert.org
  18. S. Rajagopal, P. P. Kundapur, and K. S. Hareesha, “A Stacking Ensemble for Network Intrusion Detection Using Heterogeneous Datasets,” Secur. Commun. Networks, vol. 2020, 2020, doi: 10.1155/2020/4586875.
  19. P. Maniriho, L. J. Mahoro, E. Niyigaba, Z. Bizimana, and T. Ahmad, “Detecting intrusions in computer network traffic with machine learning approaches,” Int. J. Intell. Eng. Syst., vol. 13, no. 3, pp. 433–445, 2020, doi: 10.22266/IJIES2020.0630.39.
  20. R. Qaddoura, A. M. Al-Zoubi, I. Almomani, and H. Faris, "A multi-stage classification approach for IoT intrusion detection based on clustering with oversampling," Appl. Sci., vol. 11, no. 7, 2021, doi: 10.3390/app11073022.
  21. H. Alkahtani and T. H. H. Aldhyani, “Intrusion Detection System to Advance Internet of Things Infrastructure-Based Deep Learning Algorithms,” Complexity, vol. 2021, 2021, doi: 10.1155/2021/5579851.
  22. S. P. K. Gudla, S. K. Bhoi, S. R. Nayak, K. K. Singh, A. Verma, and I. Izonin, "A Deep Intelligent Attack Detection Framework for Fog-Based IoT Systems," Comput. Intell. Neurosci., vol. 2022, p. 6967938, 2022, doi: 10.1155/2022/6967938.
  23. N. Dat-Thinh, H. Xuan-Ninh, and L. Kim-Hung, “MidSiot: A Multistage Intrusion Detection System for Internet of Things,” Wirel. Commun. Mob. Comput., vol. 2022, no. December 2017, 2022, doi: 10.1155/2022/9173291.
  24. P. L. Indrasiri, E. Lee, V. Rupapara, F. Rustam, and I. Ashraf, "Malicious traffic detection in IoT and local networks using stacked ensemble classifier," Comput. Mater. Contin., vol. 71, no. 1, pp. 489–515, 2022, doi: 10.32604/cmc 2022.019636.
  25. K. A. ElDahshan, A. A. A. AlHabshy, and B. I. Hameed, "Meta-Heuristic Optimisation Algorithm-Based Hierarchical Intrusion Detection System," Computers, vol. 11, no. 12, 2022, doi: 10.3390/computers11120170.
  26. N. Thockchom, M. M. Singh, and U. Nandi, “A novel ensemble learning-based model for network intrusion detection,” Complex Intell. Syst., vol. 9, no. 5, pp. 5693–5714, 2023, doi: 10.1007/s40747-023-01013-7.
  27. A. Sohail, B. Ayisha, I. Hameed, M. M. Zafar, and A. Khan, “Deep Neural Networks based Meta-Learning for Network Intrusion Detection,” 2023, [Online]. Available: http://arxiv.org/abs/2302.09394
  28. M. Bhavsar, K. Roy, J. Kelly, and O. Olusola, “Anomaly-based intrusion detection system for IoT application,” Discov. Internet Things, vol. 3, no. 1, 2023, doi: 10.1007/s43926-023-00034-5.
  29. J. Jose and D. V. Jose, "Deep learning algorithms for intrusion detection systems in Internet of Things using CIC-IDS 2017 dataset," Int. J. Electr. Comput. Eng., vol. 13, no. 1, pp. 1134–1141, 2023, doi: 10.11591/ijece.v13i1.pp1134-1141.
  30. A. Almomani et al., “Ensemble-Based Approach for Efficient Intrusion Detection in Network Traffic,” Intell. Autom. Soft Comput., vol. 37, no. 2, pp. 2499–2517, 2023, doi: 10.32604/iasc 2023.039687.
  31. J. Zhu and X. Liu, “An integrated intrusion detection framework based on subspace clustering and ensemble learning,” Comput. Electr. Eng., vol.. 115, no. January, p. 109113, 2024, doi: 10.1016/j.compeleceng.2024.109113.
  32. I. D. Mienye and N. Jere, “A Survey of Decision Trees: Concepts, Algorithms, and Applications,” IEEE Access, vol. 12, pp. 86716–86727, 2024, doi: 10.1109/ACCESS.2024.3416838.
  33. M. Kathiravan, V. Rajasekar, S. J. Parvez, V. Sathya Durga, M. Meenakshi, and S. Gowsalya, “Detecting Phishing Websites using Machine Learning Algorithm,” Proc. - 7th Int. Conf. Comput. Methodol. Commun. ICCMC 2023, pp. 270–275, 2023, doi: 10.1109/ICCMC56507.2023.10083999.
  34. P. Barnard, N. Marchetti, and L. A. DaSilva, “Robust Network Intrusion Detection Through Explainable Artificial Intelligence (XAI),” IEEE Netw. Lett., vol. 4, no. 3, pp. 167–171, 2022, doi: 10.1109/lnet.2022.3186589.
  35. T. Mahmood, S. K. Hashemi, S. L. Mirtaheri, and S. Greco, “Machine Learning Techniques for Detecting Fraud in Credit Card Transactions,” CEUR Workshop Proc., vol. 3478, pp. 469–478, 2023.
  36. M. A. Hambali, Y. K. Saheed, T. O. Oladele, and M. D. Gbolagade, "ADABOOST Ensemble Algorithms for Breast Cancer Classification," J. Adv. Comput. Res., vol. 10, no. 2, pp. 31–52, 2019, [Online]. Available: www.jacr.iausari.ac.ir
  37. H. Kim, S. Park, H. J. Park, H. G. Son, and S. Kim, “Solar Radiation Forecasting Based on the Hybrid CNN-CatBoost Model,” IEEE Access, vol. 11, no. February, pp. 13492–13500, 2023, doi: 10.1109/ACCESS.2023.3243252.
  38. R. Du, L. Zhen, and Y. Liu, “Physical Layer Authentication Based on Integrated Semi-Supervised Learning in Wireless Networks for Dynamic Industrial Scenarios,” IEEE Trans. Veh. Technol., vol. 72, no. 5, pp. 6154–6164, 2023, doi: 10.1109/TVT.2022.3231633.
  39. P. D. Rosero-Montalvo et al., “Sign Language Recognition Based on Intelligent Glove Using Machine Learning Techniques,” 2018 IEEE 3rd Ecuador Tech. Chapters Meet. ETCM 2018, no. December, pp. 1–6, 2018, doi: 10.1109/ETCM.2018.8580268.
  40. A. Karim, M. Shahroz, K. Mustofa, S. B. Belhaouari, and S. R. K. Joga, “Phishing Detection System Through Hybrid Machine Learning Based on URL,” IEEE Access, vol. 11, pp. 36805–36822, 2023, doi: 10.1109/ACCESS.2023.3252366.
Download this PDF file

Statistics

Downloads

Download data is not yet available.

How to Cite

[1]
A. A. . Ahmed, “Enhancing IoT Security: A Machine Learning-Based Intrusion Detection System for Real-Time Threat Detection and Mitigation”, JES, vol. 34, no. 4, pp. 45–61, Oct. 2025.
Copyright and Licensing