International Journal of Computer Networks & Communications (IJCNC)

AIRCC PUBLISHING CORPORATION

IJCNC 06

SECURE FEDERATED INTRUSION DETECTION USING HOMOMORPHIC ENCRYPTION: A COMPARATIVE STUDY WITH ENSEMBLE LEARNING

Sadaf, Aasim Zafar and Mohammad Luqman
Department of Computer Science, Aligarh Muslim University, Aligarh, India

ABSTRACT

The rapid growth of the Internet of Things (IoT) has also resulted in the increase of the demand in the intrusion detection systems, which can detect suspicious activity and keep the information confidential. The traditional centralized machine learning systems involve attaching the data of the distributed devices to a centralized server thus placing them at a risk of being stolen. Federated Learning (FL) may help overcome this difficulty and assist in a distributed model training process without sharing raw client data. Nevertheless, updated versions of models that are transferred in the process of training are susceptible to poisoning or inference attacks at communication and aggregation. This paper proposed a federated intrusion detection system that is secure and involves implementation of Homomorphic Encryption (HE), in this case CKKS scheme, to provide model updates protection in aggregation process. The CICIoT2023 dataset was used in extensive experimentation of the proposed framework in terms of comparing with the classical machine learning baselines and experiences in using ensembles. Our findings show that the centralized Random Forest model with optimal accuracy of 98.57% worked best and the proposed Federated Learning models worked well with the standard FL performance of 79.54% and the encrypted FL+HE model performed with an accuracy of 79.39%. These are some results that demonstrate how Homomorphic Encryption enables the security and confidentiality of model aggregation a significant effect to model detection (reducing by only 0.15 percent), which provides a strong privacy-preserving security solution to decentralized IoT networks

KEYWORDS

Federated learning, Internet of Things, Homomorphic encryption, Machine Learning

  1. INTRODUCTION

The fast development of the Internet of Things (IoT) has raised the issue of the privacy and security of the data in the contemporary computing setting. IoT devices are also involved in producing huge amounts of sensitive network data continuously and therefore intrusion detection systems are necessary in securing IoT systems. The conventional centralized machine learning methods involve gathering information at a specific server operated by distributed machines that may result in privacy risks, as well as revealing sensitive data. Also, the nature of IoT environment is distributed and resource-optimal which makes the issue of offering secure and efficient data processing difficult. These properties dictate that privacy conscious intrusion detection solutions are required which will be capable of operation in the distributed IoT networks whilst ensuring that sensitive data is minimally exposed to external parties.

In order to improve automation and connectivity, the Internet of Things (IoT) has developed into a worldwide ecosystem that incorporates billions of devices, sensors, and networks. As noted in [1], [2], IoT’s explosive growth over the past ten years has sparked previously unheard-of security and privacy problems. This underscores the necessity of machine learning-based intrusion detection and anomaly detection techniques to bolster IoT security. In addition, [3] discusses the lack of consistent security frameworks that impede user confidence and wider adoption, proposes thorough threat taxonomies, and provides a thorough evaluation of IoT privacy and security concerns. [4] examines the function of wireless sensor networks (WSNs) in the Internet of Things from a communication layer perspective, emphasizing energy-efficient data aggregation and routing techniques that are essential to maintaining large-scale networks. In the meantime, [5] investigates the Digital Twin concept in Industrial IoT (IIoT), where high-fidelity, intelligent, and secure industrial systems are created by combining blockchain, AI, and federated learning (FL) technology. The incorporation of AI approaches into IoT networks to enable real-time decisionmaking is highlighted in [6], which elaborates on the larger trend toward the Intelligent Internet of Things (IIoT). However, it also warns of new issues in data privacy, model transparency, and security. In order to achieve safe federated learning across IoT contexts, [7] addresses homomorphic encryption and differential privacy as crucial strategies to reduce privacy issues in dispersed learning. Expanding on this integration, [8] investigates how AI, IoT, and 5G technologies may work together to provide the foundation of next-generation smart grids that are scalable, resilient, and have low latency. Simultaneously, [9], [10] offers a thorough analysis of IoT applications in fields including as healthcare, the environment, and smart infrastructure, highlighting unresolved issues with dependability and standards. Additionally, [11] looks at how IoT is used in supply chain management, highlighting its advantages in asset tracking, predictive maintenance, and sustainability while also recognizing enduring problems with data security and interoperability. Lastly, [12] describes how distributed intelligence, smart sensors, and edgeAIoT paradigm form the foundation of nest generation intelligent systems integrating AI at the edge. When taken as a whole, these ten studies show how IoT security and architecture have evolved from basic to intelligent, privacy-preserving, and federated systems. They confirm that a secure and sustainable future for AI-enabled IoT solutions depends on striking a balance between usefulness, privacy, explainability, and efficiency.

Data which is sensitive is constantly emitted and hosted on the IoT systems, making systems susceptible to cyberattack and privacy exposures. A conventional intrusion detection system is usually based on centralized collection of data that can reveal sensitive information on the network. Furthermore, IoT systems are not only distributed, but they are also heterogeneous in nature and the data produced by devices is not always IID. These issues present the necessity of safe and disseminated intrusion detection methods.

To overcome these challenges, this research proposes a federated intrusion detection framework and contributes the following:

  1. Federated IDS Learning Federated neural network: A federated neural network is an implementation that enables distributed IDS with distributed intrusion detection without the sharing of raw IoT traffic data.
  2. Federated Aggregation with Secure Aggregation based on Homomorphic Encryption: CKKS homomorphic encryption scheme will be incorporated which ensures model updates are secured during federated aggregation.
  3. Comparative Analysis: The suggested solution is compared with the classical machine learning algorithms such as the Random Forest and the ensemble model comprising of the Random Forest, the Decision Tree and Support Vector Machine.
  4. Performance and Overhead Analysis: Detection performance is also determined in terms of accuracy, precision, recall and F1-score;on the other hand , computational overhead of homomorphic encryption is determined on the basis of encryption, aggregation and decryption time.

