vio1etus/FLPoison

FLPoison: Benchmarking Poisoning Attacks and Defenses in Federated Learning

Python

66

18 commits

updated Apr 15, 2026

See the code

README

Welcome to FLPoison

Python Versions Framework Last Commit License: GPL v2

Check the Wiki to get started with the project.

Features

PyTorch's implementation of poisoning attacks and defenses in federated learning.

CategoryDetails
FL AlgorithmsFedAvg, FedSGD, FedOpt(see fl/algorithms)
Data DistributionBalanced IID, Class-imbalanced IID, Quantity-imbalanced Dirichlet Non-IID, (Quantity-Balanced|-Imbalanced) Pathological Non-IID (see data_utils.py)
DatasetsMNIST, FashionMNIST, EMNIST, CIFAR10, CINIC10, CIFAR100, CHMNIST, TinyImageNet (see dataset_config.yaml)
ModelsLogistic Regression, SimpleCNN, LeNet5, ResNet-series, VGG-series

Supported datasets and models pairs see datamodel.pdf

Federated Learning Algorithms

Attacks and Defenses

Applicable algorithms include base algorithms used by original paper, as well as others not explicitly mentioned but applicable based on the described principles. [ ] indicates necessary modifications for compatibility, also implemented within this framework. To sum up, we implemented and adapted the attacks and defenses to be compatible with three commonly-used FL algorithms, FedSGD, FedOpt, FedAvg.

Data Poisoning Attacks (DPAs)

Data poisoning attacks here, mainly targeted attacks, refer to attacks aimed at embedding backdoors or bias into the model, thus misleading it to produce the attacker's intended prediction

NameSource FilePaperBase AlgorithmApplicable Algorithms
Neurotoxinneurotoxin.pyNeurotoxin: Durable Backdoors in Federated Learning - ICML '22FedOptFedOpt, [FedSGD, FedAvg]
Edge-case Backdooredgecase.pyAttack of the Tails: Yes, You Really Can Backdoor Federated Learning - NeurIPS '20FedOptFedSGD, FedOpt, [FedAvg]
Model Replacement Attack (Scaling Attack)modelreplacement.pyHow to Backdoor Federated Learning - AISTATS '20FedOptFedOpt, [FedSGD, FedAvg]
Alternating Minimizationaltermin.pyAnalyzing Federated Learning Through an Adversarial Lens - ICML '19FedOptFedSGD, FedOpt, [FedAvg]
DBAdba.pyDBA: Distributed Backdoor Attacks Against Federated Learning - ICLR '19FedOptFedSGD, FedOpt, [FedAvg]
BadNetsbadnets.pyBadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chain - NIPS-WS '17Centralized ML[FedSGD, FedOpt, FedAvg]
Label Flipping Attacklabelflipping.pyPoisoning Attacks against Support Vector Machines - ICML'12Centralized ML[FedSGD, FedOpt, FedAvg]

Defenses Against DPAs

NameSource FilePaperBase AlgorithmApplicable Algorithms
FLAMEflame.pyFLAME: Taming Backdoors in Federated Learning - USENIX Security '22FedOptFedOpt,[FedSGD, FedAvg]
DeepSightdeepsight.pyDeepSight: Mitigating Backdoor Attacks in Federated Learning Through Deep Model Inspection - NDSS '22FedOptFedOpt, [FedSGD, FedAvg]
CRFLcrfl.pyCRFL: Certifiably Robust Federated Learning against Backdoor Attacks - ICML '21FedOptFedOpt, [FedSGD, FedAvg]
NormClippingnormclipping.pyCan You Really Backdoor Federated Learning - NeurIPS '20FedOptFedOpt, [FedSGD, FedAvg]
FoolsGoldfoolsgold.pyThe Limitations of Federated Learning in Sybil Settings - RAID '20FedSGDFedSGD, [FedOpt, FedAvg]
Aurorauror.pyAuror: Defending against poisoning attacks in collaborative deep learning systems - ACSAC '16FedSGDFedSGD, [FedOpt, FedAvg]

