Enhancing DDoS Attacks Mitigation Using Machine Learning and Blockchain-Based Mobile Edge Computing in IoT
Abstract
1. Introduction
2. Main Contributions
3. Related Works
4. Proposed Approach
4.1. Architecture Components
- Attacker: The attacker is an external malicious node initiating DDoS attacks, using compromised IoT devices (botnets). The attacker coordinates DDoS attacks by sending commands to the botnets, causing them to overwhelm the target with malicious traffic.
- Botnets: The Botnets consist of compromised IoT devices under the control of the attacker. These devices, now maliciously controlled, send malicious traffic to the target system. They act as intermediaries, carrying out attacks on behalf of the attacker, typically without the knowledge of the IoT device’s owners.
- IoT Network: The IoT network consists of multiple interconnected smart devices, some of which may be compromised (botnet) by an attacker. These devices send both genuine and malicious traffic through the network. All traffic (genuine and malicious) is forwarded to the Gateway for initial processing.
- Gateway: This component manages traffic from the IoT network. It distinguishes between genuine requests (from legitimate users) and malicious requests (from compromised IoT devices). The gateway forwards traffic to the underlying MEC system. Both genuine traffic from legitimate IoT devices/users and malicious traffic from the botnet flow through the gateway, which applies basic checks to the traffic and then forwards it to the Blockchain-enabled MEC nodes for more advanced validation and classification.
- Blockchain-enabled MEC nodes:
- 5.1
- MEC nodes: They provide cloud-computing capabilities and storage closer to the IoT devices by deploying resources at the network edge. This reduces latency, improves data processing speeds, and enhances real-time applications. In this context, the MEC nodes are Blockchain-enabled, meaning they use Blockchain technology for securely storing and managing blacklisted IP addresses and other critical data. Once basic validation is completed, the system interacts with the Blockchain-enabled MEC nodes for further analysis.
- 5.2
- Blockchain: A decentralized ledger storing blacklisted IP addresses. It facilitates distributed storage, ensuring that, once an IP is blacklisted, all MEC nodes can access and retrieve this information. Smart contracts are used to verify whether an incoming IP address is blacklisted or not.
- 5.3
- Base Stations (BSs): These nodes act as access points that enable communication between the IoT network and the MEC nodes. They ensure that traffic from the gateway reaches the MEC nodes for further processing.
- 5.4
- Machine Learning Models: The system employs machine learning models (e.g., KNN, SVM, DT, and RF) to classify traffic and detect malicious patterns. These models are deployed within the MEC nodes to ensure real-time decision-making at the network edge.
- Target Server: The Target Server is the final destination of the genuine requests. The system ensures that only validated traffic reaches this server, preventing it from being overwhelmed by malicious traffic from the botnet.
4.2. Threshold Calculation
4.3. Machine Learning
4.3.1. Dataset Description
4.3.2. Pre-Processing
4.3.3. Feature Selection
4.3.4. ML Models Used
- K-Nearest Neighbors (KNN): The KNN model is a supervised machine-learning technique known for its simplicity and ease of implementation. It classifies data points based on the majority votes of its K nearest neighbors in the feature space [22,23]. It is particularly effective for small datasets but can be computationally expensive for large datasets, especially as the value of ’K’ increases. The performance of KNN can be sensitive to the choice of the K parameter and the distance metric used. The key hyperparameter is the number of neighbors K: we tuned this via grid search using 5-fold cross-validation on the training set, testing values of K from 1 to 15. We found K = 5 to yield the highest validation accuracy, and this value was fixed for the final model.
- Support Vector Machine (SVM): SVM is a robust supervised learning algorithm primarily used for classification, but it can also be applied to regression. Its objective is to identify the optimal hyperplane that best separates classes within the feature space, maximizing the margin between the nearest points, known as support vectors, from each class. SVM excels at capturing complex, non-linear patterns in network traffic, making it highly effective for distinguishing between normal traffic and DDoS attacks [24,25]. We tuned the SVM’s hyperparameters via cross-validation: the RBF kernel coefficient () and the regularization parameter (C) were varied over a grid (, ), seeking to maximize the validation F1-score. The best performance was achieved with and , which we then used in the final model. Our SVM attained robust detection accuracy (∼96.5%) and was effective at capturing complex traffic patterns, yielding high recall in identifying attack flows.
- Decision Tree: Decision Trees are a non-parametric supervised learning model used for both regression and classification tasks. The goal is to construct a tree-based model that predicts target variable values by learning simple decision rules from the data features. This technique requires less data preparation compared to other models. Moreover, Decision Trees are intuitive and easy to interpret, particularly because they can be visualized. In this structure, the internal nodes represent features, the branches denote decision rules, and the leaf nodes deliver the final decision outcomes. Cross-validation showed that setting the maximum depth to 15 and requiring at least five samples per leaf yielded the best generalization. These hyperparameters limited model complexity and overfitting. The resulting decision tree achieved a test accuracy of ∼96.8%—slightly below that of ensembles but with much greater efficiency. With at most 15 conditional checks per input and inference latency of ∼3.5 ms per sample, it is well-suited for edge deployment. Though less expressive than ensembles, it offers a strong, interpretable baseline.
- Random Forest: Random Forest [26] is a supervised machine learning model that builds multiple decision trees from different subsets of the dataset. Each tree makes a prediction, and the final output is determined by the majority vote from all trees. This method helps improve accuracy and reduces the risk of overfitting. It is particularly effective for classification tasks with complex datasets. Random Forest usually uses a “bagging” technique to create an ensemble of decision trees. We configured the Random Forest with 200 trees, beyond which accuracy gains plateaued. Each tree used features per split (), promoting decorrelation. Other parameters followed scikit-learn defaults, with unpruned trees to maximize learning capacity. The model achieved test accuracy, with precision and over recall, indicating strong detection performance and low false alarm rates. Feature importance scores also informed feature selection and offered interpretability. Inference latency averaged ∼16.8 ms per sample—acceptable for many edge scenarios but notably higher than single-tree or LightGBM models. Despite the heavier footprint, Random Forest remains a robust and interpretable benchmark for attack detection.
- Transformer-Based Traffic Analysis: Our model employs a hierarchical self-attention framework to detect complex attack signatures in network traffic. Categorical features are first projected into a dense embedding space, then processed by two transformer encoder layers (each with four attention heads) to capture long-range dependencies across traffic flows. The refined representations pass through a position-wise feedforward network before a sigmoid-activated classification head predicts malicious intent. This approach is particularly effective against multi-stage DDoS attacks, where subtle temporal patterns span extended sequences [27,28]. We designed a lightweight Transformer for edge deployment, using two encoder layers with four attention heads and 128-dimensional embeddings. Categorical inputs were embedded, while numeric features were scaled and concatenated. The model used self-attention to capture long-range patterns, followed by feed-forward layers and a sigmoid output for binary classification. Trained with Adam (learning rate ∼0.001) and dropout regularization, it achieved accuracy and recall on test data—our highest-performing model. Despite its compact design, inference took ∼15.2 ms per flow, highlighting the trade-off between accuracy and speed. Optimization techniques (e.g., quantization) could further improve its edge suitability, but even as-is, it offers top-tier detection within real-time constraints.
- LightGBM: For our gradient boosting framework, we leverage several key optimizations that are specifically beneficial for DDoS detection scenarios. The model employs leaf-wise tree growth rather than level-wise expansion, allowing for faster convergence while maintaining detection accuracy. We implement Gradient-based One-Side Sampling (GOSS) to focus training on more informative instances, significantly improving computational efficiency without compromising performance. The Exclusive Feature Bundling (EFB) technique further enhances processing speed by combining mutually exclusive features, which is particularly valuable given the high-dimensional nature of network traffic data. Additionally, LightGBM’s native support for categorical features eliminates the need for extensive preprocessing while preserving important information in protocol types and other discrete network characteristics. Together, these optimizations create an efficient yet powerful detection system capable of real-time operation at network edges [29]. We configured LightGBM with 200 boosting iterations, which provided near-optimal accuracy in cross-validation. Unlike Random Forest, LightGBM uses shallow, sequentially boosted trees and a leaf-wise growth strategy that accelerates convergence—ideal for handling variable DDoS traffic. To optimize for edge deployment, we enabled Gradient-based One-Side Sampling (GOSS) and Exclusive Feature Bundling (EFB), improving training efficiency with minimal accuracy loss. After tuning the learning rate and num_leaves, the model achieved accuracy, with precision and recall around , and an inference latency of only ∼5.1 ms per sample—the fastest among all models. Given its balance of speed, accuracy, and low resource use, LightGBM was chosen as the primary model for our blockchain-integrated MEC framework.
5. Performance Evaluation
5.1. Evaluation Methodology
5.2. Metrics
- Accuracy: Measures overall prediction correctness:
- Precision: Indicates attack detection reliability:
- Recall: Measures attack detection coverage:
- F1 Score: Balanced metric for imbalanced data:
- Latency: Critical for real-time detection (measured in milliseconds)
5.3. Configurations
- KNN: with Euclidean distance metric (optimized via grid search).
- SVM: RBF kernel with = 0.1 and .
- DT: Pruned with max depth = 15 and min samples leaf = 5.
- RF: 200 estimators with max features = ‘sqrt’.
- Transformer: 2 encoder layers (4 attention heads), 128-dim embeddings.
- LightGBM: 200 estimators with GOSS and EFB optimizations.
- Transformer excels in recall (99.82%), ideal for attack detection.
- LightGBM provides the best speed–accuracy tradeoff (5.1 ms latency).
- RF remains robust with 99.34% precision, while traditional models show acceptable precision (KNN: 95.87%, SVM: 96.55%).
6. Conclusions and Future Works
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Aljuhani, A. Machine Learning Approaches for Combating Distributed Denial of Service Attacks in Modern Networking Environments. IEEE Access 2021, 9, 42236–42264. [Google Scholar] [CrossRef]
- Atzori, L.; Iera, A.; Morabito, G. The Internet of Things: A survey. Comput. Netw. 2010, 54, 2787–2805. [Google Scholar] [CrossRef]
- Weber, R.H. Internet of Things – New security and privacy challenges. Comput. Law Secur. Rev. 2010, 26, 23–30. [Google Scholar] [CrossRef]
- Hekmati, A.; Zhang, J.; Sarkar, T.; Jethwa, N.; Grippo, E.; Krishnamachari, B. Correlation-aware neural networks for DDoS attack detection in IoT systems. IEEE/ACM Trans. Netw. 2024, 32, 3929–3944. [Google Scholar] [CrossRef]
- Luo, Y.; Chen, X.; Ge, N.; Feng, W.; Lu, J. Transformer-based device-type identification in heterogeneous IoT traffic. IEEE Internet Things J. 2022, 10, 5050–5062. [Google Scholar] [CrossRef]
- Ghourabi, A. A security model based on LightGBM and transformer to protect healthcare systems from cyberattacks. IEEE Access 2022, 10, 48890–48903. [Google Scholar] [CrossRef]
- Hallman, R.; Bryan, J.; Palavicini, G., Jr.; Divita, J.; Romero-Mariona, J. IoDDoS—The Internet of Distributed Denial of Service Attacks: A Case Study of the Mirai Malware and IoT-Based Botnets. In Proceedings of the 2nd International Conference on Internet of Things, Big Data and Security, Porto, Portugal, 24–26 April 2017; pp. 47–58. [Google Scholar]
- Kolias, C.; Kambourakis, G.; Stavrou, A.; Voas, J. DDoS in the IoT: Mirai and Other Botnets. Computer 2017, 50, 80–84. [Google Scholar] [CrossRef]
- Abomhara, M.; Køien, G.M. Security and privacy in the Internet of Things: Current status and open issues. In Proceedings of the 2014 International Conference on Privacy and Security in Mobile Systems (PRISMS), Aalborg, Denmark, 11–14 May 2014; pp. 1–8. [Google Scholar]
- Kumari, P.; Jain, A.K. A comprehensive study of DDoS attacks over IoT network and their countermeasures. Comput. Secur. 2023, 127, 103096. [Google Scholar] [CrossRef]
- Antonakakis, M.; April, T.; Bailey, M.; Bernhard, M.; Bursztein, E.; Cochran, J.; Durumeric, Z.; Halderman, J.A.; Arbor, A.; Invernizzi, L.; et al. Understanding the Mirai Botnet. In Proceedings of the 26th USENIX Security Symposium (USENIX Security 17), Vancouver, BC, Canada, 16–18 August 2017; pp. 1093–1110. [Google Scholar]
- Fernandes, E.; Jung, J.; Prakash, A. Security Analysis of Emerging Smart Home Applications. In Proceedings of the 2016 IEEE Symposium on Security and Privacy (SP), San Jose, CA, USA, 22–26 May 2016; pp. 636–654. [Google Scholar]
- Mahjabin, T.; Xiao, Y.; Sun, G.; Jiang, W. A survey of distributed denial-of-service attack, prevention, and mitigation techniques. Int. J. Distrib. Sens. Netw. 2017, 13, 1550147717741463. [Google Scholar] [CrossRef]
- Adat, V.V.; Gupta, B.B. A DDoS attack mitigation framework for internet of things. In Proceedings of the 2017 International Conference on Communication and Signal Processing (ICCSP), Chennai, India, 6–8 April 2017; pp. 1–5. [Google Scholar]
- Najar, A.; Naik, S.M. DDoS attack detection using MLP and Random Forest Algorithms. Int. J. Inf. Technol. 2022, 14, 2317–2327. [Google Scholar] [CrossRef]
- Lawal, M.A.; Shaikh, R.A.; Hassan, S.R. A DDoS Attack Mitigation Framework for IoT Networks using Fog Computing. Procedia Comput. Sci. 2021, 182, 13–20. [Google Scholar] [CrossRef]
- Manikumar, D.V.V.S.; Maheswari, B.U. Blockchain Based DDoS Mitigation Using Machine Learning Techniques. In Proceedings of the 2020 Second International Conference on Inventive Research in Computing Applications (ICIRCA), Coimbatore, India, 15–17 July 2020; pp. 794–800. [Google Scholar]
- Javaid, U.; Siang, A.K.; Aman, M.N.; Sikdar, B. Mitigating IoT Device based DDoS Attacks using Blockchain. In Proceedings of the 1st Workshop on Cryptocurrencies and Blockchains for Distributed Systems (CryBlock’18), Munich, Germany, 15 June 2018; pp. 71–76. [Google Scholar]
- Kumari, P.; Jain, A.; Seth, A.; Raghav. Leveraging blockchain and machine learning to counter DDoS attacks over IoT network. Multimed. Tools Appl. 2024, 84, 317–341. [Google Scholar] [CrossRef]
- Berríos, S.; Garcia, S.; Hermosilla, P.; Allende-Cid, H. A Machine-Learning-Based Approach for the Detection and Mitigation of Distributed Denial-of-Service Attacks in Internet of Things Environments. Appl. Sci. 2025, 15, 6012. [Google Scholar] [CrossRef]
- Canadian Institute for Cybersecurity. DDoS Evaluation Dataset (CICDDoS2019). 2024. Available online: https://www.unb.ca/cic/datasets/ddos-2019.html (accessed on 19 May 2024).
- Sasikala, B.; Biju, V.; Prashanth, C. Kappa and accuracy evaluations of machine learning classifiers. In Proceedings of the 2017 2nd IEEE International Conference on Recent Trends in Electronics, Information & Communication Technology (RTEICT), Bangalore, India, 19–20 May 2017; pp. 20–23. [Google Scholar]
- Thepade, S.; Das, R.; Ghosh, S. Performance comparison of feature vector extraction techniques in RGB color space using block truncation coding for content based image classification with discrete classifiers. In Proceedings of the 2013 Annual IEEE India Conference (INDICON), Mumbai, India, 13–15 December 2013; pp. 1–6. [Google Scholar]
- Awad, M.; Khanna, R. Support Vector Machines for Classification. In Efficient Learning Machines: Theories, Concepts, and Applications for Engineers and System Designers; Apress: Berkeley, CA, USA, 2015; pp. 39–66. [Google Scholar]
- Kokila, R.; Somasundaram, T.S.; Kannan, G. DDoS detection and analysis in SDN-based environment using support vector machine classifier. In Proceedings of the 2014 Sixth International Conference on Advanced Computing (ICoAC), Chennai, India, 17–19 December 2014; pp. 205–210. [Google Scholar]
- Breiman, L. Random Forests. Mach. Learn. 2001, 45, 5–32. [Google Scholar] [CrossRef]
- Wu, Z.; Zhang, H.; Wang, P.; Sun, Z. RTIDS: A Robust Transformer-Based Approach for Intrusion Detection System. IEEE Access 2022, 10, 64375–64387. [Google Scholar] [CrossRef]
- Yin, K.; Yang, Y.; Yao, C.; Yang, J. Long-Term Prediction of Network Security Situation Through the Use of the Transformer-Based Model. IEEE Access 2022, 10, 56145–56157. [Google Scholar] [CrossRef]
- Truong, V.H.; Tangaramvong, S.; Papazafeiropoulos, G. An Efficient LightGBM-Based Differential Evolution Method for Nonlinear Inelastic Truss Optimization. Expert Syst. Appl. 2024, 237, 121530. [Google Scholar] [CrossRef]
Research Work | Methodology | Advantages | Limitations |
---|---|---|---|
Adat et al. (2017) [14] | DDoS mitigation framework for IoT networks with Analysis and Monitoring Modules; introduces an “EDoS Server” for handling high-amplitude attacks. | Improves Packet Delivery Ratio; achieves 100% delivery for the border router and 86% for internal nodes. | Centralized framework; lacks a distributed defensive approach. |
Najar et al. (2022) [15] | Uses machine learning techniques (Random Forest, PCA) to detect and classify DDoS attacks, with NSL-KDD dataset for evaluation. | Random Forest model performs better than existing approaches, achieving high accuracy. | Results are based on offline data (NSL-KDD); lacks evaluation of real-time network data. |
Lawal et al. (2021) [16] | Fog computing-based DDoS mitigation framework using machine learning (KNN, DT, NB) with the CICDDoS2019 dataset. | Achieves 99.99% accuracy and 100% precision, recall, and F1-score. | Fog nodes have limited resources; potential security vulnerability in fog nodes. |
Manikumar et al. (2020) [17] | Combines machine learning and Blockchain for DDoS detection, using decentralized blacklists and the CICDDoS2019 dataset. | Decentralized blacklist ensures data integrity and security; Random Forest achieves 95.19% accuracy. | Not suitable for IoT applications due to the resource constraints of IoT devices. |
Javaid et al. (2018) [18] | Uses Ethereum Blockchain and smart contracts to secure IoT devices, assigning gas limits to control access and prevent DDoS attacks. | Decentralized control; prevents DDoS attacks using gas limit mechanism. | Scalability issues with Blockchain in large-scale IoT deployments. |
Kumari et al. (2024) [19] | Integrates machine learning with Blockchain to detect and mitigate DDoS attacks in IoT networks. | High accuracy and real-time DDoS mitigation through Blockchain’s decentralized nature. | Scalability, computational overhead, and cost challenges. |
Model | Accuracy (%) | Precision (%) | Recall (%) | F1-Score (%) | Latency (ms) |
---|---|---|---|---|---|
Transformer | 99.78 | 99.65 | 99.82 | 99.73 | 15.2 |
LightGBM | 99.71 | 99.58 | 99.75 | 99.66 | 5.1 |
RF | 99.62 | 99.34 | 98.11 | 98.72 | 16.8 |
DT | 96.80 | 95.10 | 99.67 | 97.33 | 3.5 |
SVM | 96.55 | 95.83 | 97.60 | 96.71 | 8.4 |
KNN | 95.87 | 95.56 | 96.19 | 95.87 | 42.5 |
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. |
© 2025 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 (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Chaira, M.; Belhenniche, A.; Chertovskih, R. Enhancing DDoS Attacks Mitigation Using Machine Learning and Blockchain-Based Mobile Edge Computing in IoT. Computation 2025, 13, 158. https://doi.org/10.3390/computation13070158
Chaira M, Belhenniche A, Chertovskih R. Enhancing DDoS Attacks Mitigation Using Machine Learning and Blockchain-Based Mobile Edge Computing in IoT. Computation. 2025; 13(7):158. https://doi.org/10.3390/computation13070158
Chicago/Turabian StyleChaira, Mahmoud, Abdelkader Belhenniche, and Roman Chertovskih. 2025. "Enhancing DDoS Attacks Mitigation Using Machine Learning and Blockchain-Based Mobile Edge Computing in IoT" Computation 13, no. 7: 158. https://doi.org/10.3390/computation13070158
APA StyleChaira, M., Belhenniche, A., & Chertovskih, R. (2025). Enhancing DDoS Attacks Mitigation Using Machine Learning and Blockchain-Based Mobile Edge Computing in IoT. Computation, 13(7), 158. https://doi.org/10.3390/computation13070158