The rest of this paper is structured in the following way. Section 2 overviews similar literature on IoT intrusion detection. The problem motivation is provided in section 3. Part 4 outlines the suggested framework. Section 5 describes the experimental setup and Section 6 describes the results. Lastly, there is a conclusion of the study in Section 7.

2. RELATED WORK

Machine learning (ML) and deep learning (DL) combination has largely contributed to improving intrusion detection systems (IDS) to network in Internet of Things (IoT).Existing studies may be broadly divided into explainable IDS models, federated learning-based IDS, distributed-learning privacy-preserving mechanisms, and approaches to ensemble learning.

2.1. Explainable IDS Models

A few studies have experimented with explainable artificial intelligence (XAI) to increase the comprehensibility of the IDS models. Other techniques that have been used to provide models decisions include SHAP, LIME and RuleFit with deep learning or tree-based IDS models. And, to use NSL-KDD as an example, explainability frameworks were studied based on such data as [13], [14], [15], [16], [17], [18] using NSL-KDD, UNSW-NB15, and CICIDS2017 [19]. Such methods had become more transparent and understandable models but tended to be computationally expensive and have low scalability in real-time The methods. Moreover, explainable IDS models are usually targeted towards interpretability of models instead of secure distributed training

2.2. Federated learning Distributed ID

Federated Learning (FL) is an up-to-date promising method of intrusion detection in distributed IoT systems. FL allows joint training of models with many clients without exposing raw data and will lower the potential risk of privacy invasion. A number of studies have implemented FL for IDS jobs. In particular, [20] suggested a federated IDS with a multi-view framework with combining ensemble learning with decentralized training. Likewise, [21] used generative adversarial networks alongside federated learning in solving the data imbalance problem in IoT intrusion detection. Other articles like [22], [23], [24], [25], [26] investigated federated averaging, hierarchical aggregation and knowledge distillation methods of distributed IDS models. Even though these strategies enhance privacy and distributed learning potential, there are issues in non-IID data management, communication bandwidth, and aggregation safety.

2.3. Federated Learning Without Privacy Considerations.

Another critical research direction is the guarantee of privacy in training federation. Several cryptographic and privacy-preserving mechanisms have been suggested to minimize the protection of the model updates in federated learning. Some studies like [27], [28], [29], [30], [31], [32], [33], [34], [35] explored machineries such as differential privacy, secure multiparty computation and homomorphic encryption to ensure that during aggregation of models information is not leaked. Homomorphic encryption is one of these techniques that enable aggregation of encrypted model updates without their plaintext values being disclosed, which makes it appropriate to privacy-preserving federated learning systems. [26] compares FedLearning with Differential Privacy (DP) as a way of securing an IoT environment with 98.92%-98.2% (FL) on MNIST and 93%- 91 on cybersecurity information, which is nearly identical to the loss in performance. But it is restricted to testing on simplified data sets, and does not include real-world IoT implementation and scaling tests. But these mechanisms have a tendency to add computational overhead and complexity to communication, and these need to be considered carefully to deploy.

2.4. Machine Learning based Intrusion Detection

Another key area where ensemble learning techniques have been employed to enhance performance of intrusion detection is in the field. A number of researchers including [36], [37], [38] investigated the hybrid and ensemble deep learning models to train more accurate detectors and deal with imbalanced data. These techniques can generally perform better than single-model IDS solutions but generally assume a centralized acquisition of data, which can reveal valuable network data.

IDS research has made great strides, but there are still a number of obstacles to overcome. In distributed IoT environments, privacy concerns arise because many high-performing IDS models rely on centralized training. Although federated learning protects data privacy, model updates may still be visible during communication. Moreover, the trade-off between privacy-preserving mechanisms and detection performance has not been thoroughly assessed. This work explores a federated intrusion detection framework combined with homomorphic encryption for safe model aggregation in order to address these issues. The proposed algorithm is evaluated with the help of CICIoT2023 dataset and compared to the conventional machine learning baselines, including Random Forest and an ensemble model including Random Forest, Decision Tree, and Support Vector Machine.


Table 1. Comparative analysis of Relevant works.

3. MOTIVATION AND PROBLEM STATEMENT

Intrusion Detection Systems (IDS) represent a valuable resource when it comes to securing various environments with the help of Internet of Things (IoT) as a result of the numerous devices, numerous data sources, and dynamic traffic patterns, which predispose it to the effects of cyberattacks. Old IDS solutions typically use centralized machine learning models whereby it pulls together the mass of network traffic data at one centralized server. Although this type of model can be very accurate in detection, centralized training would pose a great privacy risk since sensitive network data would have to be sent and stored locally. In addition, IoT settings are distributed by nature and often produce non-IID (non-independent and identically distributed) data as devices react differently, networks have varied topologies, and there are divergent traffic characteristics.

Fl has come in as a potential solution to such problems, and one approach that could solve these issues is Federated Learning (FL), which empowers the joint training of models on distributed clients without individual raw data sharing. In FL, the client locally trains a model using personal data and does not transfer the model parameters to the server, only sums up the model parameters.

in which N is defined as the total number of participating clients and is defined as the model parameters used by ith client. Federated Averaging (FedAvg) is an aggregation rule that updates the global model by combining locally trained models. Nonetheless, other sensitive information can be exposed through interception or inference attacks by the very model updates that are exchanged during federated learning. Thus, secure model update aggregation is a significant issue still in federated IDS.

To mitigate this challenge, this paper will incorporate Homomorphic encryption with federated learning in a bid to secure updates of models during the aggregation process. Homomorphic encryption raises the possibility of performing computations on encrypted data and not uncovering the underlying plaintext values. An encryption scheme E(dot) is additively homomorphic which means:

In which, denotes operations in ciphertext space. Here the CKKS homomorphic encryption scheme is applied to perform encryption fusion in the encrypted model updates in the federated training. Through the encryption operations on the parameters, the server can calculate global updates into the model without actually accessing the individual client weights. In this way, one can conduct collaborative intrusion detection and retain the confidentiality of local model updates. The given framework, in turn, explores the trade-off between the performance of classical machine learning models and secure aggregation by providing comparisons of classical machine learning models, federated learning, and federated learning with homomorphic encryption on the CICIoT2023 dataset.

