Privacy-Preserving Cyberattack Detection in Blockchain-Based IoT Systems Using AI and Homomorphic Encryption

Bui Duc Manh, Chi-Hieu Nguyen, Dinh Thai Hoang, Diep N. Nguyen, Ming Zeng, Quoc‐Viet Pham

TL;DR

This paper introduces a framework that allows blockchain-based IoT systems to detect cyberattacks using AI without ever exposing raw data to the cloud. By combining Homomorphic Encryption (HE) with novel SIMD data packing and distributed learning, the authors achieve detection accuracy nearly identical to unencrypted models while significantly slashing the massive computational overhead typically associated with encrypted AI.

What Problem Does This Paper Address?

As IoT devices become backbone infrastructure for smart cities and industries, they are increasingly integrated with blockchain to ensure data integrity. However, these systems remain prime targets for DDoS, Man-in-the-Middle (MitM), and routing attacks.

While Artificial Intelligence (AI) is excellent at spotting these attacks, training high-performance models requires massive datasets and heavy computation—resources that local IoT gateways simply don't have. The standard solution is to offload training to a Cloud Service Provider (CSP). The catch? Privacy. Sending raw network traffic to the cloud exposes sensitive user data.

Homomorphic Encryption (HE) is the "holy grail" here—it allows a server to perform math on data while it’s still encrypted. But HE is notoriously slow and limited in the types of operations it can perform (mostly just addition and multiplication), making standard Deep Learning training prohibitively expensive and complex.

Methods

The authors propose a Privacy-Preserving Distributed Learning (PPDiL) framework. Its core components include:

  1. CKKS Encryption Scheme: They utilize the Cheon-Kim-Kim-Song (CKKS) scheme, which is specifically designed for approximate arithmetic on floating-point numbers—perfect for the weights and biases in neural networks.
  2. SIMD Packing (Pack1D & Pack2D): To solve the efficiency problem, they developed innovative packing algorithms. These fit multiple data points (vectors or matrices) into a single ciphertext "slot" using a Single-Instruction-Multiple-Data (SIMD) approach. This allows the cloud to process batches of data in parallel rather than one by one.
  3. Encrypted DNN Training: Since HE doesn't support non-linear functions like ReLU or Tanh, the authors used Chebyshev polynomials to approximate the SiLU (Swish) activation function, allowing the network to learn complex patterns while remaining in the encrypted domain.
  4. Distributed FedAvg: To further speed things up, they parallelized the training across multiple cloud worker nodes using a modified Federated Averaging (FedAvg) algorithm. This allows the cloud to scale out the heavy lifting of encrypted computation.

Datasets

The framework was evaluated using the BNAT (Blockchain Network Attack) dataset.

  • Content: Real-world blockchain network traffic including normal operations and four specific attack types: Denial of Service (DoS), Brute-force Password (BP), Flooding of Transactions (FoT), and Man-in-the-Middle (MitM).
  • Preprocessing: The authors downsampled the data to 10,000 balanced samples and applied min-max scaling to prepare it for the HE-optimized neural network.

Key Insights and Ideas

  • The "Accuracy Gap" is Vanishing: One of the most significant "aha" moments is that training on encrypted data resulted in an accuracy drop of only 0.01% compared to non-encrypted training. This proves that privacy doesn't have to come at the cost of security performance.
  • Packing is the Key to Speed: By using SIMD packing, the authors transformed the linear overhead of HE into a parallelizable task. This is what makes the system move from "theoretical" to "practical."
  • Distributed HE Training: Most HE research focuses on inference (using a pre-trained model). This paper tackles the much harder task of training from scratch on encrypted data by distributing the load across cloud workers, reducing total training time by over 50%.

Key Results

  • High Accuracy: The model achieved approximately 91% accuracy across all attack types, matching the performance of "plain" (unencrypted) models.
  • Training Speedup: A centralized encrypted training session took ~52.75 hours. By distributing the task to 5 worker nodes using their PPDiL approach, the time dropped to 21.64 hours.
  • Real-world Feasibility: The authors tested the deployment on various hardware (Intel Xeon, AMD EPYC) and blockchain consensus mechanisms (PoW, PoA, PoS). They found that while PoW (Proof of Work) adds some latency due to its own high resource demand, lightweight protocols like PoA and PoS are perfectly compatible with HE-based detection.
  • Inference Throughput: On a high-end edge server (BN-1), the system could process roughly 2.4 encrypted samples per second, making it viable for near-real-time monitoring of IoT traffic.

Limitations and Future Work

While the speedup is impressive, 21 hours for training and 2.5 minutes to process a 400-sample data frame still represent a significant computational "tax" compared to unencrypted systems.

The authors identify a few areas for growth:

  • Communication Overhead: As more workers are added to the distributed cloud, the time spent synchronizing models increases. Optimizing this "waiting time" is crucial for scaling.
  • Hardware Acceleration: The study relied on general-purpose CPUs. Future work could explore using FPGAs or ASICs specifically designed for HE primitives to bring detection closer to true real-time speeds.
  • Dynamic Scaling: The current model uses a fixed architecture; adapting the network depth or packing density based on live network load could improve efficiency.

Summary updated

Abstract

This work proposes a novel privacy-preserving cyberattack detection framework for blockchain-based Internet-of-Things (IoT) systems. In our approach, artificial intelligence (AI)-driven detection modules are strategically deployed at blockchain nodes to identify real-time attacks, ensuring high accuracy and minimal delay. To achieve this efficiency, the model training is conducted by a cloud service provider (CSP). Accordingly, blockchain nodes send their data to the CSP for training, but to safeguard privacy, the data is encrypted using homomorphic encryption (HE) before transmission. This encryption method allows the CSP to perform computations directly on encrypted data without the need for decryption, preserving data privacy throughout the learning process. To handle the substantial volume of encrypted data, we introduce an innovative packing algorithm in a Single-Instruction-Multiple-Data (SIMD) manner, enabling efficient training on HE-encrypted data. Building on this, we develop a novel deep neural network training algorithm optimized for encrypted data. We further propose a privacy-preserving distributed learning approach based on the FedAvg algorithm, which parallelizes the training across multiple workers, significantly improving computation time. Upon completion, the CSP distributes the trained model to the blockchain nodes, enabling them to perform real-time, privacy-preserved detection. Our simulation results demonstrate that our proposed method can not only mitigate the training time but also achieve detection accuracy that is approximately identical to the approach without encryption, with a gap of around 0.01%. Additionally, our real implementations on various blockchain consensus algorithms and hardware configurations show that our proposed framework can also be effectively adapted to real-world systems.
BibTeX
@article{manh2025privacy,
  author = {Bui Duc Manh and Chi-Hieu Nguyen and Dinh Thai Hoang and Diep N. Nguyen and Ming Zeng and Quoc‐Viet Pham},
  title = {{Privacy-Preserving Cyberattack Detection in Blockchain-Based IoT Systems Using AI and Homomorphic Encryption}},
  journal = {IEEE Internet of Things Journal},
  year = {2025},
  doi = {10.1109/jiot.2025.3535792},
}
Figure