Next Article in Journal
Reliable Hardware Sensor and Large Language Model Fusion for Intelligent Short-Term Market Risk Sensing and Prediction
Previous Article in Journal
Performance Assessment of Smartphone Tightly Coupled PPP/INS Integration with an Adaptive Robust Kalman Filter
Previous Article in Special Issue
Energy-Efficient Cryptographic Protocols for Sustainable IoT Security: A Federated Learning-Enhanced Lightweight Framework with Post-Quantum Resilience
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

AI-Driven Security: Detecting Cyber Attacks in IoT Networks

by
Jawad Hussain Awan
1,*,
Misbah Safdar
1,
Muhammad Ayaz Shirazi
1 and
Min Young Kim
2,3,4,*
1
Faculty of Engineering, Sciences and Technology, Iqra University, Main Campus, Karachi 75550, Pakistan
2
School of Electronic and Electrical Engineering, Kyungpook National University, Daegu 41566, Republic of Korea
3
Research Center for Neurosurgical Robotic Systems, Kyungpook National University, Daegu 41566, Republic of Korea
4
KNU-LG Electronics Convergence Research Center, Kyungpook National University, Daegu 41566, Republic of Korea
*
Authors to whom correspondence should be addressed.
Sensors 2026, 26(17), 5321; https://doi.org/10.3390/s26175321 (registering DOI)
Submission received: 14 July 2026 / Revised: 7 August 2026 / Accepted: 20 August 2026 / Published: 22 August 2026
(This article belongs to the Special Issue Secure IoT: Cryptographic Solutions for Sensor Networks)

Abstract

Traditional rule-based intrusion detection systems generally fail in identifying unknown or evolving threats; thus, automated and adaptive kinds of methods are crucial. Deep learning models provide promising solutions, but many recent studies depend on hybrid architecture, which increase the computational cost and reduce deploying ability on real-time or resource-limited systems. In this paper, we present and test a standalone LSTM model for multiclass cyberattack detection based on a CIC_IoT_Dataset2023, a recent labeled dataset that mirrors the actual network environment containing 33 attack categories. The dataset was extremely imbalanced as benign traffic accounted for most of the classes. To detect such attacks, we used the Synthetic Minority Oversampling Technique (SMOTE) to increase the frequency of less common types of address. The pre-processed dataset was then employed to train four models (RNN, CNN, DNN and the proposed LSTM) for performance analysis with sequential data. The proposed LSTM model achieved an accuracy between 2% and 7%. LSTM had good detection for frequent attacks and slow-changing patterns, which shows its capacity in learning long-lasting dependencies. The results demonstrate that a simple, lightweight standalone LSTM model can be used for effective and realistic intrusion detection without the need for complex hybrid architecture.

1. Introduction

The Internet of Things (IoT) has introduced a paradigm shift to the digital communication world by interconnecting billions of devices spread over homes, infrastructure and healthcare systems [1,2]. These linked systems produce huge amounts of data and real-time automation, but they also have created new cybersecurity threats. Due to the restricted computing capacity and insufficient security setting for most IoT devices, they become vulnerable to attackers [3]. These systems have come to play a major role in society, and cyberattacks affecting these systems, such as data breaches, tampering of devices, and service interruptions, are increasingly severe and widespread [4,5]. With this ever-changing surface area, the need for efficient, scalable and accurate intrusion detection systems (IDS) to secure modern networks has become more pressing than ever.
Signature-based and rule-based detection mechanisms are the traditional IDS models. Such systems can sufficiently detect previously seen types of attacks; however, they are weak when it comes to detecting new or altered (zero-day) attack patterns [6,7]. It is common for attackers to adapt their attacks, and static security policies are not sufficient to deal with the dynamic nature of attacks [8]. The traditional IDS techniques become ineffective and difficult to manage as the traffic in the network grows and becomes complex [9]. To overcome these limitations, researchers have moved towards AI and machine learning (ML) methods that automatically learn how networks work [10,11].
Deep learning models have shown state-of-the-art performance in detecting anomalies and cyberattacks on network traffic [11,12]. Recurrent neural networks (RNNs) and Long Short-Term Memory (LSTM) networks are popular among such models due to their ability to learn from sequential data. Network traffic follows time-based temporal behavior. Thus, LSTM is a relevant model for this context [13,14]. Research has shown that LSTM is able to learn long-range dependencies and can also detect some quiet but slight attempts at evasion or probing from scans, such as slow-scale or increasing request frequencies [15,16]. This assists in maintaining the memory of historical data and helps it perform better than traditional vanilla RNNs, which tend to suffer from problems such as vanishing gradients [17].
The idea to utilize LSTM in cyber-security was also based on the supporting evidence identified in recent findings. Some research works have proved that LSTM-based IDS models reach a high accuracy for detecting DDoS, brute-force, command injection, and botnet attacks [18,19,20,21,22]. Other related works also described the advantages of utilizing LSTM in predicting workloads, monitoring cloud systems, and modeling dynamic behavior in large networks [23,24,25]. Their best model achieved a validation loss of 0.0045, indicating strong convergence during training. CNNs are good at extracting spatial features but are bad at temporal relations. DNNs cannot model long term-dependent relationships, and they are less effective for time series traffic data [26,27,28,29].
Furthermore, hybrid models like CNN–LSTM and the ensemble of RNN architecture have also been widely studied in the literature [30,31,32]. These models incorporate both spatial and temporal feature learning and, in many cases, achieve high detection accuracy. Nevertheless, their high training time and computation cost and difficulty in deployment (especially within the context of resource-constrained IoT settings) are drawbacks. Consequently, some studies suggest that a trained solo LSTM can perform equally as effectively as the best deep models and keep the process simple and neat [33,34].
These are the challenges that lead us to consider a deep learning model specially designed for network traffic patterns in practice. This study evaluates the capability of a single LSTM model trained only on the state-of-the-art CIC-IoT-Dataset2023 containing realistic IoT experiences, multiple attack types, and recent threats. By utilizing proper pre-processing and class-balancing schemes, this work assesses if a simple LSTM can obtain high detection accuracy without relying on complicated hybrid architecture.
The goal of this work is to bridge a gap in the literature by answering how a single LSTM model works on current IoT datasets and if it can be used as an efficient, lightweight, and deployable option for real-time cybersecurity systems. The results provide useful insights in the quest to build efficient IDS models that will be able to cope with sophisticated cyber threats as we continue to move into an era of ubiquitous connectivity. The novelty of this work is not in proposing a new LSTM architecture. Instead, it offers a systematic and reproducible comparison of four widely used deep learning models as part of a uniform preprocessing, training, and evaluation process applied to the recently released CIC_IoT_Dataset2023. Despite this, comparisons such as these are still useful since there are many studies that are available using different datasets with different engineered features, different preprocessing techniques, and different evaluation protocols, making direct comparisons difficult. A baseline stand-alone LSTM architecture is explored, which is easily implementable in the IoT context. The proposed single-layer LSTM reduces the number of trainable parameters and computation complexity compared with the deeper hybrid architecture reported in the literature. Thus, it can be considered computationally simpler, but not necessarily as lightweight as possible. The issues of resource-constrained hardware deployment were not addressed and will be explored in future work.

2. Literature Review