4. PROPOSED WORKS

In order to offer secure and distributed intrusion detection to a heterogeneous Internet of Things (IoT) network, the given paper suggests a federated intrusion detection model with an implementation of Homomorphic Encryption (HE) in it. The research problem behind the proposed work is to study whether without dramatically reducing the performance of intrusion detection, secure aggregation of model updates is possible in federated learning. Unlike in a traditional centralized intrusion detection system where network traffic data of multiple IoT devices is gathered and analyzed in a central server, the proposed solution maintains the sense of data locality because where each participating client will train locally using its local traffic records. This is especially significant in Internet of Things (IoT) applications in which devices are physically separated, resource-constrained, and many have a heterogeneous traffic distribution.

Strong detection when centralized machine learning approaches can be applied; however, they necessitate direct collection of their data on distributed nodes, thus creating privacy vulnerabilities, and exposing sensitive network details. The solution proposed by Federated Learning (FL) is to enable clients to provide training to a global model in a way that prevents them from exchanging raw data. Nevertheless, despite federated learning, exchange of model parameters between clients and the server can still communicate or aggregate sensitive information. Thus, secure aggregation turns out to be one of the requirements of privacy-aware federated intrusion detection.

The four experimental settings tested by the proposal are a classical control, which is the Random Forest (RF) control, and an ensemble model, i.e., the combination of the three models: the Random Forest, Decision Tree and Support Vector Machine, a typical Federated Learning model where the model aggregation is performed with the CKKS homomorphic encryption scheme, and FL+HE model, which secures the model aggregation with the CKKS homomorphic encryption. The design allows the direct comparison of centralized and distributed designs and in addition compares the computational overhead of secure aggregation. The general architecture of the proposed secure Federated Learning-based Intrusion Detection System is given in Figure 1. The system comprises of several distributed clients that locally detect models based on their own data. Each client does not send raw data, but updates each model with a central server. In order to achieve secure aggregation, Homomorphic Encryption is used which enables the server to combine encrypted model parameters without having access to the underlying data.


Figure 1. Overall architecture of the system.

4.1. Classical and Federated Intrusion Detection Models

The proposed study takes into account both centralized and federated learning environments in intrusion detection. Random Forest (RF) is a powerful classical benchmark in a centralized environment because it is resistant and performs well on most of the tasks in intrusion detection. Moreover, the ensemble model using a combination of Random Forest, Decision Tree (DT) and Support Vector Machine (SVM) is created, and the study is provided with the comparison of one high-performing classifier with the hybrid model having several decision mechanisms integrated. In the federated context, the common deep intrusion detection model is a lightweight multilayer perceptron (MLP), which is known as the IDSModel. The training information is divided among three clients, each of which is a distributed IoT client. The client only transfers its local model parameters to the server to be aggregated, where the clients will only train their local model at most one local epoch at each communication round. Federated Averaging rule: The global model is updated:

This aggregation mechanism makes sure that raw training data is not transferred to the server so that distributed learning can be done.
An even more general weighted FedAvg formulation can be expressed as:

where is the local model from client 𝑘 at round 𝑡, is the number of samples held by client k, and 𝐾 is the total number of clientsIn this paper there are three clients, which are practically assessed in the federated setup.Having both centralized and federated models is meant to evaluate the trade-off of a high level of predictive performance and privacy-conscious distributed learning. Although centralized models are used as upper-performing baselines, Federated models provide a more privacy-friendly learning environment because it does not involve direct sharing of data.

4.2. Secure Aggregation Using Homomorphic Encryption

Granted, the model that the data transferred during the training process can still contain information, though it will not transfer raw client data point-blank; it still can leak information to interceptors and analyzers in case an adversary manages to breach it. The proposed framework will incorporate Homomorphic Encryption (HE) in the federated aggregation process to remedy this problem. In particular, client model parameters are encrypted by applying the CKKS scheme, and then they are sent to the server

Where represents addition in ciphertext space. This property enables the server to aggregate encrypted client model updates without first decrypting them. The ability of this property allows the server to combine encrypted model updates of client models without initial decryption.

Within the framework proposed, every client is trained on his local version of the IDSModel on a subset of CICIoT2023 using their partition and generates new parameters related to the model. These parameters of the models are flattened into vectors and encrypted by the CKKS implementation of the TenSEAL. The server is only exposed to encrypted updates and carries out safe aggregation of ciphertexts. The encrypted update is then aggregated and sent back to the decryption process to retrieve the parameters of the global model to make the next round of communication.

denotes the encrypted local model update of client k, and K is the number of clients participated. This formulation will have the server never aggregating cleartext client parameters in the protected FL+HE configuration.

The CKKS setup that is applied in this work has a modulus degree of 8192-polynomial, and the bit sizes of its coefficients.[60,40,40,60], with safe approximate arithmetic on real-valued vectors. The application of CKKS will be suitable in the given case since model parameters are continuous-valued numbers, which demand an efficient encrypted vector operation. The inclusion of HE into the aggregation phase enhances privacy protection and does not disrupt the spirit of collaboration associated with federated learning, as proposed in the framework.

4.3. Experimental workflow of the Proposed Framework

The entire process of the suggested framework starts with the preprocessing of the datasets. The CICIoT2023 dataset is initially cleansed, scaled and balanced and then used to experiment with. In a centralized environment, the processed data is used to directly train Random Forest and the ensemble model of RF, DT, and SVM. The federated environment has three clients modeled on the same processed training data to be a simulated distributed IoT environment.

Training of federated clients The IDSModel is trained at each of the federated clients on the local data partition allotted to that client. Local training records the model parameters which are either sent to the server in plaintext (FL baseline) or encrypted (FL+HE). Standard FedAvg is used to aggregate updates by the server in the plaintext FL setting. A client of FL+HE uses CKKS to cryptographically verify its model parameters, then transmits the resulting cipher to the server, which encrypts aggregates the resulting cipher not knowing the plaintext updates. The global model formed is then tested on the test set.