Model Poisoning Attacks (MPAs)

Model poisoning attacks here, main untargeted attacks, refer to the attacks aimed at preventing convergence of the model, thus affecting the model's performance.

NameSource FilePaperBase AlgorithmApplicable Algorithms
HIDRA Attackhidra.pyAttacking Byzantine Robust Aggregation in High Dimensions - IEEE S&P '24FedSGDFedSGD, [FedOpt, FedAvg]
Mimic Attackmimic.pyByzantine-Robust Learning on Heterogeneous Datasets via Bucketing - ICLR '22FedSGDFedSGD, [FedOpt, FedAvg]
Min-Max attackmin.pyManipulating the Byzantine: Optimizing Model Poisoning Attacks and Defenses for Federated Learning - NDSS '21FedSGDFedSGD, [FedOpt, FedAvg]
Min-Sum attackmin.pyManipulating the Byzantine: Optimizing Model Poisoning Attacks and Defenses for Federated Learning - NDSS '21FedSGDFedSGD, [FedOpt, FedAvg]
Fang attack (Adaptive attack)fangattack.pyLocal Model Poisoning Attacks to Byzantine-Robust Federated Learning - USENIX Security '20FedAvg[FedSGD, FedOpt], FedAvg
IPM attackipm.pyFall of empires: Breaking Byzantine-tolerant SGD by inner product manipulation - UAI '20FedSGDFedSGD, [FedOpt, FedAvg]
ALIE attackalie.pyA Little Is Enough: Circumventing Defenses For Distributed Learning - NeurIPS '19FedSGDFedSGD, [FedOpt, FedAvg]
Sign flipping attacksignflipping.pyAsynchronous Byzantine machine learning (the case of SGD) - ICML '18FedSGDFedSGD, [FedOpt, FedAvg]
Gaussian (noise) attackgaussian.pyMachine Learning with Adversaries: Byzantine Tolerant Gradient Descent - NeurIPS '17FedSGDFedSGD, [FedOpt, FedAvg]

Defenses Against MPAs

NameSource FilePaperBase AlgorithmApplicable Algorithms
LASAlasa.pyAchieving Byzantine-Resilient Federated Learning via Layer-Adaptive Sparsified Model Aggregation - WACV '25FedOptFedSGD, [FedOpt, FedAvg]
FedSignfedsign.pyFedSIGN: A sign-based federated learning framework with privacy and robustness guarantees - Computers & Security 2023FedSGD[FedSGD], FedOpt, FedAvg]
FLDetectorfldetector.pyFLDetector: Defending Federated Learning Against Model Poisoning Attacks via Detecting Malicious Clients - KDD '22FedSGDFedOpt, [FedOpt, FedAvg]
SignGuardsignguard.pyByzantine-robust Federated Learning through Collaborative Malicious Gradient Filtering - ICDCS '22FedSGDFedSGD, [FedOpt, FedAvg]
Bucketingbucketing.pyByzantine-Robust Learning on Heterogeneous Datasets via Bucketing - ICLR '22FedSGDFedSGD, [FedOpt, FedAvg]
DnCdnc.pyManipulating the Byzantine: Optimizing Model Poisoning Attacks and Defenses for Federated Learning - NDSS '21FedSGDFedSGD, [FedOpt, FedAvg]
CenteredClippingcenteredclippingLearning from History for Byzantine Robust Optimization - ICML '21FedSGDFedSGD, [FedOpt, FedAvg]
FLTrustfltrust.pyFLTrust: Byzantine-robust Federated Learning via Trust Bootstrapping - ArXiv'20, NDSS '21FedOptFedOpt, [FedSGD, FedAvg]
RFA (Geometric Median)rfa.pyRobust Aggregation for Federated Learning - ArXiv'19, TSP '22FedAvg[FedSGD, FedOpt], FedAvg
Bulyanbulyan.pyThe hidden vulnerability of distributed learning in Byzantium - ICML'18FedSGDFedSGD, [FedOpt,FedAvg]
Coordinate-wise Medianmedian.pyByzantine-robust distributed learning: Towards optimal statistical rates - ICML'18FedSGDFedSGD, [FedOpt, FedAvg]
Trimmed Meantrimmedmean.pyByzantine-robust distributed learning: Towards optimal statistical rates - ICML'18FedSGDFedSGD, [FedOpt, FedAvg]
Multi-Krummultikrum.pyMachine Learning with Adversaries: Byzantine Tolerant Gradient Descent - NeurIPS '17FedSGDFedSGD, [FedOpt, FedAvg]
Krumkrum.pyMachine Learning with Adversaries: Byzantine Tolerant Gradient Descent - NeurIPS '17FedSGDFedSGD, [FedOpt, FedAvg]
SimpleClusteringsimpleclustering.pySimple majority-based clusteringFedSGD, FedAvg, FedOptFedSGD, FedAvg, FedOpt