Ongoing research has focused on the potential benefits of combining multiple deep learning architecture for capturing spatial as well as temporal features. As an illustration, Kaur and Singh built a hybrid deep recurrent network that increases the performance of intrusion detection as compared to traditional RNN models [35]. In the same way, ensemble-based strategies with the use of stacked or parallel deep neural architecture have achieved high detection accuracy in different kinds of traffic environments [36]. Shurman provided evidence of deep learning technique capability in recognizing the occurrence of both DoS and DDoS by means of automated feature extraction; thus, deep learning methods were mostly able to supersede the performance of the previous IDS solutions [37]. Furthermore, hybrid IDS architecture targeted at IoT networks have been able to raise the level of the network, based on research by Smys, which combines multiple detection components to resolve the issues of IoT-specific vulnerabilities [38].
In a similar way, Ref. [39] used a hybrid of CNN, Self-Organizing Maps (SOMs), and Naive Bayes to detect cyberattacks, with the main issues being extreme imbalance in the classes and a high false-positive rate, especially with DoS attacks. An overview of host-based IDSs was conducted in Ref. [40], in which deep-learning models were evaluated (LSTM, CNN, and GRU) on the detection of anomalies on the basis of system calls; the performance of the models was better, including higher rates of detection, but they also had high ratios of false-positives and the inability to detect zero-day attacks. To deal with threats of IoT, Ref. [41] proposed AS-IDS, a hybrid anomaly- and signature-based IDS based on deep learning and reinforcement learning, and reported a detection rate of 96.9%, where false alarms were low compared to the traditional DBN and RNN methods. A CNN-based self-normalizing deep neural network (DNN) was suggested in Ref. [42] to address the issue of class imbalance in IoT intrusion datasets; it reached an accuracy of 99.95% and markedly enhanced the detection of minority classes using sophisticated data augmentation methodology, including CTGAN. Moreover, the STL-HDL platform in Ref. [43] used hybrid CNN–LSTM models with sampling mechanisms to address imbalanced big data conditions to achieve more than 99% accuracy in CIDDS-001 and UNSW-NB15 datasets. Lastly, Ref. [44] devoted itself to wireless sensor networks and offered a DNN-based IDS with cross-correlation feature selection, outperforming the conventional machine learning algorithms; however, the question of scalability and resilience to large-scale implementations is still a research question.
Other studies focus on the reliance of deep learning models like convolutional neural networks (CNNs) and gated recurrent mechanisms for network traffic data processing. Khan came up with a Hybrid Convolutional Recurrent Network (HCRNN) that uses CNNs for spatial feature extraction and RNNs for sequence learning of interaction detection accuracy [45]. Similarly, they proved that deep sequential models could be instrumental in depicting behavior changes in IoT servers, thus pointing to the importance of recurrent architecture for the capture of attack signatures, which are evolving [46].
LSTM-based models additionally prolong the benefits of these models by solving the issue of disappearing gradients, being able to remember long-term relationships in traffic flows, and thus being applicable to both rapidly changing and slowly evolving attack classes [47].
Since real datasets are characterized by a severe class imbalance situation in which some attacks are very rare, several authors have decided to use oversampling, feature-level correction, or dynamic model training strategies. Liu et al. have proven that deep learning models can substantially enhance their performance if they are trained on datasets that have been corrected by means of oversampling and feature-based balancing [48]. Ashiku and Dagli went on to support this statement by proving that deep neural networks have become more stable and reliable when trained on enriched and balanced intrusion datasets [49]. The use of bidirectional LSTM architecture has equally dealt with temporal imbalance, and they have demonstrated strong capability in detecting rare attack sequences [50].
Recent studies are primarily concerned with the creation of efficient IDS for cloud networks, the Internet of Things, and software-defined networking (SDN) systems. DDoSNet, a deep learning technique in a cloud environment, was introduced by Srilatha and Thillaiarasu to respond to high-volume attack traffic effectively [51]. Deep learning-powered SDN-based IDS architecture also have a bright future, as they provide not only centralized control but also dynamic traffic monitoring, which was proven in research by Chaganti. These mechanisms are empowered by LSTM and CNN structures, through which they can recognize intrusions instantly and self-modulate network traffic. In the same way, Halbouni et al. pointed out the advantages of the CNN–LSTM combined framework in the case of IoT devices, achieving the improvement of both accuracy and speed of execution [52].
Initially, research turned to the importance of interpretability in models and their lightweight design. Qazi and his team came up with an IoT IDS model architecture that could run with minimal energy consumption while keeping its accuracy at a high level [53]. Ravi and his coworkers put forward a recurrent ensemble method as a feature fusion technique, and thereby their deep learning models might seamlessly integrate multi-layered temporal information for robust detection performance [54]. Hnamte and Hussain’s dual-stage DCNN-BiLSTM hybrid model focuses on temporal-spatial feature extraction for intrusion detection with a very high degree of accuracy. In their research, they demonstrated the significance of linking CNN and LSTM components together [55].
Experimentation with strictly signature-based and anomaly-based intrusion detection systems has also attracted attention. Moorthy studied and revealed the signature elements of hybrid IDS models, thereby upgrading their competence in detecting both previously known and new types of attacks [56]. Awajan presented a deep learning-based IDS only for IoT networks, which can learn device-level behavior changes and become compatible with heterogeneous traffic patterns [57]. There have also been proposals for lightweight IDS systems that can function in environments with severe computational limitations. Wang et al. researched dynamic quantization methods for IoT environments to compress deep learning models without causing a reduction in accuracy [58]. Further work by Wang et al. introduced a lightweight BERT-of-Theseus-based detection model, thus illustrating how transformer architecture can be efficiently utilized for intrusion detection purposes [59].
LSTM architecture are still a vibrant option and continue to be highly effective in real-time detection tasks. Research to that effect also shows that LSTM not only is able to handle long temporal dependencies but also to adjust sequence variable-lengths that come from real traffic data [60].
Further, the research on anomaly-based IDS has led to the conclusion that IoT systems are the beneficiaries of deep learning architecture that can detect the occurrence of irregular activity by first modeling normal behavior patterns [61].
Chaganti has shown that SDN-enabled IoT networks are also heavily influenced by LSTM-based methods in a positive way. In their study, the LSTM models exhibited a robust detection performance for a variety of attack types [62]. Lately, research also aligns with the argument of hybrid LSTM-based solutions as the best choice to unpack spatial–temporal features with high-accuracy detection results [63]. The necessity of advanced detection mechanisms is further being realized in works that investigate the combinations of fuzzy logic and deep learning as the most potent and intelligent IDS frameworks that are adaptable and can be easily deployed in the real world.
In general, earlier studies have been quite explicit about the fact that deep learning, especially LSTM and hybrid sequential models, has been a major factor in the protection of contemporary IoT and network environments. Although hybrid methods usually provide high accuracy, their complicated nature makes it difficult to deploy them. Therefore, a higher proportion of recent articles is devoted to the advantage of a single LSTM model that achieves a good compromise between accuracy, efficiency, and adaptability in real time. The primary aim of this current research is to examine LSTM-based intrusion detection with the help and agreement of the latest IoT-oriented CIC_IoT_Dataset2023.

3. Research Methodology

This study followed a structured methodology to develop and evaluate an LSTM-based intrusion detection system using the CIC_IoT_Dataset2023. The research process consisted of four main stages: dataset preparation, data preprocessing, model design, and performance evaluation.

3.1. Dataset Description