By incorporating two type settings centralized and federated, the performance-oriented and privacy-oriented approaches can be compared in a near-organized manner. Classical models will have better detection performance since they are trained on centralized data whereas federated learning will have enhanced privacy of data since the training records are locally owned. This is further extended in the FL+HE model which secures the communication and aggregation step of federated learning.

The framework thus serves two crucial comparative experiments:

(1) centralized and federated intrusion detection, and
(2) plain federated aggregation compared to encrypted federated aggregation.

This is a dual comparison that matters since it does not only evaluate the ability to detect it, but also compares the feasible cost of provision of secure aggregation in IoT intrusion detection.

4.4. Evaluation Metrics

The suggested framework is considered based on conventional metrics of classification and calculations of the overhead of the framework. Intrusion detection is a multi-class classification problem and class imbalance as well as differences in attack distribution are considered by using weighted metrics. \

Classification Metrics

Accuracy (ACC): Ratio of correct predictions to total samples.

Precision (P-weighted): Proportion of correct sample attacks out of the total amount of predicted attacks.

Recall (R-weighted): Fraction of actual attacks correctly identified.

Besides the classification metrics, the proposed FL+HE architecture is also assessed using the training time and homomorphic encryption overhead. The measures related to encryption are noted as follows:

  • Key generation time
  • Encryption time
  • Aggregation time
  • Decryption time

Such measurements are crucial because privacy-preserving federated learning should also be considered not only on how well it predicts, but also on how much it costs to run. Where efficiency of a system is vital (as in the case of IoT) low encryption overhead is a valuable measure of deployability.

4.5. Computational Complexity Analysis

Take 𝑚 to be the size of local training samples per client, 𝑛 to be the feature dimension, 𝐾 to be the number of suitable clients, and 𝐸 to be the local epochs. In this work, 𝐾=3 clients and 𝐸=1 local epoch are used in each communication round. The main computational steps are as follows:


Table 2. Computational Complexity Analysis.

Costs incurred in FL baseline are primarily the local training cost and parameter averaging cost and other overhead costs are incurred in FL + HE model because of encryption and decryption. But owing to aggregation being done after model parameters rather than raw training data, in the experiment, encrypted aggregation stage can still be computed in a computationally feasible manner. It implies that the suggested FL+HE model is applicable in the analysis of the trade-off between security and detection performance in distributed incident detection in the IoT.[39] presents an optimized pruning and quantization LSTM based IDS, which are designed to serve edge devices to achieve lower model size with high precision on the UNSW-NB15 dataset. Nevertheless, it has shortcomings related to one-dataset tests and absence of practical or realtime testing.

In general, the suggested work produces a comparative study on the centralized machine learning models and privacy-conscious distributed learning models of IoT intrusion detection in a systematic way. The ensemble model and random forest are good centralized baselines, but FL is an example of the distributed learning where data are never exchanged at the raw level. The FL +HE framework builds upon this and safeguards the aggregation process with homomorphic encryption. The proposed framework offers a convenient evaluation of the possibilities to apply the secure federated intrusion detection to the modern IoT setting by collaboratively comparing the predictive performance and the impact of encryption overhead.

5. EXPERIMENTMETHODOLOGY

The experimental setup, dataset description, preprocessing pipeline, model architecture, federated learning framework, integration of homomorphic encryption, and evaluation metrics used to gauge model performance are all covered in this section.

5.1. Experimental System Setup:

The experiments were conducted in the Google colaboratory environment which provides access to cloud-based computing units like GPUs and high memory runtime environments that may be utilized in machine learning experiments on a massive scale.It created the environment by installing the following libraries which are needed: PyTorch, Scikit-learn, TenSEAL, NumPy, Pandas, Matplotlib, Seaborn, Dask, XGBoost, LightGBM, and imbalanced-learn.In order to ensure reproducibility, fixed random seed SEED = 42 was applied in the relevant libraries of PyTorch, NumPy and Python random.

5.1.1. Tools and Libraries Used

The experimental framework was implemented using a number of open-source libraries. The deep learning intrusion detection model (IDSModel) that was trained and designed with PyTorch was utilized in the federated learning framework. It made use of Homomorphic Encryption on CKKS, implemented by use of TenSEAL, to implement federated training by securely aggregating the model parameters of the used model. Scikit-learn also offered fundamental tools in preprocessing the of data, classical machine learning models, learning ensembles, and criteria of evaluation. The Imbalanced-learn library used randomOverSampler to handle the issue of imbalance in the training dataset. Efficient data manipulation and preprocessing, and numerical operations were done with Pandas and NumPy when processing the dataset and training the model. The visualization of the experiment results, the plot of the performance comparison and the confusion matrices were worked out with the help of Matplotlib and Seaborn. Dask facilitated loading and processing of the big CSVs that are stored in the CICIoT2023 data set. Trained models and intermediate experimental results used in later analysis and reproducibility were saved using Joblib.

5.2. Dataset Description

The concerned intrusion detection system was trained and tested with the CICIoT2023 dataset which is a large IoT network traffic dataset that is designed to serve advanced research in intrusion detection. The dataset is composed of an approximate number of 5.5 million training samples, 1.2 million validation and testing samples. The records have 46 features of network traffic that have been considered at the packet and flow-level statistics. There are 35 classes that are made of 34 types of attacks and one benign traffic class. Just like most real-world network security data, the CICIoT2023 data is highly class-imbalanced, with specific types of attacks represented by a small number of samples in comparison with others.

5.2.1. Preprocessing of Data

