Attack Detection in IoT using Machine Learning


  • M. Anwer Department of Computer Science & Information Technology, NED University of Engineer and Technology, Pakistan
  • S. M. Khan Department of Computer Science and IT, NED University of Engineering and Technology, Pakistan
  • M. U. Farooq Department of Computer Science & Information Technology, NED University of Engineer and Technology, Pakistan
  • . Waseemullah Department of Computer Science & Information Technology, NED University of Engineer and Technology, Pakistan


Many researchers have examined the risks imposed by the Internet of Things (IoT) devices on big companies and smart towns. Due to the high adoption of IoT, their character, inherent mobility, and standardization limitations, smart mechanisms, capable of automatically detecting suspicious movement on IoT devices connected to the local networks are needed. With the increase of IoT devices connected through internet, the capacity of web traffic increased. Due to this change, attack detection through common methods and old data processing techniques is now obsolete. Detection of attacks in IoT and detecting malicious traffic in the early stages is a very challenging problem due to the increase in the size of network traffic. In this paper, a framework is recommended for the detection of malicious network traffic. The framework uses three popular classification-based malicious network traffic detection methods, namely Support Vector Machine (SVM), Gradient Boosted Decision Trees (GBDT), and Random Forest (RF), with RF supervised machine learning algorithm achieving far better accuracy (85.34%). The dataset NSL KDD was used in the recommended framework and the performances in terms of training, predicting time, specificity, and accuracy were compared.


cyber security, artificial intelligence, IoT, machine learning


Download data is not yet available.


S. Mendhurwar and R. Mishra, “Integration of social and IoT technologies: architectural framework for digital transformation and cyber security challenges,” Enterprise Information Systems, vol. 15, no. 4, pp. 565–584, Apr. 2021. DOI:

Z. Allam and Z. A. Dhunny, “On big data, artificial intelligence and smart cities,” Cities, vol. 89, pp. 80–91, Jun. 2019. DOI:

K. K. Mohbey, “An Efficient Framework for Smart City Using Big Data Technologies and Internet of Things,” in Progress in Advanced Computing and Intelligent Engineering, Singapore, 2019, pp. 319–328. DOI:

N. T. Archibald, “Cybersecurity and Critical Infrastructure: An Analysis of Securitization Theory,” Undergraduate Journal of Politics, Policy and Society, vol. 3, no. 1, pp. 39–54, 2020.

A. Elsaeidy, I. Elgendi, K. S. Munasinghe, D. Sharma, and A. Jamalipour, “A smart city cyber security platform for narrowband networks,” in 27th International Telecommunication Networks and Applications Conference, Melbourne, VIC, Australia, Nov. 2017, pp. 1–6. DOI:

M. Ghobaei-Arani, A. Souri, and A. A. Rahmanian, “Resource Management Approaches in Fog Computing: a Comprehensive Review,” Journal of Grid Computing, vol. 18, no. 1, pp. 1–42, Mar. 2020. DOI:

H. Wang, Z. Wang, and J. Domingo-Ferrer, “Anonymous and secure aggregation scheme in fog-based public cloud computing,” Future Generation Computer Systems, vol. 78, pp. 712–719, Jan. 2018. DOI:

D. Li, L. Deng, W. Liu, and Q. Su, “Improving communication precision of IoT through behavior-based learning in smart city environment,” Future Generation Computer Systems, vol. 108, pp. 512–520, Jul. 2020. DOI:

A. Churcher et al., “An Experimental Analysis of Attack Classification Using Machine Learning in IoT Networks,” Sensors, vol. 21, no. 2, Jan. 2021, Art. no. 446. DOI:

A. A. Diro and N. Chilamkurti, “Distributed attack detection scheme using deep learning approach for Internet of Things,” Future Generation Computer Systems, vol. 82, pp. 761–768, May 2018. DOI:

B. K. Mohanta, U. Satapathy, and D. Jena, “Addressing Security and Computation Challenges in IoT Using Machine Learning,” in Advances in Distributed Computing and Machine Learning, Singapore, Asia, 2021, pp. 67–74. DOI:

J. Li and B. Sun, “A Network Attack Detection Method Using SDA and Deep Neural Network Based on Internet of Things,” International Journal of Wireless Information Networks, vol. 27, no. 2, pp. 209–214, Jun. 2020. DOI:

N. Sahar, R. Mishra, and S. Kalam, “Deep Learning Approach-Based Network Intrusion Detection System for Fog-Assisted IoT,” in Proceedings of International Conference on Big Data, Machine Learning and their Applications, Singapore, 2021, pp. 39–50. DOI:

S. Kavitha, U. Maheswari, and R. Venkatesh, “Network Anomaly Detection for NSL-KDD Dataset Using Deep Learning,” Information Technology in Industry, vol. 9, no. 2, pp. 821–827, Mar. 2021. DOI:

H. Neuschmied, M. Winter, K. Hofer-Schmitz, and B. Stojanovic, “Two Stage Anomaly Detection for Network Intrusion Detection,” in 7th International Conference on Information Systems Security and Privacy, Vienna, Austria, Feb. 2021, pp. 450–457. DOI:

S. Pande, A. Khamparia, D. Gupta, and D. N. H. Thanh, “DDOS Detection Using Machine Learning Technique,” in Recent Studies on Computational Intelligence: Doctoral Symposium on Computational Intelligence, A. Khanna, A. K. Singh, and A. Swaroop, Eds. Singapore, Asia: Springer, 2021, pp. 59–68. DOI:

A. T. Siahmarzkooh, J. Karimpour, and S. Lotfi, “A Cluster-based Approach Towards Detecting and Modeling Network Dictionary Attacks,” Engineering, Technology & Applied Science Research, vol. 6, no. 6, pp. 1227–1234, Dec. 2016. DOI:

A. Alrawais, A. Alhothaily, C. Hu, and X. Cheng, “Fog Computing for the Internet of Things: Security and Privacy Issues,” IEEE Internet Computing, vol. 21, no. 2, pp. 34–42, Mar. 2017. DOI:

I. Kotenko, I. Saenko, A. Kushnerevich, and A. Branitskiy, “Attack Detection in IoT Critical Infrastructures: A Machine Learning and Big Data Processing Approach,” in 27th Euromicro International Conference on Parallel, Distributed and Network-Based Processing, Pavia, Italy, Feb. 2019, pp. 340–347. DOI:

M. Hasan, M. M. Islam, M. I. I. Zarif, and M. M. A. Hashem, “Attack and anomaly detection in IoT sensors in IoT sites using machine learning approaches,” Internet of Things, vol. 7, Sep. 2019, Art. no. 100059. DOI:

A. Haldorai, A. Ramu, and M. Suriya, “Organization Internet of Things (IoTs): Supervised, Unsupervised, and Reinforcement Learning,” in Business Intelligence for Enterprise Internet of Things, A. Haldorai, A. Ramu, and S. A. R. Khan, Eds. Cambridge, UK: Springer, 2020, pp. 27–53. DOI:

S. Rathore and J. H. Park, “Semi-supervised learning based distributed attack detection framework for IoT,” Applied Soft Computing, vol. 72, pp. 79–89, Nov. 2018. DOI:

M. Lopez-Martin, B. Carro, and A. Sanchez-Esguevillas, “Application of deep reinforcement learning to intrusion detection for supervised problems,” Expert Systems with Applications, vol. 141, Mar. 2020, Art. no. 112963. DOI:

K. Yang, J. Ren, Y. Zhu, and W. Zhang, “Active Learning for Wireless IoT Intrusion Detection,” IEEE Wireless Communications, vol. 25, no. 6, pp. 19–25, Dec. 2018. DOI:

B. S. Bhati and C. S. Rai, “Analysis of Support Vector Machine-based Intrusion Detection Techniques,” Arabian Journal for Science and Engineering, vol. 45, no. 4, pp. 2371–2383, Apr. 2020. DOI:

M. M. N. Aboelwafa, K. G. Seddik, M. H. Eldefrawy, Y. Gadallah, and M. Gidlund, “A Machine-Learning-Based Technique for False Data Injection Attacks Detection in Industrial IoT,” IEEE Internet of Things Journal, vol. 7, no. 9, pp. 8462–8471, Sep. 2020. DOI:

L. Liu, J. Yang, and W. Meng, “Detecting malicious nodes via gradient descent and support vector machine in Internet of Things,” Computers & Electrical Engineering, vol. 77, pp. 339–353, Jul. 2019. DOI:

M. B. Farukee, M. S. Z. Shabit, Md. R. Haque, and A. H. M. S. Sattar, “DDoS Attack Detection in IoT Networks Using Deep Learning Models Combined with Random Forest as Feature Selector,” in Advances in Cyber Security, Singapore, Asia, 2021, pp. 118–134. DOI:

P. A. A. Resende and A. C. Drummond, “A Survey of Random Forest Based Methods for Intrusion Detection Systems,” ACM Computing Surveys, vol. 51, no. 3, pp. 48:1-48:36, May 2018. DOI:

R. Kozik, M. Choras, M. Ficco, and F. Palmieri, “A scalable distributed machine learning approach for attack detection in edge computing environments,” Journal of Parallel and Distributed Computing, vol. 119, pp. 18–26, Sep. 2018. DOI:

G. Meena and R. R. Choudhary, “A review paper on IDS classification using KDD 99 and NSL KDD dataset in WEKA,” in 2017 International Conference on Computer, Communications and Electronics (Comptelix), Jaipur, India, Jul. 2017, pp. 553–558. DOI:

J. Liu, B. Kantarci, and C. Adams, “Machine learning-driven intrusion detection for Contiki-NG-based IoT networks exposed to NSL-KDD dataset,” in 2nd ACM Workshop on Wireless Security and Machine Learning, New York, NY, USA, Jul. 2020, pp. 25–30. DOI:

Y. N. Soe, Y. Feng, P. I. Santosa, R. Hartanto, and K. Sakurai, “Rule Generation for Signature Based Detection Systems of Cyber Attacks in IoT Environments,” Bulletin of Networking, Computing, Systems, and Software, vol. 8, no. 2, pp. 93–97, Jul. 2019.

M. Aamir and S. M. A. Zaidi, “DDoS attack detection with feature engineering and machine learning: the framework and performance evaluation,” International Journal of Information Security, vol. 18, no. 6, pp. 761–785, Dec. 2019. DOI:

Y. L. Ng, X. Jiang, Y. Zhang, S. B. Shin, and R. Ning, “Automated Activity Recognition with Gait Positions Using Machine Learning Algorithms,” Engineering, Technology & Applied Science Research, vol. 9, no. 4, pp. 4554–4560, Aug. 2019. DOI:

Z. A. Shaikh, “Keyword Detection Techniques: A Comprehensive Study,” Engineering, Technology & Applied Science Research, vol. 8, no. 1, pp. 2590–2594, Feb. 2018. DOI:

N. F. Syed, Z. Baig, A. Ibrahim, and C. Valli, “Denial of service attack detection through machine learning for the IoT,” Journal of Information and Telecommunication, vol. 4, no. 4, pp. 482–503, Oct. 2020. DOI:


How to Cite

M. Anwer, S. M. Khan, M. U. Farooq, and . Waseemullah, “Attack Detection in IoT using Machine Learning”, Eng. Technol. Appl. Sci. Res., vol. 11, no. 3, pp. 7273–7278, Jun. 2021.


Abstract Views: 1734
PDF Downloads: 1319

Metrics Information
Bookmark and Share

Most read articles by the same author(s)