This research is based on the CIC_IoT_Dataset2023 created by the Canadian Institute for Cybersecurity (CIC), University of New Brunswick. The dataset was produced in a real IoT environment with 105 different devices, such as smart home, industrial, and consumer IoT devices. It can capture over 46 million network flow records with labels for benign and malicious traffic that can serve as a comprehensive reference to test IoT intrusion detection methods on a large scale. There are 33 attack types throughout the dataset, which are divided into seven larger attack groups: DDoS, DoS, Reconnaissance, Web-based attacks, Brute Force, Spoofing and Mirai. These attacks were performed by malicious IoT devices against other IoT devices, allowing for the realistic assessment of IoT security analytics models.
The attacks in the DDoS category encompass ACK Fragmentation, HTTP Flood, ICMP Flood, ICMP Fragmentation, PSHACK Flood, RSTFIN Flood, SYN Flood, SlowLoris, Synonymous IP Flood, TCP Flood, UDP Flood, and UDP Fragmentation. DoS (Denial of Service) attacks include HTTP Flood, SYN Flood, TCP Flood and UDP Flood attacks. Host Discovery, OS Scan, Ping Sweep, Port Scan, and Vulnerability Scan attacks are part of the Reconnaissance category attacks. Browser Hijacking, Command Injection, SQL Injection, Uploading Attack, XSS, and Backdoor Malware are the types of attacks that are included in the Web-based category. The Brute Force category contains Dictionary Brute Force, and the Spoofing category contains DNS Spoofing and MITM ARP Spoofing attacks. Greeth Flood, GreIP Flood and UDPPlain attacks are included in the Mirai category.
The CIC_IoT_Dataset2023 uses statistical traffic features extracted from packet capture files to represent each network flow. It includes 45–46 features of numeric values extracted from flow-level data descriptions of temporal, statistical and protocol-level characteristics of a network communication. These features are flow duration, header length, protocol type, packet rate, source and destination traffic rates, TCP flag statistics, inter-arrival time (IAT), packet size statistics, magnitude, radius, covariance, total packet size and total packet count. The flow-level characteristics were used as input features for deep learning model training and evaluation in this study. Table 1 also illustrates each attack category along with details.

3.2. Data Preparation

During preprocessing, categorical labels were encoded into numerical values. For example, attack labels such as “DNS_Spoofing” and “CommandInjection” were transformed into integer class identifiers. Features with missing values were imputed using column means. After normalization, all feature values were scaled into the [0, 1] range using Min–Max scaling. Additionally, a multi-step preprocessing pipeline was put together to make sure that the data were of good quality and that the model performance was high.
(1) Data Cleaning:
All non-numeric attributes were either removed or converted. Missing values were replaced with the mean values of the columns. Duplicate records were checked, and if there were any, they were removed so that the model would not be biased.
(2) Feature Scaling:
As features had different numeric ranges, Min–Max normalization was used to scale all the values between 0 and 1. This facilitates training to be more stable, and the large-value features do not get to dominate gradient updates.
(3) Handling Class Imbalance (SMOTE):
As some attack categories had a very small number of samples compared to others, the Synthetic Minority Oversampling Technique (SMOTE) was employed to create artificially but statistically consistent samples for the minority classes. This made sure that the model did not get biased toward the most frequent attack types, and therefore, its ability to detect rare or low-frequency attacks was enhanced.
(4) Data Splitting:
The dataset was first divided into training (80%) and testing (20%) subsets using stratified sampling. During the avoidance of data leakage, SMOTE was applied only to the training dataset. The test dataset remained unchanged and retained the original class distribution for unbiased evaluation. The division ensured that both sets contained all the categories of attacks—common and rare.
In Table 2, the results indicate that SMOTE improved minority attack detection performance across all models. The largest improvement was observed in recall values for underrepresented attack classes.
Table 3 presents the class-wise effect of SMOTE on selected CIC_IoT_Dataset2023 classes where valid F1-score values were available before and after oversampling. The results indicate that SMOTE provides the largest improvements for minority attack categories, particularly Uploading Attack (+26.23%), SQL Injection (+21.54%), XSS (+19.12%), and Mirai-UDPPlain (+16.67%). In contrast, the benign class shows no change after applying SMOTE, indicating that oversampling mainly benefits underrepresented attack categories rather than majority classes. These findings demonstrate that SMOTE improves minority-class representation and enhances the model’s ability to detect less frequent attack behaviors.

3.3. LSTM Model Architecture

A standalone Long Short-Term Memory (LSTM) model was chosen primarily because of its capability to learn sequential patterns in network traffic. LSTM networks are a type of neural network architecture to solve the vanishing gradient problem and remember long-term dependencies; hence, they are the best fit for time-series cyberattack detection.
In Table 4, a unidirectional LSTM layer with 128 hidden units was employed. Bidirectional LSTM was not used in this study to maintain a lightweight architecture suitable for deployment in resource-constrained IoT environments. The model architecture utilized in this study comprised the following:
  • Input Layer: The layer that takes in the normalized numerical features.
  • LSTM Layer: The main hidden layer that can learn the time-based and sequential behavior of network traffic. This layer captures not only short but also long temporal dependencies.
  • Dense (Fully Connected) Layer: The layer that compresses the learned representations into more understandable features for classification.
  • Output Layer: A SoftMax-based multi-class classifier that labels each sample with one of the attack or normal categories.
To ward off overfitting and to enhance the model’s generalization capability, a dropout mechanism was introduced. The model was compiled with the Adam optimizer and categorical cross-entropy was used as the loss function.
In this work, the goal is to compare the representative models with the standalone deep learning models in the same experimental settings and not against highly optimized hybrid architecture. In recent years, CNN–LSTM, BiLSTM, and attention-based models have generally reported better performance; however, most of these models have greater complexity in computation and different preprocessing pipelines that make it difficult to directly compare the models.

3.4. Model Training Setup

The model was trained on the balanced dataset created by SMOTE to make sure that the model learned equally from all attack categories. The training parameters were as follows:
  • Epochs: 20.
  • Batch Size: 64.
  • Optimizer: Adam.
  • Loss Function: Categorical Cross-Entropy.
  • Evaluation Metrics: Accuracy, Precision, Recall, and F1-Score.
The training was performed with Python and TensorFlow on Google Colab. Early stopping was used to stop overfitting and to halt the training process automatically when the validation loss stopped improving.

3.5. Performance Evaluation

To evaluate the efficiency of the model in recognizing various attacks, global and local class-wise evaluation methods were employed.
(1) Standard Metrics:
The model’s overall detection capability was verified by computing accuracy, precision, recall, and F1-score. These metrics are usually implemented in IDS studies as they open the way to the understanding of false-positives, false-negatives, and classification reliability.
(2) Confusion Matrix:
The LSTM’s attack category identification extent was represented by means of a multi-class confusion matrix. On the diagonal, the matrix pointed out the correctly classified samples, and in the off-diagonal cells, it displayed the misclassifications. The stage was instrumental in identifying attacks that the model could easily or hardly distinguish.
(3) Comparative Analysis:
The LSTM model’s work was put side by side with that of three other deep learning models—RNN, CNN, and DNN—to decide which was better. The LSTM was the best one because, although all the models used the same dataset, LSTM could handle time-based dependencies in traffic sequences.

3.6. Research Workflow Summary

  • The entire methodology can be summarized in the following steps:
  • Load CIC_IoT_Dataset2023.
  • Clean and normalize the features.
  • Balance dataset using SMOTE.
  • Split into training and testing sets.
  • Build an LSTM-based intrusion detection model.
  • Train using optimized parameters and early stopping.
  • Evaluate performance with metrics and confusion matrices.
  • Compare results with RNN, CNN, and DNN.
This systematic flow, as depicted in Figure 1, guarantees the reliability, repeatability and compliance of the results to meet the intrusion detection needs of the IoT networks in practice.

4. Results