The raw data was created in various CSVs and needed preprocessing stages in order to train the models. The amount of data is so huge that Dask was employed in loading and processing the CSV files with efficiency. A simple imputer that employed the mean strategy was used to fill in missing values by replacing missing numerical values with the average of the relevant features, as there were no other options. StandardScaler was also used to normalize the numerical features; the results were standardized and the mean of the features was removed by dividing by the unit variance. LabelEncoder was used to convert the categorical attack labels in numerical form to enable them to be used with machine learning models. This [40] has been done using PFM optimization algorithm to select features in a cloud-based IDS, and the results are similar to NSLKDD and Kyoto with an accuracy of around 81.78%. Nevertheless, it is of medium accuracy and it is not validated in the real world.To lower the cost of computation in the preprocessing process a small fraction of the dataset (around 8 percent of the dataset) was employed in the process of determining preprocessing elements like the imputer and scaler, and then the transformed estimations were generated and utilized on the whole set of data. Due to the fact that the CICIoT2023 dataset has a serious class imbalance among the 35 traffic classes, the imbalancedlearn library RandomOverSampler was used on the training data to gain balance of the classification classes and stabilize the training of the model.

5.3. Model Architecture

Examples of two categories of models were used in experimental assessment: classical machine learning models and one federated deep learning model. These models were trained and tested so as to compare the centralized machine learning studies with the distributed federated learning methods of intrusion detection

5.3.1. Classical Machine Learning Models

Several classical machine learning models have been trained as baseline models of intrusion detection and they comprise; Random Forest (RF), Decision Tree (DT) and Support Vector Machine (SVM). On top of the models, an ensemble model in terms of RF, DT and SVM was introduced using a voting strategy to enhance detection performance. These models have been trained on the centralized dataset to give baseline performance comparisons with the federated learning models.

5.3.2. Federated Learning Model

The deep learning model employed in the federated learning model was a feed- forward neural network (IDSModel) written in PyTorch. The network has an input layer (and includes 46 neurons) that are mapped to the network traffic features and a hidden (ReLU) layer of 256 neurons. To regularize the model, the dropout layer was employed at a rate of 0.3, and the second hidden layer comprised 128 neurons and ReLU activation was employed. Then another dropout layer that had a rate of 0.3 was placed prior to the last output layer that had 35 neurons that represented the multiclass classification output. AdamW optimizer was used to train the model with a learning rate of 1e-3 and a weight decay of 0.01. CrossEntropyLoss was the loss type that was utilized during the training process which suits well with a multiclass classification task.

5.4. Federated Learning Framework

The implementation of Federated learning was done to facilitate the training of multiple simulated IoT clients with distributed models. The StratifiedKFold strategy was used to divide the dataset into three clients in order to achieve a homogeneous distribution of classes within each client dataset. The server broadcasts the current model on all its clients who are connected to it in each round of communication. Every client subsequently trains the model locally in one epoch using its local data set. The local training incorporates the clients updating their model parameters and this is transmitted back to the central server. The server accepts the changes of the models which are received and combines them with the Federated Averaging (FedAvg) algorithm to generate a better global model. This is recursively done to several rounds of communication until the model converges. The FedAvg aggregation rule is defined as

5.5. Homomorphic Encryption for Secure Aggregation

Homomorphic Encryption (HE) was incorporated to provide increased protection in federated learning with the usage of the CKKS scheme which is implemented in the TenSEAL library. Each client encrypts its model parameters with a public key of the homomorphic encryption scheme before updating its model parameters at the server. At this point, the server can perform the operations of aggregation of the encrypted values, not the plaintext values. The encrypted global model may be decrypted to get the updated model parameters after aggregation. This will make sure that the server will never possess access to raw client model updates and hence maintain confidentiality during collaborative training

6. RESULTS AND ANALYSIS

In this section, one can describe the results of the experiment conducted using the models of classical machine learning, ensemble techniques, and the federated learning system with secure aggregation. The CICIoT2023 dataset was used to complete the experiments comparing the intrusion detection performance in centralized and distributed learning conditions. Testing of the models was done on standard multiclass classification measures such as accuracy, precision, recall, and F1-score.

6.1. Classical Machine Learning Models Performance

Several classical machine learning models that identified baseline performance were trained on the centralized data set. These were Random Forest (RF), Decision Tree (DT), and Support Vector Machine (SVM). Moreover, an ensemble model including RF, DT, and SVM with a voting strategy was adopted so that the general detection performance would be enhanced.

The best performing individual models was random forest model; its accuracy was at 98.57 % and F1 score was 0.9850 implying that it can be used to determine malicious and benign traffic patterns with high performance. Decision Tree model has also done well with an accuracy of 96.43 but the training time is also much lower that of the other models. The Support Vector machine used slightly worse performance and accuracy of 79.04 and needed the most time to train making it not suited with the large classes of IoT data. Through the ensemble model, whose RF, DT and SVM were combined, the polygraph model produced 98.29 percent accuracy which indicated that the ensemble model could ensure high performance with a better model stability.

6.2. Federated Learning Performance

The federated learning structure was implemented to train the IDSModel to assess the power of distributed intrusion detection, three simulated clients with non-IID data partitions were developed. The global model was also updated using the Federated Averaging (FEDAvg) algorithm depending on the different rounds of communication.

Federated learning model obtained its final accuracy of 79.54% with an F1-score of 0.7604. Federated learning offers the benefit of training distributed training without raw data transfer, although it has a lower information quality than centralized classical models, and is suitable in a privacy-sensitive internet of things.

6.3. Federated Learning with Homomorphic Encryption

The FL+HE model obtained in the end was as follows: Accuracy: 0.7939, Precision: 0.8059, Recall: 0.7939, F1-score: 0.7642. The findings indicate that secure aggregation and homomorphic encryption have a small degrading effect on the performance and can be used to achieve encrypted federated learning, which retains competitive detection performance.


Figure 2. Federated Learning with Homomorphic Encryption.

The workflow of the Federated Learning process is presented in Figure 2. Independently, the local model will be trained by each client and updates are communicated with the central server as encrypted messages. The server combines these updates to create a global model which is again disseminated to the clients so that additional training can be done. This is a repetitive procedure of communication until the convergence is reached.

6.4. Homomorphic Encryption Computational Overhead

Homomorphic encryption also increased the computation cost measured. Table 4 is a summary of the computation times related to encryption. The findings show that the encryption processing costs professional negligible processing power, and the encryption and decryption times are rather small in comparison with the overall federated training time


