Hammer and Anvil: A Principled Defense Against Backdoors in Federated Learning

Lucas Fenaux, Zheng Wang, Jacob Yan, Nathan Chung, Florian KerschbaumarXiv 2025 · DOI

Abstract

Federated Learning (FL) enables multiple clients to collaboratively train a machine learning model without sharing raw data. However, its distributed nature makes it highly susceptible to "backdoor attacks," where malicious clients insert triggers to cause specific misclassifications. We present Hammer and Anvil (HA), a dual-layered defense strategy designed to close the operating window for attackers. The "Anvil" utilizes robust aggregation to block large, disruptive updates, while the "Hammer" employs a novel Clipped-Super-Fine-Tuning (CSFT) process to surgically remove stealthy, low-magnitude backdoors. Our evaluation on CIFAR-10 and MNIST demonstrates that HA effectively reduces the Attack Success Rate (ASR) to 5-15% while maintaining high benign accuracy, even against adaptive adversaries.

Introduction

In Federated Learning, security is a constant game of cat and mouse. While FL offers inherent privacy benefits, it opens the door for malicious actors to sneak triggers into the global model. Existing defenses typically fall into two categories: robust aggregation (filtering outliers during training) and model surgery (post-training fine-tuning). However, adaptive attackers can often bypass aggregation by scaling updates to appear benign, while standard fine-tuning in a federated context often degrades overall model accuracy.

The Vulnerability of Federated Learning

The core challenge lies in the "operating window" available to attackers. If an attacker submits a large update to ensure a backdoor "sticks," robust aggregation methods like Krum or Median-of-Means can identify and discard it. Conversely, if the attacker submits a small, stealthy update, it bypasses the aggregator but remains embedded in the model weights.

Figure 2: Illustration of how a single attacker can manipulate the median aggregate to shift the global model update.

As shown in Figure 2, even robust rules like the Median can be manipulated by a single strategic attacker to shift the aggregate update in a desired adversarial direction.

The Hammer and Anvil Defense

To address this, the researchers propose a two-pronged approach:

The Anvil: Robust Aggregation

The first line of defense uses Byzantine-resilient aggregation methods (e.g., Krum). These are highly effective at stopping "loud" attacks—updates with large $l_2$-norms that would otherwise drastically shift the model's behavior in a single round. By enforcing a strict boundary on what constitutes a "normal" update, the Anvil forces attackers to use smaller, less effective updates.

The Hammer: Clipped-Super-Fine-Tuning (CSFT)

To catch the "quiet" attacks that sneak past the Anvil, the authors introduced Clipped-Super-Fine-Tuning (CSFT). This process involves fine-tuning the global model on a small set of clean data (1-4% of the total training set). The "secret sauce" is the addition of gradient clipping during this phase, which prevents the model from collapsing and allows for the surgical removal of weakly-inserted backdoors.

Figure 6: Performance of the 'Hammer' (CSFT) across different clip thresholds, showing the trade-off between benign accuracy and backdoor removal.

Experimental Results

The researchers evaluated HA using standard benchmarks like CIFAR-10 and MNIST. Key findings include:

  • Effectiveness Against Adaptive Attacks: In scenarios with up to 8 attackers out of 20, the combination of Krum and CSFT (Krum+) reduced the ASR to as low as 5-15%, well below the 50% success threshold.
  • Preserving Accuracy: The defense maintained high benign accuracy. On CIFAR-10, the accuracy drop was typically less than 5% compared to an undefended model. As illustrated in Figure 6, proper gradient clipping is essential; without it (no_clip), the fine-tuning process can cause the model to collapse (dropping accuracy to ~10%), whereas optimal clipping thresholds successfully scrub the backdoor while maintaining performance.
  • Resilience to State-of-the-Art: HA successfully defeated advanced attacks like Neurotoxin and Distributed Backdoor Attacks (DBA), which frequently bypass simpler defenses.

Conclusion

The "Hammer and Anvil" strategy effectively pincers attackers: they must choose between being caught by the Anvil or being wiped out by the Hammer. While the defense requires a small amount of clean data for the fine-tuning phase, it provides a principled and robust framework for securing federated learning systems against sophisticated backdoor threats. Future work will explore the application of HA in non-vision domains such as Natural Language Processing.

Summary updated

BibTeX
@misc{fenaux2025hammer,
  author = {Lucas Fenaux and Zheng Wang and Jacob Yan and Nathan Chung and Florian Kerschbaum},
  title = {{Hammer and Anvil: A Principled Defense Against Backdoors in Federated Learning}},
  year = {2025},
  eprint = {2509.08089},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.08089},
}
Figure