Several deep learning models are presented and analyzed on the CIC_IoT_Dataset2023 for cyberattack detection. The main focus is to compare the performance of the LSTM model with other models, such as RNN, CNN and DNN. All the models were trained with time-series data of network traffic, and the network data were pre-processed with common techniques like class balance (SMOTE). We evaluated the models using widely used performance metrics such as accuracy, precision, recall, and F1-score.

4.1. Modeling and Results Interpretation

4.1.1. RNN

The accuracy of the RNN model in Figure 2 was 73%. It appears to be accurate in forecasting most attacks. Attacks that were easily detected were Mirai-UDPPlain and Uploading_Attack for recognition and recall, but Recon-PortScan was difficult to discover. The value of precision was 0.72, the recall value was 0.73, and the F1-score was 0.71, indicating fair performance with complexity issues on multi-class recognition; simple patterns were found to be effective on RNN but they failed to perform on rare or more complex attacks.
The accuracy rate of the RNN model was plotted in Figure 3, which was 73%. RNNs can deal with sequences, but they have the problem of the vanishing gradient, in which it is difficult to keep long-term information. Consequently, their performance was less effective compared to LSTM, particularly for detecting long-duration attacks.
Figure 4 illustrates the confusion matrix, showing how the RNN model predicted each type of attack and normal traffic. The model’s prediction is displayed in each column, and the actual class is displayed in each row. Darker boxes represent a greater value or more accurate prediction. We can observe from the matrix that the RNN model was able to identify a lot of attacks, such as Mirai-UDPPlain, Uploading_Attack, and XSS, which are given a high value on the diagonal. In one instance, 3814 samples of Mirai-UDPPlain were correctly classified, and 3619 XSS attacks were also identified correctly. However, it has a couple of misclassifications. In this case, the model failed to distinguish between BrowserHijacking, BenignTraffic, DictionaryBruteForce and DNS_Spoofing. The overlapping predictions suggest that the RNN model confuses similar attack types or has trouble with noisy data some of the time. This is one of the recognized weaknesses of RNNs, that they do not retain information over time, affecting their ability to identify complex and similar patterns over time. They can accurately identify some attacks but less accurately than other models like LSTM.

4.1.2. CNN

The CNN model was able to achieve an accuracy level of 78% and performed particularly well for attacks like Mirai-UDPPlain, Uploading_Attack, and VulnerabilityScan, as shown in Figure 5. Good results were also obtained for CommandInjection and XSS. However, it failed to cope with attacks such as DNS Spoofing and Recon-PortScan. The precision was 0.77, the recall was 0.78 and the F1-score was 0.77, which indicates moderate but balanced performance. While CNNs were able to effectively learn simple patterns, they struggled with time-based attacks or others.
Although CNNs are generally used for image data, they performed reasonably with an estimated accuracy of 78%, as shown in Figure 6. The CNN model works for spatial data, but it is not suited for sequential attack data, like attack data from time series, as it lacks the natural ability to learn about time dependencies. But still, it was able to detect many varieties of attacks effectively, owing to its good feature extraction ability.
The CNN model’s confusion matrix is shown in Figure 7, which indicates its ability to classify all the cyberattacks and regular traffic. Each cell has the following information: actual and anticipated numbers of samples in each class; the darker the color of the cell, the more likely and accurate the model’s prediction was. Based on the data, CNN identified many types of assaults with high accuracy. For instance, it precisely identified BrowserHijacking—3848, Command injection—3448, Uploading Attack—3785, and XSS assaults—3.750. It also performed in other classes, such as Recon-PingSweep and VulnerabilityScan, showing that CNN could detect crucial aspects from various attacks. There are still some misclassifications that can be observed, however. Some were mistakenly identified as attack classes when they were actually benign traffic, for example, and some were misidentified as neighboring classes, such as PortScan for Recon-OSSCan. This indicates that CNN works in spatial pattern recognition, but can miss subtle temporal behavior that is often vital in recognizing more complex or slower moving threats.

4.1.3. DNN

As depicted in Figure 8, the DNN model achieved the highest accuracy, 76%, in the Uploading_Attack, VulnerabilityScan and Mirai-UDPPlain tests, with the F1-score being high. For CommandInjection and XSS, the performance was quite satisfactory. Recon-PortScan and DNS Spoofing were problematic, while BenignTraffic only got average results. In general, the detection systems achieved a high specify rate, an average precision of 0.75, a recall of 0.76 and an F1-score of 0.75, except for a few types of attacks.
The accuracy graph of the DNN model displays an accuracy of approximately 76%, as depicted in Figure 9. It is made up of multiple fully connected layers capable of learning complex patterns in data. However, DNNs are not temporally aware, which restricts their ability to identify time-dependent behavior in network traffic. Nevertheless, they are accurate, easier to train, and serve as a good baseline model.
As can be seen from the confusion matrix in Figure 10, the DNN model performed well in identifying several types of attacks. It correctly identified a fairly large number of Mirai-UDPPlain (3811 samples), XSS (3819 samples) and Uploading_Attack (3803 samples), and the diagonal values are quite high. Even with these positive results, there are a few erroneous classifications. Slightly confusing for the model were BenignTraffic, which was viewed as either Recon-PingSweep or Recon-OSScan, and DNS_Spoofing, which was viewed as DictionaryBruteForce. As seen in these errors, there seems to be some similarity in attacks, making it more difficult for the DNN model to distinguish. In general, the DNN model is good at detecting the different attacks, but there are some discrepancies in the recognition results that indicate that it can be improved by making further modifications or combining it with other models, particularly to better differentiate between similar attacks.

4.1.4. LSTM

The performance of the LSTM model was the best with 80% accuracy, as shown in Figure 11; this model performed well in most of the attack types. For Mirai-UDPPlain, Uploading_Attack, and VulnerabilityScan, it had perfect, or nearly perfect results. It also protected against CommandInjection, XSS and BrowserHijacking. The overall value of precision was 0.79 and the recall was 0.80, and an F1-score of 0.79 means that the detection was good. It is clear from the above that LSTM was able to learn time-based patterns and outperformed the other models.
As a variant of the recurrent neural network, LSTM is suitable for time-series network traffic analysis, as it is capable of dealing with long-term dependency in sequential data, achieving 80% accuracy in the graph shown in Figure 12. Its gated structure enables relevant information to be preserved over longer sequences, thus enhancing the ability to detect fast and slow-evolving attack patterns. This helps us towards the target to create an efficient intrusion detection system with the help of a standalone LSTM model.
In Figure 13, this confusion matrix shows that the LSTM model performed extremely well in detecting various forms of network attacks and normal traffic. The high counts along the diagonal boxes indicate that it accurately identified most samples across practically all categories. The model performed well in recognizing Mirai-UDPPlain (3815 accurately categorized), XSS (3803), and Uploading_Attack (3803). These findings show that LSTM can accurately detect frequent and modern threats. In addition, the model worked to detect many attack categories, which often share similar patterns. For instance, it had very good performance for Backdoor_Malware (3698) and Command Injection (3510) and did not make any mistakes. Overall, the LSTM model is capable of a variety of threat detection with a high level of accuracy and consistency, which confirms the efficiency of such an approach in the network security domain for intrusion detection. It is capable of complex pattern and sequence recognition, which is desirable for such a security need.

4.2. Comparative Analysis