Figure 3. Homomorphic Encryption Computational Overhead.

Figure 3 shows the computation cost of various operations of Homomorphic Encryption. The key generation, encryption, aggregation, and decryption execution times are introduced. As may be seen, the process of encryption has been known to be the most expensive in computing cost, which is followed by key generation though aggregation takes the least time as a result of efficient encrypted operations. There is also a rather minor additional overhead of decryption. As this analysis has indicated, despite the added complexity of the computations brought by homomorphic encryption, such overhead is relatively easy to handle, which makes it possible in deploying safe applications of federated learning.

6.5. Comparative Analysis of all models

Table 6 summarizes the comparision among classical machine learning models and federated learning approaches.

The findings indicate that centralized systems like the Random Forest have the best classification accuracy because of the availability of the full dataset. Nevertheless, federated learning includes a decentralized training method to allow collaborative learning without exchanging raw data. Security is also improved by the addition of homomorphic encryption without compromising comparatively the same model performance.

7. CONCLUSION

The paper introduced a safe intrusion detection system in IoTs by incorporating the Federated Learning (FL) and Homomorphic Encryption (HE) to make model aggregation privacypreserving. Experiment on the CICIoT2023 dataset demonstrated that the suggested method performs well when compared to the classical machine learning frameworks, such as the Random Forest (RF), Decision Tree (DT), Support Vector Machine (SVM), and ensemble statistics. The experimental data showed that random forest model was the most efficient with a score of 98.57 and an F1-score value of 0.9850, which indicates its applicability in centralized environments. Conversely, the Federated Learning model recorded an accuracy of 79.54 %, enabling the confirmation of the possibility to develop collaborative intrusion detection without any centralization of data sharing. The FL+HE model with Homomorphic Encryption based on CKKS scheme had 79.39% and F1-score of 0.7642. These findings indicate that the trade-off between security and performance is insignificant, and the accuracy decreases by only 0.15 percent relative to the federated learning that is not under a security guarantee. Also, even though Homomorphic Encryption adds a predictable computational load to the system in terms of the encryption, key generation and decryption process execution, the complexity analysis shows that the load is within IoT operational capability. This implies that a higher level of security can be obtained without creating a huge effect on the real-time intrusion detection ones and hence offer a very strong defense against the potential inference attacks when there is model aggregation. Unlike more recent privacy-preserving methods like Differential Privacy, which also use noise addition and can negatively affect the utility of the data being analyzed, the presented HE-based framework can maintain the model accuracy and also ensure a high level of data confidentiality. This places it especially in applications of privacy-critical cases in industrial IoT networks. Besides, explainability methods including SHAP and LIME also give an idea of how the model predicts as well as improving the ability of the intrusion detection system to be viewed as more transparent and trustworthy. In general, the results indicate that centralized models can gain a better detection performance; nevertheless, FL +HE framework is a viable and secure alternative that can be used in distributed IoT contexts in which privacy of information is a major issue. The further development will be aimed at streamlining federated training, lightweight encryption strategies, and testing the suggested framework on various IoT datasets to improve scalability and performance.

CONFLICTS OF INTEREST

The authors declare no conflict of interest.

REFERENCES

[1] S. M. Tahsien, H. Karimipour, and P. Spachos, “Machine learning based solutions for security of Internet of Things (IoT): A survey,” J. Netw. Comput. Appl., vol. 161, p. 102630, Jul. 2020, doi: 10.1016/j.jnca.2020.102630.

[2] A. M. Kumar, J. E. Raja, and C. Senthilpari, “ADVANCED INTRUSION DETECTION AND CLASSIFICATION USING TRANSFER LEARNING WITH SQUEEZE-AND-EXCITATION NETWORK AND ADAPTIVE OPTIMIZATION IN BIG DATA,” Int. J. Comput. Networks Commun., vol. 17, no. 6, pp. 93 – 113, 2025, doi: 10.5121/ijcnc.2025.17606.

[3] M. M. Ogonji, G. Okeyo, and J. M. Wafula, “A survey on privacy and security of Internet of Things,” Comput. Sci. Rev., vol. 38, p. 100312, Nov. 2020, doi: 10.1016/j.cosrev.2020.100312.

[4] K. Gulati, R. S. Kumar Boddu, D. Kapila, S. L. Bangare, N. Chandnani, and G. Saravanan, “A review paper on wireless sensor network techniques in Internet of Things (IoT),” Mater. Today Proc., vol. 51, pp. 161–165, 2022, doi: 10.1016/j.matpr.2021.05.067.

[5] H. Xu, J. Wu, Q. Pan, X. Guan, and M. Guizani, “A Survey on Digital Twin for Industrial Internet of Things: Applications, Technologies and Tools,” IEEE Commun. Surv. Tutorials, vol. 25, no. 4, pp. 2569–2598, 2023, doi: 10.1109/COMST.2023.3297395.

[6] O. Aouedi et al., “A Survey on Intelligent Internet of Things: Applications, Security, Privacy, and Future Directions,” IEEE Commun. Surv. Tutorials, vol. 27, no. 2, pp. 1238–1292, Apr. 2025, doi: 10.1109/COMST.2024.3430368.

[7] R. Aziz, S. Banerjee, S. Bouzefrane, and T. Le Vinh, “Exploring Homomorphic Encryption and Differential Privacy Techniques towards Secure Federated Learning Paradigm,” Futur. Internet, vol. 15, no. 9, p. 310, Sep. 2023, doi: 10.3390/fi15090310.

[8] E. Esenogho, K. Djouani, and A. M. Kurien, “Integrating Artificial Intelligence Internet of Things and 5G for Next-Generation Smartgrid: A Survey of Trends Challenges and Prospect,” IEEE Access, vol. 10, pp. 4794–4831, 2022, doi: 10.1109/ACCESS.2022.3140595.

[9] R. Hassan, F. Qamar, M. K. Hasan, A. Hafizah, M. Aman, and A. S. Ahmed, “SS symmetry Internet of Things and Its Applications,” 2020.