Contributing

Bug reports, feature suggestions, and code contributions are welcome. Please open an issue or submit a pull request if you encounter any problems or have suggestions.

Citation

If you are using FLPoison for your work, please cite our paper with:

@misc{sokflpoison,
      title={SoK: Benchmarking Poisoning Attacks and Defenses in Federated Learning},
      author={Heyi Zhang and Yule Liu and Xinlei He and Jun Wu and Tianshuo Cong and Xinyi Huang},
      year={2025},
      eprint={2502.03801},
      archivePrefix={arXiv},
      primaryClass={cs.CR},
      url={https://arxiv.org/abs/2502.03801},
}
adversarial-attacks
benchmarking
byzantine-robust
federated-learning
poisoning-defenses
pytorch
robust-machine-learning

vio1etus/FLPoison

FLPoison: Benchmarking Poisoning Attacks and Defenses in Federated Learning

Python

66

18 commits

updated Apr 15, 2026

See the code

README

Welcome to FLPoison

Python Versions Framework Last Commit License: GPL v2

Check the Wiki to get started with the project.

Features

PyTorch's implementation of poisoning attacks and defenses in federated learning.

CategoryDetails
FL AlgorithmsFedAvg, FedSGD, FedOpt(see fl/algorithms)
Data DistributionBalanced IID, Class-imbalanced IID, Quantity-imbalanced Dirichlet Non-IID, (Quantity-Balanced|-Imbalanced) Pathological Non-IID (see data_utils.py)
DatasetsMNIST, FashionMNIST, EMNIST, CIFAR10, CINIC10, CIFAR100, CHMNIST, TinyImageNet (see dataset_config.yaml)
ModelsLogistic Regression, SimpleCNN, LeNet5, ResNet-series, VGG-series

Supported datasets and models pairs see datamodel.pdf

Federated Learning Algorithms

Attacks and Defenses

Applicable algorithms include base algorithms used by original paper, as well as others not explicitly mentioned but applicable based on the described principles. [ ] indicates necessary modifications for compatibility, also implemented within this framework. To sum up, we implemented and adapted the attacks and defenses to be compatible with three commonly-used FL algorithms, FedSGD, FedOpt, FedAvg.

Data Poisoning Attacks (DPAs)

Data poisoning attacks here, mainly targeted attacks, refer to attacks aimed at embedding backdoors or bias into the model, thus misleading it to produce the attacker's intended prediction

NameSource FilePaperBase AlgorithmApplicable Algorithms
Neurotoxinneurotoxin.pyNeurotoxin: Durable Backdoors in Federated Learning - ICML '22FedOptFedOpt, [FedSGD, FedAvg]
Edge-case Backdooredgecase.pyAttack of the Tails: Yes, You Really Can Backdoor Federated Learning - NeurIPS '20FedOptFedSGD, FedOpt, [FedAvg]
Model Replacement Attack (Scaling Attack)modelreplacement.pyHow to Backdoor Federated Learning - AISTATS '20FedOptFedOpt, [FedSGD, FedAvg]
Alternating Minimizationaltermin.pyAnalyzing Federated Learning Through an Adversarial Lens - ICML '19FedOptFedSGD, FedOpt, [FedAvg]
DBAdba.pyDBA: Distributed Backdoor Attacks Against Federated Learning - ICLR '19FedOptFedSGD, FedOpt, [FedAvg]
BadNetsbadnets.pyBadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chain - NIPS-WS '17Centralized ML[FedSGD, FedOpt, FedAvg]
Label Flipping Attacklabelflipping.pyPoisoning Attacks against Support Vector Machines - ICML'12Centralized ML[FedSGD, FedOpt, FedAvg]

Defenses Against DPAs

NameSource FilePaperBase AlgorithmApplicable Algorithms
FLAMEflame.pyFLAME: Taming Backdoors in Federated Learning - USENIX Security '22FedOptFedOpt,[FedSGD, FedAvg]
DeepSightdeepsight.pyDeepSight: Mitigating Backdoor Attacks in Federated Learning Through Deep Model Inspection - NDSS '22FedOptFedOpt, [FedSGD, FedAvg]
CRFLcrfl.pyCRFL: Certifiably Robust Federated Learning against Backdoor Attacks - ICML '21FedOptFedOpt, [FedSGD, FedAvg]
NormClippingnormclipping.pyCan You Really Backdoor Federated Learning - NeurIPS '20FedOptFedOpt, [FedSGD, FedAvg]
FoolsGoldfoolsgold.pyThe Limitations of Federated Learning in Sybil Settings - RAID '20FedSGDFedSGD, [FedOpt, FedAvg]
Aurorauror.pyAuror: Defending against poisoning attacks in collaborative deep learning systems - ACSAC '16FedSGDFedSGD, [FedOpt, FedAvg]

Model Poisoning Attacks (MPAs)

Model poisoning attacks here, main untargeted attacks, refer to the attacks aimed at preventing convergence of the model, thus affecting the model's performance.

NameSource FilePaperBase AlgorithmApplicable Algorithms
HIDRA Attackhidra.pyAttacking Byzantine Robust Aggregation in High Dimensions - IEEE S&P '24FedSGDFedSGD, [FedOpt, FedAvg]
Mimic Attackmimic.pyByzantine-Robust Learning on Heterogeneous Datasets via Bucketing - ICLR '22FedSGDFedSGD, [FedOpt, FedAvg]
Min-Max attackmin.pyManipulating the Byzantine: Optimizing Model Poisoning Attacks and Defenses for Federated Learning - NDSS '21FedSGDFedSGD, [FedOpt, FedAvg]
Min-Sum attackmin.pyManipulating the Byzantine: Optimizing Model Poisoning Attacks and Defenses for Federated Learning - NDSS '21FedSGDFedSGD, [FedOpt, FedAvg]
Fang attack (Adaptive attack)fangattack.pyLocal Model Poisoning Attacks to Byzantine-Robust Federated Learning - USENIX Security '20FedAvg[FedSGD, FedOpt], FedAvg
IPM attackipm.pyFall of empires: Breaking Byzantine-tolerant SGD by inner product manipulation - UAI '20FedSGDFedSGD, [FedOpt, FedAvg]
ALIE attackalie.pyA Little Is Enough: Circumventing Defenses For Distributed Learning - NeurIPS '19FedSGDFedSGD, [FedOpt, FedAvg]
Sign flipping attacksignflipping.pyAsynchronous Byzantine machine learning (the case of SGD) - ICML '18FedSGDFedSGD, [FedOpt, FedAvg]
Gaussian (noise) attackgaussian.pyMachine Learning with Adversaries: Byzantine Tolerant Gradient Descent - NeurIPS '17FedSGDFedSGD, [FedOpt, FedAvg]

Defenses Against MPAs

NameSource FilePaperBase AlgorithmApplicable Algorithms
LASAlasa.pyAchieving Byzantine-Resilient Federated Learning via Layer-Adaptive Sparsified Model Aggregation - WACV '25FedOptFedSGD, [FedOpt, FedAvg]
FedSignfedsign.pyFedSIGN: A sign-based federated learning framework with privacy and robustness guarantees - Computers & Security 2023FedSGD[FedSGD], FedOpt, FedAvg]
FLDetectorfldetector.pyFLDetector: Defending Federated Learning Against Model Poisoning Attacks via Detecting Malicious Clients - KDD '22FedSGDFedOpt, [FedOpt, FedAvg]
SignGuardsignguard.pyByzantine-robust Federated Learning through Collaborative Malicious Gradient Filtering - ICDCS '22FedSGDFedSGD, [FedOpt, FedAvg]
Bucketingbucketing.pyByzantine-Robust Learning on Heterogeneous Datasets via Bucketing - ICLR '22FedSGDFedSGD, [FedOpt, FedAvg]
DnCdnc.pyManipulating the Byzantine: Optimizing Model Poisoning Attacks and Defenses for Federated Learning - NDSS '21FedSGDFedSGD, [FedOpt, FedAvg]
CenteredClippingcenteredclippingLearning from History for Byzantine Robust Optimization - ICML '21FedSGDFedSGD, [FedOpt, FedAvg]
FLTrustfltrust.pyFLTrust: Byzantine-robust Federated Learning via Trust Bootstrapping - ArXiv'20, NDSS '21FedOptFedOpt, [FedSGD, FedAvg]
RFA (Geometric Median)rfa.pyRobust Aggregation for Federated Learning - ArXiv'19, TSP '22FedAvg[FedSGD, FedOpt], FedAvg
Bulyanbulyan.pyThe hidden vulnerability of distributed learning in Byzantium - ICML'18FedSGDFedSGD, [FedOpt,FedAvg]
Coordinate-wise Medianmedian.pyByzantine-robust distributed learning: Towards optimal statistical rates - ICML'18FedSGDFedSGD, [FedOpt, FedAvg]
Trimmed Meantrimmedmean.pyByzantine-robust distributed learning: Towards optimal statistical rates - ICML'18FedSGDFedSGD, [FedOpt, FedAvg]
Multi-Krummultikrum.pyMachine Learning with Adversaries: Byzantine Tolerant Gradient Descent - NeurIPS '17FedSGDFedSGD, [FedOpt, FedAvg]
Krumkrum.pyMachine Learning with Adversaries: Byzantine Tolerant Gradient Descent - NeurIPS '17FedSGDFedSGD, [FedOpt, FedAvg]
SimpleClusteringsimpleclustering.pySimple majority-based clusteringFedSGD, FedAvg, FedOptFedSGD, FedAvg, FedOpt

Contributing

Bug reports, feature suggestions, and code contributions are welcome. Please open an issue or submit a pull request if you encounter any problems or have suggestions.

Citation

If you are using FLPoison for your work, please cite our paper with:

@misc{sokflpoison,
      title={SoK: Benchmarking Poisoning Attacks and Defenses in Federated Learning},
      author={Heyi Zhang and Yule Liu and Xinlei He and Jun Wu and Tianshuo Cong and Xinyi Huang},
      year={2025},
      eprint={2502.03801},
      archivePrefix={arXiv},
      primaryClass={cs.CR},
      url={https://arxiv.org/abs/2502.03801},
}
adversarial-attacks
benchmarking
byzantine-robust
federated-learning
poisoning-defenses
pytorch
robust-machine-learning