From these comparisons in Table 5, it is obvious that LSTM is a good choice for cyberattack detection in time series network data. Its architecture makes it capable of not only memorizing patterns over time but also adapting to changes in traffic patterns, which is a necessary property in real-world cybersecurity systems. In assuring fair comparison, all models (RNN, CNN, DNN, and LSTM) used the same preprocessing pipeline, including Min–Max normalization, identical train-test splits, identical feature sets, and SMOTE-based balancing applied only to the training subset. Each model was trained and evaluated over ten independent runs with different random seeds. Mean accuracy and standard deviation are illustrated in Table 6.
A paired t-test confirmed that the performance improvement of LSTM over CNN was statistically (p < 0.05).
In Figure 14, the graph clearly shows that LSTM reached a peak of 80%, DNN reached 77%, and CNN reached 78%. For the RNN model, the lowest accuracy was 73%. In identifying cyberattacks, this comparison shows LSTM’s outperformance. The outperformance is specifically apparent within time-based network traffic. It recognizes complex attack patterns through sequential data interpretation, giving it advantages in accuracy and reliability. CNN and DNN did perform well, in general. However, they struggled in detecting the timing of the attacks, which is a critical factor for intrusion detection tasks. In contrast, RNN struggled to retain long-term information, and this resulted in lower performance.
The hyperparameters were determined by empirical testing and common deep learning procedures. A learning rate of 0.001 was used with the Adam optimizer to ensure stable convergence. The choice of a batch size of 64 was designed to optimize the training efficiency and memory utilization, while a dropout rate of 0.2 was used to prevent an overfitting phenomenon. The maximum number of training epochs was also set at 20, as the models always converged after that number of epochs.
To enhance generalization, an early stopping strategy was used. The training data were split into 80% training and 20% validation. The validation loss was tracked after each epoch, and the training was terminated if there was no improvement for five epochs in a row (patience = 5). The model weights that gave the lowest validation loss were loaded for testing.
All experiments were run in the Google Colab environment with an NVIDIA Tesla T4 GPU (12 Gb of VRAM) and an Intel Xeon CPU. The models were written in Python 3.11, TensorFlow 2.16, Keras, NumPy, Pandas, and Scikit-learn. Python, NumPy and TensorFlow were run with a fixed random seed value of 42 to ensure reproducibility.
For each model, we repeated 10 training-and-testing cycles with different random initializations but identical train-test splits. The results presented in Table 4 are the mean accuracy and standard deviations (SD).

5. Discussions

The main point emerging from this research is that the success of deep learning models is to a very large extent hinged on their ability to comprehend the sequential nature of behavior in IoT network traffic. The study has unequivocally demonstrated that among the different types of deep learning models, LSTM attained the highest level of performance, being 80% accurate. LSTM is very suitable for detecting cyberattacks that occur temporally, as revealed by this result, which is in line with the known capabilities of LSTM networks that involve memory cells and gating mechanisms to hold the most relevant information for a long time. The LSTM method benefited from IoT traffic in which the attacks were slow-changing or stepwise, and it was therefore able to correctly classify both frequent and rare attacks because of its ability to learn temporal dependencies.
While CNN and DNN were able to achieve quite good accuracy scores of 78% and 76%, respectively, their shortcomings in tightly coupled time-related attack classification became apparent. CNN is characteristically good at spatial pattern recognition, which is a strength in the detection of attacks with distinguished feature patterns; for example, XSS and Command Injection. However, the temporal context of DNS_Spoofing and other Reconnaissance attacks was a challenge to it. Likewise, the DNN model had the potential to uncover the most complex of the feature relationships that it faced, and yet it was unable to handle the progression part of the network activity over time. The models performed in simpler attack scenarios but were less consistent with multi-stage attacks.
Recurrent neural networks (RNNs) had the worst performance, with an accuracy of 73%. One of the major reasons for this was their inability to effectively work with long sequences. The symptom of the vanishing gradient problem was what limited its power—to hold on to the earlier input—while at the same time, it caused it to confuse attack types that were very similar. This evidence supports the notion that ordinarily, RNNs cannot be used as an intrusion detection tool when the tasks involve long sequential patterns.
The use of SMOTE was instrumental in the performance upsurge of the detection of rare attacks, that is, the main point of concern for the focus of this research work. The dataset used for the research was imbalanced in that benign traffic was two or three times more common than the attack samples. Following the implementation of SMOTE, the models—especially LSTM—were able to learn more balanced representations that helped them reduce bias towards the majority classes. This is proof that if data imbalance is not addressed properly in cybersecurity research, the result will be erroneous evaluations.
In general, the outcomes of this research portray the existence of a link between model architecture and attack characteristics. Temporally aware models that retain information best in fast-changing IoT scenarios and time-sensitive deep learning frameworks, such as LSTM, can be very good at uncovering the evolvement of cyberattacks or the fact that they are multi-staged. Although the proposed LSTM model demonstrated promising performance on the CIC_IoT_Dataset2023, additional experiments on datasets such as CICIDS2017, UNSW-NB15, BoT-IoT, and TON_IoT are required to fully assess model generalizability. Future work will evaluate cross-dataset performance and domain adaptation capabilities.

6. Conclusions and Future Work

The research presented here is that the Long Short-Term Memory (LSTM) machine learning technique can, when trained on a very diverse range of cyberattacks, find network traffic coming from Internet of Things (IoT) devices that are attacked in widely different ways. By employing a dataset called CIC_IoT_Dataset2023, consisting of up-to-date attacks on the Internet of Things, the proposed LSTM achieved an accuracy of 80%, exceeding the strongest baseline by approximately 2%. It is composed of sequential-based learning, which makes it more feasible to locate attacks that are built up slowly and also incidents that might be multi-step in nature. The LSTM has, to a lesser extent, been able to keep up its eligibility for various occurrences of intrusions, and hence, it could be a more stable method when comparing these four techniques: the convolutional neural network (CNN), the deep neural network (DNN), the recurrent neural network (RNN), and LSTM. In addition to the use of SMOTE, the minority of attack classes had their performances further raised, which is crucial in real-world situations where attacks appear less frequently than normal traffic. The statement that time-dependent cyberattack models are known as far as the security of IoT is concerned is strengthened by these experimental results. The research findings suggest that the LSTM neural network, designed properly, should solve the problem of infection detection, and one should not be in want of intricate hybrid architecture. This is because the model in question attains a very high level of precision, can carry out the same task equally for different data groups, and adapts easily to sequential data. Hence, it is suitable for deployment in real-time systems. Upcoming research may add to this work by exploring model compression to make LSTM more efficient, looking into federated learning to improve privacy levels, and adding explainable AI so that security analysts are facilitated in their decision-making. Thus, LSTM-based IDS models can play a pivotal role in paving the way for a more secure, intelligent, and scalable cybersecurity framework. However, there are a number of limitations to this study. First, experiments were performed using only the CIC_IoT_Dataset2023 dataset. Secondly, the model was tested in an offline environment instead of real deployment in an IoT environment. Thirdly, only deep learning models that were used independently were explored, and other architecture such as hybrid or transformer-based models were not included. Going forward, cross-dataset validation, real-time deployment, and light-weight explainable intrusion detection frameworks will be explored. The proposed methodology is tested with the CIC_IoT_Dataset2023, as it is a recent and comprehensive database of IoT attacks as a benchmark. However, testing the approach on other public datasets like TON_IoT, Bot-IoT, IoT-23 or CICIDS2017 would further prove the generalizability of the model and is intended for future work.

Author Contributions