[10] A. M. Fadhil, N. M. Din, N. B. M. Aripin, and A. A. Abed, “ADVANCED PRIVACY SCHEME TO IMPROVE ROAD SAFETY IN SMART TRANSPORTATION SYSTEMS,” Int. J. Comput. Networks Commun., vol. 16, no. 2, pp. 71 – 86, 2024, doi: 10.5121/ijcnc.2024.16205.

[11] K. Sallam, M. Mohamed, and A. Wagdy Mohamed, “Internet of Things (IoT) in Supply Chain Management: Challenges, Opportunities, and Best Practices,” Sustain. Mach. Intell. J., vol. 2, Mar. 2023, doi: 10.61185/SMIJ.2023.22103.

[12] K. P. Seng, L. M. Ang, and E. Ngharamike, “Artificial intelligence Internet of Things: A new paradigm of distributed sensor networks,” Int. J. Distrib. Sens. Networks, vol. 18, no. 3, p. 155014772110628, Mar. 2022, doi: 10.1177/15501477211062835.

[13] M. Wang, K. Zheng, Y. Yang, and X. Wang, “An Explainable Machine Learning Framework for Intrusion Detection Systems,” IEEE Access, vol. 8, pp. 73127–73141, 2020, doi: 10.1109/ACCESS.2020.2988359.

[14] P. Barnard, N. Marchetti, and L. A. DaSilva, “Robust Network Intrusion Detection Through Explainable Artificial Intelligence (XAI),” IEEE Netw. Lett., vol. 4, no. 3, pp. 167–171, Sep. 2022, doi: 10.1109/LNET.2022.3186589.

[15] Z. A. El Houda, B. Brik, and L. Khoukhi, “‘Why Should I Trust Your IDS?’: An Explainable Deep Learning Framework for Intrusion Detection Systems in Internet of Things Networks,” IEEE Open J. Commun. Soc., vol. 3, pp. 1164–1176, 2022, doi: 10.1109/OJCOMS.2022.3188750.

[16] D. Attique, W. Hao, W. Ping, D. Javeed, and P. Kumar, “Explainable and Data-Efficient Deep Learning for Enhanced Attack Detection in IIoT Ecosystem,” IEEE Internet Things J., vol. 11, no. 24, pp. 38976–38986, Dec. 2024, doi: 10.1109/JIOT.2024.3384374.

[17] R. Kalakoti, H. Bahsi, and S. Nõmm, “Improving IoT Security With Explainable AI: Quantitative Evaluation of Explainability for IoT Botnet Detection,” IEEE Internet Things J., vol. 11, no. 10, pp. 18237–18254, May 2024, doi: 10.1109/JIOT.2024.3360626.

[18] F. Cerasuolo, G. Bovenzi, D. Ciuonzo, and A. Pescapè, “Adaptable, incremental, and explainable network intrusion detection systems for internet of things,” Eng. Appl. Artif. Intell., vol. 144, p. 110143, Mar. 2025, doi: 10.1016/j.engappai.2025.110143.

[19] R. Alshamy and M. A. Akcayol, “INTRUSION DETECTION MODEL USING MACHINE LEARNING ALGORITHMS ON NSL-KDD DATASET,” Int. J. Comput. Networks Commun., vol. 16, no. 6, pp. 75 – 88, 2024, doi: 10.5121/ijcnc.2024.16605.

[20] D. C. Attota, V. Mothukuri, R. M. Parizi, and S. Pouriyeh, “An Ensemble Multi-View Federated Learning Intrusion Detection for IoT,” IEEE Access, vol. 9, pp. 117734–117745, 2021, doi: 10.1109/ACCESS.2021.3107337.

[21] A. Tabassum, A. Erbad, W. Lebda, A. Mohamed, and M. Guizani, “FEDGAN-IDS: Privacypreserving IDS using GAN and Federated Learning,” Comput. Commun., vol. 192, pp. 299–310, Aug. 2022, doi: 10.1016/j.comcom.2022.06.015.

[22] A. Alazab, A. Khraisat, S. Singh, and T. Jan, “Enhancing Privacy-Preserving Intrusion Detection through Federated Learning,” Electron., vol. 12, no. 16, 2023, doi: 10.3390/electronics12163382.

[23] M. Fahim-Ul-Islam, A. Chakrabarty, M. G. R. Alam, and S. S. B. Maidin, “A Resource-Efficient Federated Learning Framework for Intrusion Detection in IoMT Networks,” IEEE Trans. Consum. Electron., vol. 71, no. 2, pp. 4508–4521, May 2025, doi: 10.1109/TCE.2025.3544885.

[24] A. Khraisat, A. Alazab, M. Alazab, A. Obeidat, S. Singh, and T. Jan, “Federated learning for intrusion detection in IoT environments: a privacy-preserving strategy,” Discov. Internet Things, vol. 5, no. 1, p. 72, Jun. 2025, doi: 10.1007/s43926-025-00169-7.

[25] N. H. Quyen, P. T. Duy, N. T. Nguyen, N. H. Khoa, and V.-H. Pham, “FedKD-IDS: A robust intrusion detection system using knowledge distillation-based semi-supervised federated learning and anti-poisoning attack mechanism,” Inf. Fusion, vol. 117, p. 102807, May 2025, doi: 10.1016/j.inffus.2024.102807.

[26] A. U. Karimy and P. C. Reddy, “Enhancing IoT Security: A Novel Approach with Federated Learning and Differential Privacy Integration,” Int. J. Comput. Networks Commun., vol. 16, no. 4, pp. 01–17, Jul. 2024, doi: 10.5121/ijcnc.2024.16401.

[27] Z. He, L. Wang, and Z. Cai, “Clustered Federated Learning With Adaptive Local Differential Privacy on Heterogeneous IoT Data,” IEEE Internet Things J., vol. 11, no. 1, pp. 137–146, Jan. 2024, doi: 10.1109/JIOT.2023.3299947.

[28] C. Yang, K. Jia, D. Kong, J. Qi, and A. Zhou, “DP-GSGLD: A Bayesian optimizer inspired by differential privacy defending against privacy leakage in federated learning,” Comput. Secur., vol. 142, 2024, doi: 10.1016/j.cose.2024.103839.

[29] Y. Pan, Z. Chao, W. He, Y. Jing, L. Hongjia, and W. Liming, “FedSHE: privacy preserving and efficient federated learning with adaptive segmented CKKS homomorphic encryption,” Cybersecurity, vol. 7, no. 1, 2024, doi: 10.1186/s42400-024-00232-w.

[30] V. S. Naresh and A. D, “PPDNN-CRP: privacy-preserving deep neural network processing for credit risk prediction in cloud: a homomorphic encryption-based approach,” J. Cloud Comput., vol. 13, no. 1, p. 149, Oct. 2024, doi: 10.1186/s13677-024-00711-y.

[31] M. Xu and X. Li, “PPFL-IDS: Privacy-Preserving Federated Learning Based IDS Against Poisoning Attacks,” Mob. Networks Appl., vol. 29, no. 5, pp. 1514–1525, 2024, doi: 10.1007/s11036-023- 02231-6.

[32] X. Kong, L. Lu, and K. Xiong, “Privacy-preserving estimation of electric vehicle charging behavior: A federated learning approach based on differential privacy,” Internet of Things (Netherlands), vol. 28, 2024, doi: 10.1016/j.iot.2024.101344. [33] J. Ma and W. Su, “Collaborative DDoS defense for SDN-based AIoT with autoencoder-enhanced federated learning,” Inf. Fusion, vol. 117, p. 102820, May 2025, doi: 10.1016/j.inffus.2024.102820.

[34] W. Yao, T. Zhou, Y. Han, and X. Wang, “Verifiable secure aggregation scheme for privacy protection in federated learning networks,” Discov. Comput., vol. 28, no. 1, p. 175, Aug. 2025, doi: 10.1007/s10791-025-09676-1.

[35] D. Torre, A. Chennamaneni, J. Jo, G. Vyas, and B. Sabrsula, “Toward Enhancing Privacy Preservation of a Federated Learning CNN Intrusion Detection System in IoT: Method and Empirical Study,” ACM Trans. Softw. Eng. Methodol., vol. 34, no. 2, pp. 1–48, Feb. 2025, doi: 10.1145/3695998.

[36] Y. Kongsorot, P. Musikawan, P. Aimtongkham, I. You, A. Benslimane, and C. So-In, “An Intrusion Detection and Identification System for Internet of Things Networks Using a Hybrid Ensemble Deep Learning Framework,” IEEE Trans. Sustain. Comput., vol. 8, no. 4, pp. 596–613, Oct. 2023, doi: 10.1109/TSUSC.2023.3303422.

[37] A. Thakkar and R. Lohiya, “Attack Classification of Imbalanced Intrusion Data for IoT Network Using Ensemble-Learning-Based Deep Neural Network,” IEEE Internet Things J., vol. 10, no. 13, pp. 11888–11895, Jul. 2023, doi: 10.1109/JIOT.2023.3244810.

[38] M. Wazid, J. Singh, A. K. Das, and J. J. P. C. Rodrigues, “An Ensemble-Based Machine LearningEnvisioned Intrusion Detection in Industry 5.0-Driven Healthcare Applications,” IEEE Trans. Consum. Electron., vol. 70, no. 1, pp. 1903–1912, Feb. 2024, doi: 10.1109/TCE.2023.3318850.

[39] T. T. Huynh and H. T. Nguyen, “Effective Multi-Stage Training Model for Edge Computing Devices in Intrusion Detection,” Int. J. Comput. Networks Commun., vol. 16, no. 1, pp. 13–31, Jan. 2024, doi: 10.5121/ijcnc.2024.16102.

[40] P. Ghosh, J. Sharma, and N. Pandey, “Feature Selection using the Concept of Peafowl Mating in IDS,” Int. J. Comput. Networks Commun., vol. 16, no. 1, pp. 51–69, Jan. 2024, doi: 10.5121/ijcnc.2024.16104.

AUTHORS

Ms. Sadaf is a cybersecurity researcher based in Aligarh, India, currently pursuing and M.Sc. in Cybersecurity and Digital Forensics. Her interests include privacypreserving computing, intrusion detection, and federated learning. She has developed multiple academic projects in cybersecurity, machine learning, and software development, with strong skills in network security and data analysis. Sadaf is passionate about developing secure, intelligent, and trustworthy systems.

Prof. (Dr.) Aasim Zafar is a Professor in the Computer Science Department at and current Registrar of Aligarh Muslim University, India, with over 29 years of teaching and research experience. His expertise spans mobile ad hoc and sensor networks, image processing, information retrieval, e-security, and software engineering. He has published extensively and presented at national and international forums and SCIE journals. He has led and contributed to major projects, including an MHRD-funded initiative developing cloud-based systems like LibMS and EMS. During his tenure at King Abdulaziz University, he executed multiple research projects and received the Excellence in Teaching Award. Prof. Zafar also plays key administrative roles at AMU and actively promotes e-learning, MOOCs, SWAYAM and ICT-enabled education, training thousands of educators nationwide.

Dr. Mohammad Luqman is an Adjunct Professor and researcher in Computer Science from Aligarh Muslim University, specializing in cryptography, cybersecurity, and deep learning. His doctoral work focused on secure data transmission in wireless networks, integrating deep learning with encryption techniques and hybrid cryptographic models for IoT and wireless sensor systems. He has published in reputed SCIE-indexed journals and holds two patents in blockchain ledger security and IoT-based plant disease detection. His expertise includes lightweight encryption, blockchain technology, and quantum cryptography. A recipient of UGC-JRF and MANF fellowships, Dr. Luqman has demonstrated strong academic excellence and active participation in research programs and conferences. He is skilled in multiple programming languages and IoT tools, with current research focused on secure frameworks for IoT healthcare systems.

Leave a comment

Information

This entry was posted on August 22, 2026 by .