Anomaly Detection via Federated Learning

Marc Vucovich, Amogh Kamat Tarcar, Penjo Rebelo, Narendra Gade, Ruchi Porwal, Abdul Rahman, Christopher Redino, Kevin Choi, Dhruv Nandakumar, Robert Schiller, Edward Bowen, Alex West, Sanmitra Bhattacharya, Balaji VeeramaniarXiv 2022

TL;DR

This paper introduces FedSam, a novel federated learning (FL) approach for anomaly detection in network traffic. By combining an autoencoder with a classifier and employing a unique min-max scalar and sampling technique, FedSam enables collaborative model training without compromising data privacy, leading to improved intrusion detection system (IDS) performance across diverse clients.

What Problem Does This Paper Address?

Cyberattacks are constantly evolving, necessitating robust and up-to-date Intrusion Detection Systems (IDS). Traditional machine learning approaches for anomaly detection often require centralizing vast amounts of sensitive network data, which poses significant privacy risks and is impractical for organizations with distributed data. Federated Learning (FL) offers a solution by allowing models to be trained collaboratively across multiple clients without sharing raw data. However, a key challenge in FL, especially for anomaly detection, is handling heterogeneous data distributions across clients (Non-IID data). This heterogeneity can hinder model convergence and lead to biased or ineffective global models. This paper aims to address these challenges by proposing a novel FL framework that can effectively train an anomaly detection model on diverse, distributed datasets while ensuring data privacy and improving detection accuracy.

Methods

The core of the proposed solution is a federated anomaly detection system that combines an autoencoder for unsupervised learning and a classifier for supervised learning.

  • Autoencoder and Classifier: An autoencoder is trained on benign network data to learn a compressed representation of normal traffic. When anomalous (attack) data is passed through, the reconstruction error is higher. This reconstruction loss is then used as input to a sequential binary classifier, which is trained to distinguish between benign and malicious activity. This approach aims to overcome the difficulty of setting a single, optimal threshold for anomaly detection.
  • Federated Learning Setup: The training process is orchestrated in a 3-step federated manner:
  • The FL server distributes a global autoencoder to clients, who train it on their local benign data and return updated weights.
  • Clients use the global autoencoder to generate reconstruction loss vectors from their local data, creating training data for the classifier.
  • The FL server distributes a global classifier, which clients then train using their generated reconstruction loss data and corresponding labels, returning updated weights.
  • Novel Min-Max Scalar: To address data heterogeneity, a novel global min-max scalar algorithm is introduced. This algorithm iteratively updates a global min-max scalar across clients, ensuring that the scaling applied to each client's data is representative of the entire federated network, rather than just individual client distributions.
  • FedSam Sampling Technique: FedSam is a new sampling technique that combines aspects of Mini-Batch and Multi-Epoch aggregation. It uses a "sampling size" (number of data points) for training in each round, ensuring that each client contributes an equal amount of data for training, regardless of their total data volume. This prevents clients with larger datasets from dominating the training process and helps achieve more balanced convergence.

Datasets

The following datasets were used for training and evaluation:

  • CIC-IDS2017: Contains labeled network activity data for benign and cyber-attack traffic.
  • CIC-IDS2018: Similar to CIC-IDS2017, with labeled network data for benign and attack traffic.
  • NCC-DC (National Collegiate Cyber Defense Competition): Labeled network activity data for benign and specific attack types.
  • MAWI-Lab: A database of benign network activity. This dataset was used for FL training of the autoencoder but did not participate in attack detection as it lacks attack data.

The paper does not introduce new benchmark datasets but utilizes existing ones to evaluate the proposed FL approach.

Key Insights and Ideas

  • Federated Autoencoder + Classifier Synergy: Combining an autoencoder for feature extraction (reconstruction loss) with a classifier for direct prediction proves more effective than relying solely on an autoencoder's reconstruction error threshold for anomaly detection, especially in complex, real-world scenarios.
  • Addressing Non-IID Data is Crucial: The paper strongly emphasizes that handling heterogeneous data distributions (Non-IID) is a primary challenge in FL for IDS. Their novel min-max scalar and FedSam sampling technique are specifically designed to mitigate these issues.
  • Equal Client Influence is Key: FedSam's sampling mechanism ensures that each client contributes equally to the global model's training, preventing data imbalance from skewing the learning process and leading to a more robust and representative global model.
  • Privacy-Preserving Anomaly Detection: The FL framework inherently protects client data privacy by only sharing model parameters, not raw network traffic, making it a valuable solution for organizations concerned about data confidentiality.
  • Theoretical Benchmark for Centralized Models: The paper establishes a theoretical benchmark by training a central model on all datasets combined, highlighting the potential performance ceiling that FL aims to approach while maintaining privacy.

Key Results

  • Improved Performance with FedSam: Experiments showed that the FL model using the novel min-max scalar and FedSam achieved superior performance compared to models using individual min-max scalars or FedMMB, particularly in handling clients with different data distributions.
  • High Accuracy on Unknown Data: The FL model trained with FedSam demonstrated strong generalization capabilities, achieving high precision, recall, and F1 scores when tested on datasets it had not seen during training. For instance, in one experiment with unknown data, benign traffic achieved 1.0 precision and 0.89 recall, while attack traffic achieved 1.0 precision and 0.93 recall.
  • Effective Central Model Benchmark: The centrally trained model using all datasets achieved near-perfect performance (e.g., 0.99 precision, 0.99 recall, 0.99 F1 score for benign traffic), serving as a strong theoretical benchmark. The FL model with FedSam approached this performance, achieving around 0.96-0.97 F1 scores for both benign and attack traffic in some experiments.
  • Reduced Influence of Data Imbalance: FedSam effectively negated the "push/pull" effect from clients with varying data amounts, ensuring more consistent training across all participants.

Limitations and Future Work

  • Detection of Data Poisoning: The authors acknowledge that a critical limitation is the lack of mechanisms to detect when a client might intentionally or unintentionally use attack data to train the autoencoder. This could lead to the anomaly detector missing attacks and leaving clients vulnerable.
  • Future Work - Detecting Data Poisoning: A primary future research direction is to explore methods for detecting such malicious or erroneous data poisoning attempts within the federated network.
  • Future Work - Expanding Scope: The authors suggest expanding the scope by using a globally shared FL model and further investigating ways to detect model poisoning.

Summary updated

Abstract

Machine learning has helped advance the field of anomaly detection by incorporating classifiers and autoencoders to decipher between normal and anomalous behavior. Additionally, federated learning has provided a way for a global model to be trained with multiple clients' data without requiring the client to directly share their data. This paper proposes a novel anomaly detector via federated learning to detect malicious network activity on a client's server. In our experiments, we use an autoencoder with a classifier in a federated learning framework to determine if the network activity is benign or malicious. By using our novel min-max scalar and sampling technique, called FedSam, we determined federated learning allows the global model to learn from each client's data and, in turn, provide a means for each client to improve their intrusion detection system's defense against cyber-attacks.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
CIC-IDS2018, CIC-IDS2017, and NCC-DC; 3-client federated evaluationFedMMB (Model 1)F1 score (Benign)0.96Trained for 5,000 rounds using the novel min-max algorithm; clients used CIC-IDS2018, C…
Source quote
L349: 1 │ Benign │ 0.97 │ 0.95 │ 0.96 │ [22727,1273]
CIC-IDS2018, CIC-IDS2017, and NCC-DC; 3-client federated evaluationFedMMB (Model 1)F1 score (Attack)0.96Trained for 5,000 rounds using the novel min-max algorithm; clients used CIC-IDS2018, C…
Source quote
L351: Attack │ 0.95 │ 0.97 │ 0.96 │ [716,23284]
CIC-IDS2018, CIC-IDS2017, and NCC-DC; 3-client federated evaluationFederated model using the novel min-max scalar and FedSam (Model 1)F1 score (Benign)0.91Trained for 200 rounds; the three clients used CIC-IDS2018, CIC-IDS2017, and NCC-DC data.
Source quote
L322: 1 │ Benign │ 0.94 │ 0.87 │ 0.91 │ [20935,3065]
CIC-IDS2018, CIC-IDS2017, and NCC-DC; 3-client federated evaluationFederated model using the novel min-max scalar and FedSam (Model 1)F1 score (Attack)0.91Trained for 200 rounds; the three clients used CIC-IDS2018, CIC-IDS2017, and NCC-DC data.
Source quote
L324: Attack │ 0.88 │ 0.95 │ 0.91 │ [1303,22697]
BibTeX
@misc{vucovich2022anomaly,
  author = {Marc Vucovich and Amogh Kamat Tarcar and Penjo Rebelo and Narendra Gade and Ruchi Porwal and Abdul Rahman and Christopher Redino and Kevin Choi and Dhruv Nandakumar and Robert Schiller and Edward Bowen and Alex West and Sanmitra Bhattacharya and Balaji Veeramani},
  title = {{Anomaly Detection via Federated Learning}},
  year = {2022},
  eprint = {2210.06614},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.06614},
}
Figure