J.H.A.: Conceptualization, Methodology, Formal analysis, Investigation, Writing—original draft. M.S.: Software, Data curation, Validation. M.A.S.: Resources, Visualization, Supervision, Project administration. M.Y.K.: Visualization, Methodology, Funding, Investigation, Writing—review and editing. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education (RS-2021-NR060127), as well as the Korea Institute for Advancement of Technology (KIAT) funded by the Ministry of Trade, Industry and Resources (P0020536, The Competency Development Program for Industry Specialists). In addition, this research was supported by the 2026 National University Development Project funded by the Ministry of Education, Republic of Korea.

Institutional Review Board Statement

Not Applicable.

Informed Consent Statement

Not Applicable.

Data Availability Statement

The data supporting the findings of this research were obtained from the CIC_IoT_Dataset2023 dataset on Kaggle.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Kortuem, G.; Bandara, A.K.; Smith, N.; Richards, M.; Petre, M. Educating the Internet-of-Things Generation. Computer 2013, 46, 53–61. [Google Scholar] [CrossRef] [Scilit]
  2. Hamidi, H. An approach to develop the smart health using Internet of Things and authentication based on biometric technology. Future Gener. Comput. Syst. 2019, 91, 434–449. [Google Scholar] [CrossRef] [Scilit]
  3. Aslan, Ö.; Aktuğ, S.S.; Ozkan-Okay, M.; Yilmaz, A.A.; Akin, E. A comprehensive review of cyber security vulnerabilities, threats, attacks, and solutions. Electronics 2023, 12, 1333. [Google Scholar] [CrossRef] [Scilit]
  4. Keshavamurthy, P.; Kulkarni, S. Early detection of reconnaissance attacks on IoT devices by analyzing performance and traffic characteristics. In Proceedings of the 2023 IEEE International Conference on Cyber Security and Resilience (CSR), Venice, Italy, 31 July–2 August 2023; pp. 187–193. [Google Scholar] [CrossRef] [Scilit]
  5. Menoni, S.; Molinari, D.; Parker, D.; Ballio, F.; Tapsell, S. Assessing multifaceted vulnerability and resilience in order to design risk-mitigation strategies. Nat. Hazards 2012, 64, 2057–2082. [Google Scholar] [CrossRef] [Scilit]
  6. Yalçın, N.; Çakır, S.; Ünaldı, S. Attack detection using artificial intelligence methods for SCADA security. IEEE Internet Things J. 2024, 11, 39550–39559. [Google Scholar] [CrossRef] [Scilit]
  7. Ji, R.; Padha, D.; Singh, Y.; Sharma, S. Review of intrusion detection system in cyber-physical system based networks: Characteristics, industrial protocols, attacks, data sets and challenges. Trans. Emerg. Telecommun. Technol. 2024, 35, e5029. [Google Scholar] [CrossRef] [Scilit]
  8. Marchal, S.; Jiang, X.; State, R.; Engel, T. A big data architecture for large scale security monitoring. In Proceedings of the 2014 IEEE International Congress on Big Data, Anchorage, AK, USA, 27 June–2 July 2014; pp. 56–63. [Google Scholar] [CrossRef] [Scilit]
  9. 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] [Scilit]
  10. Sarker, I.H. Deep cybersecurity: A comprehensive overview from neural network and deep learning perspective. SN Comput. Sci. 2021, 2, 154. [Google Scholar] [CrossRef] [Scilit]
  11. Muhuri, P.S.; Chatterjee, P.; Yuan, X.; Roy, K.; Esterline, A. Using a long short-term memory recurrent neural network (LSTM-RNN) to classify network attacks. Information 2020, 11, 243. [Google Scholar] [CrossRef] [Scilit]
  12. Hirsi, A.; Alhartomi, M.A.; Audah, L.; Salh, A.; Sahar, N.b.M.; Ahmed, S.; Ansa, G.O.; Farah, A. Comprehensive analysis of DDoS anomaly detection in software-defined networks. IEEE Access 2025, 13, 23013–23071. [Google Scholar] [CrossRef] [Scilit]
  13. Yu, Y.; Si, X.; Hu, C.; Zhang, J. A review of recurrent neural networks: LSTM cells and network architectures. Neural Comput. 2019, 31, 1235–1270. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  14. Kumar, J.; Goomer, R.; Singh, A.K. Long short term memory recurrent neural network (LSTM-RNN) based workload forecasting model for cloud datacenters. Procedia Comput. Sci. 2018, 125, 676–682. [Google Scholar] [CrossRef] [Scilit]
  15. Khan, M.; Karim, M.; Kim, Y. A scalable and hybrid intrusion detection system based on the convolutional-LSTM network. Symmetry 2019, 11, 583. [Google Scholar] [CrossRef] [Scilit]
  16. Halbouni, A.; Gunawan, T.S.; Habaebi, M.H.; Halbouni, M.; Kartiwi, M.; Ahmad, R. CNN-LSTM: Hybrid deep neural network for network intrusion detection system. IEEE Access 2022, 10, 99837–99849. [Google Scholar] [CrossRef] [Scilit]
  17. Santoso, B.; Wijayanto, H.; Notodiputro, K.A.; Sartono, B. Synthetic over sampling methods for handling class imbalanced problems: A review. IOP Conf. Ser. Earth Environ. Sci. 2017, 58, 012031. [Google Scholar] [CrossRef] [Scilit]
  18. Karatas, G.; Demir, O.; Sahingoz, O.K. Increasing the performance of machine learning-based IDSs on an imbalanced and up-to-date dataset. IEEE Access 2020, 8, 32150–32162. [Google Scholar] [CrossRef] [Scilit]
  19. Miller, D.J.; Xiang, Z.; Kesidis, G. Adversarial learning targeting deep neural network classification: A comprehensive review of defenses against attacks. Proc. IEEE 2020, 108, 402–433. [Google Scholar] [CrossRef] [Scilit]
  20. Dasgupta, D.; Akhtar, Z.; Sen, S. Machine learning in cybersecurity: A comprehensive survey. J. Def. Model. Simul. Appl. Methodol. Technol. 2022, 19, 57–106. [Google Scholar] [CrossRef] [Scilit]
  21. Zhang, B.; Wu, J.L.; Chang, P.C. A multiple time series-based recurrent neural network for short-term load forecasting. Soft Comput. 2018, 22, 4099–4112. [Google Scholar] [CrossRef] [Scilit]
  22. Yin, C.; Zhu, Y.; Fei, J.; He, X. A deep learning approach for intrusion detection using recurrent neural networks. IEEE Access 2017, 5, 21954–21961. [Google Scholar] [CrossRef] [Scilit]
  23. Wood, R.; Baxter, P.; Belpaeme, T. A review of long-term memory in natural and synthetic systems. Adapt. Behav. 2012, 20, 81–103. [Google Scholar] [CrossRef] [Scilit]
  24. Mohammadpour, L.; Ling, T.C.; Liew, C.S.; Aryanfar, A. A survey of CNN-based network intrusion detection. Appl. Sci. 2022, 12, 8162. [Google Scholar] [CrossRef] [Scilit]
  25. Anand, A.; Rani, S.; Anand, D.; Aljahdali, H.M.; Kerr, D. An efficient CNN-based deep learning model to detect malware attacks (CNN-DMA) in 5G-IoT healthcare applications. Sensors 2021, 21, 6346. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  26. Shyaa, M.A.; Ibrahim, N.F.; Zainol, Z.; Abdullah, R.; Anbar, M.; Alzubaidi, L. Evolving cybersecurity frontiers: A comprehensive survey on concept drift and feature dynamics aware machine and deep learning in intrusion detection systems. Eng. Appl. Artif. Intell. 2024, 137, 109143. [Google Scholar] [CrossRef] [Scilit]
  27. Sainath, T.N.; Vinyals, O.; Senior, A.; Sak, H. Convolutional, long short-term memory, fully connected deep neural networks. In Proceedings of the 2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), South Brisbane, Australia, 19–24 April 2015; pp. 4580–4584. [Google Scholar] [CrossRef] [Scilit]
  28. Tang, C.; Luktarhan, N.; Zhao, Y. SAAE-DNN: Deep learning method on intrusion detection. Symmetry 2020, 12, 1695. [Google Scholar] [CrossRef] [Scilit]
  29. Musa, A.A.; Hussaini, A.; Liao, W.; Liang, F.; Yu, W. Deep neural networks for spatial-temporal cyber-physical systems: A survey. Future Internet 2023, 15, 199. [Google Scholar] [CrossRef] [Scilit]
  30. Hussain, H.; Tamizharasan, P.S.; Rahul, C.S. Design possibilities and challenges of DNN models: A review on the perspective of end devices. Artif. Intell. Rev. 2022, 55, 5109–5167. [Google Scholar] [CrossRef] [Scilit]
  31. Sherstinsky, A. Fundamentals of recurrent neural network (RNN) and long short-term memory (LSTM) network. Phys. D Nonlinear Phenom. 2020, 404, 132306. [Google Scholar] [CrossRef] [Scilit]
  32. Cui, Z.; Ke, R.; Pu, Z.; Wang, Y. Stacked bidirectional and unidirectional LSTM recurrent neural network for forecasting network-wide traffic state with missing values. Transp. Res. Part C Emerg. Technol. 2020, 118, 102674. [Google Scholar] [CrossRef] [Scilit]
  33. Padmavathi, B.; Muthukumar, B. A deep recursively learning LSTM model to improve cyber security botnet attack intrusion detection. Int. J. Model. Simul. Sci. Comput. 2023, 14, 2341018. [Google Scholar] [CrossRef] [Scilit]
  34. Bashaiwth, A.; Binsalleeh, H.; AsSadhan, B. An explanation of the LSTM model used for DDoS attacks classification. Appl. Sci. 2023, 13, 8820. [Google Scholar] [CrossRef] [Scilit]
  35. Kaur, S.; Singh, M. Hybrid intrusion detection and signature generation using deep recurrent neural networks. Neural Comput. Appl. 2020, 32, 7859–7877. [Google Scholar] [CrossRef] [Scilit]
  36. Al-Abassi, A.; Karimipour, H.; Dehghantanha, A.; Parizi, R.M. An ensemble deep learning-based cyber-attack detection in industrial control system. IEEE Access 2020, 8, 83965–83973. [Google Scholar] [CrossRef] [Scilit]
  37. Shurman, M.; Khrais, R.; Yateem, A. DoS and DDoS attack detection using deep learning and IDS. Int. Arab J. Inf. Technol. 2020, 17, 655–661. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  38. Smys, S.; Basar, A.; Wang, H. Hybrid intrusion detection system for Internet of Things (IoT). J. ISMAC 2020, 2, 190–199. [Google Scholar] [CrossRef] [Scilit]
  39. Kumar, P.; Kumar, A.A.; Sahayakingsly, C.; Udayakumar, A. Analysis of intrusion detection in cyber attacks using deep learning neural networks. Peer-To-Peer Netw. Appl. 2021, 14, 2565–2584. [Google Scholar] [CrossRef] [Scilit]
  40. Panagiotou, P.; Mengidis, N.; Tsikrika, T.; Vrochidis, S.; Kompatsiaris, I. Host-based intrusion detection using signature-based and AI-driven anomaly detection methods. Inf. Secur. Int. J. 2021, 50, 37–48. [Google Scholar] [CrossRef] [Scilit]
  41. Otoum, Y.; Nayak, A. AS-IDS: Anomaly and signature based IDS for the Internet of Things. J. Netw. Syst. Manag. 2021, 29, 23. [Google Scholar] [CrossRef] [Scilit]
  42. Sahingoz, O.K.; Cekmez, U.; Buldu, A. Internet of Things (IoTs) security: Intrusion detection using deep learning. J. Web Eng. 2021, 20, 1721–1760. [Google Scholar] [CrossRef] [Scilit]
  43. Al, S.; Dener, M. STL-HDL: A new hybrid network intrusion detection system for imbalanced dataset on big data environment. Comput. Secur. 2021, 110, 102435. [Google Scholar] [CrossRef] [Scilit]
  44. Gowdhaman, V.; Dhanapal, R. An intrusion detection system for wireless sensor networks using deep neural network. Soft Comput. 2022, 26, 13059–13067. [Google Scholar] [CrossRef] [Scilit]
  45. Khan, M.A. HCRNNIDS: Hybrid convolutional recurrent neural network-based network intrusion detection system. Processes 2021, 9, 834. [Google Scholar] [CrossRef] [Scilit]
  46. Zhong, M.; Zhou, Y.; Chen, G. Sequential model based intrusion detection system for IoT servers using deep learning methods. Sensors 2021, 21, 1113. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  47. Alkahtani, H.; Aldhyani, T.H.H. Intrusion detection system to advance Internet of Things infrastructure-based deep learning algorithms. Complexity 2021, 2021, 5579851. [Google Scholar] [CrossRef] [Scilit]
  48. Liu, L.; Wang, P.; Lin, J.; Liu, L. Intrusion detection of imbalanced network traffic based on machine learning and deep learning. IEEE Access 2021, 9, 7550–7563. [Google Scholar] [CrossRef] [Scilit]
  49. Ashiku, L.; Dagli, C. Network intrusion detection system using deep learning. Procedia Comput. Sci. 2021, 185, 239–247. [Google Scholar] [CrossRef] [Scilit]
  50. Imrana, Y.; Xiang, Y.; Ali, L.; Abdul-Rauf, Z. A bidirectional LSTM deep learning approach for intrusion detection. Expert Syst. Appl. 2021, 185, 115524. [Google Scholar] [CrossRef] [Scilit]
  51. Srilatha, D.; Thillaiarasu, N. DDoSNet: A deep learning model for detecting network attacks in cloud computing. In Proceedings of the 2022 4th International Conference on Inventive Research in Computing Applications (ICIRCA), Coimbatore, India, 21–23 September 2022; pp. 576–581. [Google Scholar] [CrossRef] [Scilit]
  52. Qazi, E.H.; Imran, M.; Haider, N.; Shoaib, M.; Razzak, I. An intelligent and efficient network intrusion detection system using deep learning. Comput. Electr. Eng. 2022, 99, 107764. [Google Scholar] [CrossRef] [Scilit]
  53. Ravi, V.; Chaganti, R.; Alazab, M. Recurrent deep learning-based feature fusion ensemble meta-classifier approach for intelligent network intrusion detection system. Comput. Electr. Eng. 2022, 102, 108156. [Google Scholar] [CrossRef] [Scilit]
  54. Hnamte, V.; Hussain, J. DCNNBiLSTM: An efficient hybrid deep learning-based intrusion detection system. Telemat. Inform. Rep. 2023, 10, 100053. [Google Scholar] [CrossRef] [Scilit]
  55. Agoramoorthy, M.; Ali, A.; Sujatha, D.; Raj, T.F.; Ramesh, G. An analysis of signature-based components in hybrid intrusion detection systems. In Proceedings of the 2023 Intelligent Computing and Control for Engineering and Business Systems (ICCEBS), Chennai, India, 14–15 December 2023; pp. 1–5. [Google Scholar] [CrossRef] [Scilit]
  56. Awajan, A. A novel deep learning-based intrusion detection system for IoT networks. Computers 2023, 12, 34. [Google Scholar] [CrossRef] [Scilit]
  57. Wang, Z.; Chen, H.; Yang, S.; Luo, X.; Li, D.; Wang, J. A lightweight intrusion detection method for IoT based on deep learning and dynamic quantization. PeerJ Comput. Sci. 2023, 9, e1569. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  58. Wang, Z.; Li, J.; Yang, S.; Luo, X.; Li, D.; Mahmoodi, S. A lightweight IoT intrusion detection model based on improved BERT-of-Theseus. Expert Syst. Appl. 2024, 238, 122045. [Google Scholar] [CrossRef] [Scilit]
  59. Hnamte, V.; Nhung-Nguyen, H.; Hussain, J.; Hwa-Kim, Y. A novel two-stage deep learning model for network intrusion detection: LSTM-AE. IEEE Access 2023, 11, 37131–37148. [Google Scholar] [CrossRef] [Scilit]
  60. Bhavsar, M.; Roy, K.; Kelly, J.; Olusola, O. Anomaly-based intrusion detection system for IoT application. Discov. Internet Things 2023, 3, 5. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  61. Chaganti, R.; Suliman, W.; Ravi, V.; Dua, A. Deep learning approach for SDN-enabled intrusion detection system in IoT networks. Information 2023, 14, 41. [Google Scholar] [CrossRef] [Scilit]
  62. Saikam, J.; Ch, K. EESNN: Hybrid deep learning empowered spatial–temporal features for network intrusion detection system. IEEE Access 2024, 12, 15930–15945. [Google Scholar] [CrossRef] [Scilit]
  63. Ahmed, U. Signature-based intrusion detection using machine learning and deep learning approaches empowered with fuzzy clustering. Sci. Rep. 2025, 15, 1726. [Google Scholar] [CrossRef] [Scilit] [PubMed]
Figure 1. LSTM model training and evaluation process.
Figure 1. LSTM model training and evaluation process.
Sensors 26 05321 g001
Figure 2. Evaluation metrics for RNN.
Figure 2. Evaluation metrics for RNN.
Sensors 26 05321 g002
Figure 3. RNN accuracy plot.
Figure 3. RNN accuracy plot.
Sensors 26 05321 g003
Figure 4. RNN confusion matrix.
Figure 4. RNN confusion matrix.
Sensors 26 05321 g004
Figure 5. Evaluation metrics for CNN.
Figure 5. Evaluation metrics for CNN.
Sensors 26 05321 g005
Figure 6. CNN accuracy plot.
Figure 6. CNN accuracy plot.
Sensors 26 05321 g006
Figure 7. CNN confusion matrix.
Figure 7. CNN confusion matrix.
Sensors 26 05321 g007
Figure 8. Evaluation metrics for DNN.
Figure 8. Evaluation metrics for DNN.
Sensors 26 05321 g008
Figure 9. DNN accuracy plot.
Figure 9. DNN accuracy plot.
Sensors 26 05321 g009
Figure 10. DNN confusion matrix.
Figure 10. DNN confusion matrix.
Sensors 26 05321 g010
Figure 11. Evaluation metrics for LSTM.
Figure 11. Evaluation metrics for LSTM.
Sensors 26 05321 g011
Figure 12. LSTM accuracy plot.
Figure 12. LSTM accuracy plot.
Sensors 26 05321 g012
Figure 13. LSTM confusion matrix.
Figure 13. LSTM confusion matrix.
Sensors 26 05321 g013
Figure 14. Accuracy comparison of deep learning models for cyber-attack detection.
Figure 14. Accuracy comparison of deep learning models for cyber-attack detection.
Sensors 26 05321 g014
Table 1. Class-wise attack details.
Table 1. Class-wise attack details.
Attack CategoryAttack Types
DDoS (12 attacks)ACK Fragmentation, HTTP Flood, ICMP Flood, ICMP Fragmentation, PSHACK Flood, RSTFIN Flood, SYN Flood, SlowLoris, Synonymous IP Flood, TCP Flood, UDP Flood, UDP Fragmentation
DoS (4 attacks)HTTP Flood, SYN Flood, TCP Flood, UDP Flood
Reconnaissance
(5 attacks)
Host Discovery, OS Scan, Ping Sweep, Port Scan, Vulnerability Scan
Web-Based Attacks (6 attacks)Browser Hijacking, Command Injection, SQL Injection, Uploading Attack, XSS, Backdoor Malware
Brute Force (1 attack)Dictionary Brute Force
Spoofing (2 attacks)DNS Spoofing, MITM ARP Spoofing
Mirai (3 attacks)Greeth Flood, GreIP Flood, UDPPlain
Table 2. SMOTE effect comparison.
Table 2. SMOTE effect comparison.
ModelAccuracy Without SMOTEAccuracy with SMOTE
RNN6873
CNN7478
DNN7176
LSTM7680
Table 3. Class-wise attack details.
Table 3. Class-wise attack details.
Attack CategoryAttack ClassF1-Score Without SMOTEF1-Score with SMOTEImprovement (%)
BenignBenign0.980.980.00
DDoSUDP Flood0.910.95+4.40
Web-BasedSQL Injection0.650.79+21.54
Uploading Attack0.610.77+26.23
XSS0.680.81+19.12
MiraiUDPPlain0.720.84+16.67
Table 4. SMOTE effect comparison.
Table 4. SMOTE effect comparison.
ModelLayersUnits/FiltersDropoutActivation
RNN1 RNN + Dense1280.2ReLU
CNNConv1D + MaxPool + Dense64 filters0.2ReLU
DNNDense-Dense-Dense256-128-640.3ReLU
LSTMLSTM + Dense1280.2ReLU
Table 5. Comparative analysis of deep learning models for cyber attack detection.
Table 5. Comparative analysis of deep learning models for cyber attack detection.
ModelAccuracyStrengthsWeaknesses
RNN0.73Handles sequencesPoor long-term memory
CNN0.78Detects spatial features Not designed for sequential data
DNN0.77High accuracy with simple structureLacks time awareness, weaker with rare attacks
LSTM (Proposed Model)0.80Learning long-term, time-dependent patternsSlower training due to complexity
Table 6. Statistical validation.
Table 6. Statistical validation.
ModelMean Accuracy (%)Std Dev
RNN73.10.8
CNN78.20.5
DNN76.40.6
LSTM80.30.4
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.

Share and Cite

MDPI and ACS Style

Awan, J.H.; Safdar, M.; Shirazi, M.A.; Kim, M.Y. AI-Driven Security: Detecting Cyber Attacks in IoT Networks. Sensors 2026, 26, 5321. https://doi.org/10.3390/s26175321

AMA Style

Awan JH, Safdar M, Shirazi MA, Kim MY. AI-Driven Security: Detecting Cyber Attacks in IoT Networks. Sensors. 2026; 26(17):5321. https://doi.org/10.3390/s26175321

Chicago/Turabian Style

Awan, Jawad Hussain, Misbah Safdar, Muhammad Ayaz Shirazi, and Min Young Kim. 2026. "AI-Driven Security: Detecting Cyber Attacks in IoT Networks" Sensors 26, no. 17: 5321. https://doi.org/10.3390/s26175321

APA Style

Awan, J. H., Safdar, M., Shirazi, M. A., & Kim, M. Y. (2026). AI-Driven Security: Detecting Cyber Attacks in IoT Networks. Sensors, 26(17), 5321. https://doi.org/10.3390/s26175321

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop