PBP: Post-training Backdoor Purification for Malware Classifiers

Dung Thuy Nguyen, Ngoc N. Tran, Taylor T. Johnson, Kevin Leach

TL;DR

Deep learning malware classifiers are highly vulnerable to backdoor poisoning attacks, where an adversary embeds a hidden trigger to make malicious files look benign. This paper introduces PBP (Post-training Backdoor Purification), a defense mechanism that eliminates these backdoors using as little as 1% of clean data without any prior knowledge of the attack strategy. PBP successfully drops the attack success rate from 100% to nearly 0% while preserving the model's accuracy on clean files.

What Problem Does This Paper Address?

Deep Neural Networks (DNNs) have revolutionized malware detection, but they suffer from a critical security flaw: backdoor attacks. An attacker can subtly contaminate a public repository by injecting malware samples stamped with a specific hidden trigger (or watermark). The resulting trained model behaves perfectly on normal files but completely misses any malware containing the trigger, classifying it as safe "goodware."

Most existing defenses try to detect and filter out poisoned samples during the training phase, or they require full access to the training dataset to retrain the model from scratch. However, in realistic scenarios like Machine Learning-as-a-Service (MLaaS), users purchase or download pre-trained models and only have access to a tiny fraction of clean data. The authors address this gap by developing a post-training purification method that strips out backdoors without requiring full retraining or knowledge of the trigger's design.

Methods

PBP operates via a two-phase strategy:

  1. Neuron Mask Generation: Backdoor attacks inherently distort the internal activation distributions of a network. To find the compromised neurons, the authors initialize a clean "noise model" from scratch and train it to align its internal activation patterns (tracked via Batch Normalization statistics) with the backdoored model. By analyzing the gradient trace during this alignment, they exploit the sparse nature of gradients to pinpoint the top-$K$ coordinates (neurons) driving the backdoor behavior, creating a precise "neuron mask."
  2. Activation-shift Fine-tuning: First, the backdoored model's weights are perturbed with a small amount of Gaussian noise to disrupt the backdoor shortcuts. Then, the model is fine-tuned on clean data using an alternating optimization scheme. On odd iterations, PBP reverses the gradient sign for the masked backdoor neurons—effectively forcing them to "unlearn" the malicious trigger—while updating normal neurons conventionally to preserve clean data accuracy.

Datasets

The authors evaluated PBP on two primary security datasets and one computer vision dataset to demonstrate broader applicability:

  • EMBER-v1: A dataset consisting of 2,351-dimensional feature vectors extracted from 1.1 million Windows Portable Executable (PE) files. It was used to test non-family-targeted "Explanation-guided" backdoor attacks.
  • AndroZoo: A large-scale collection of Android applications with features extracted via the Drebin framework. This was used to evaluate family-targeted "Jigsaw Puzzle" attacks.
  • CIFAR-10: A standard image classification dataset used to verify that PBP generalizes well to the Computer Vision (CV) domain.

The distinct nature of family-targeted vs. non-family-targeted attacks on these datasets is visualized using t-SNE representations in the paper:

Fig. 1: t-SNE [47] representations of family-targeted and non- family-targeted backdoor attacks.

Key Insights and Ideas

  • Activation Drift as a Footprint: Backdoor triggers cause a distinct shift in neuron activation distributions. Instead of trying to guess what the trigger looks like in the input space, defenders can look internally at how neurons react to identify the backdoor's footprint.
  • Leveraging Gradient Sparsity: During the alignment phase, only a tiny fraction of neurons actually drive the backdoor reconstruction. This sparsity makes it possible to isolate backdoor neurons without disrupting the entire network.
  • Unlearning via Gradient Reversal: Simply pruning or freezing backdoor neurons can severely degrade a model's utility. Actively reversing the gradient updates for masked neurons forces the network to safely unlearn the backdoor mapping while keeping benign pathways intact.

Key Results

  • Exceptional Backdoor Mitigation: On the AndroZoo dataset, PBP reduced the Attack Success Rate (ASR) from 100% to nearly 0%. On the highly stealthy EMBER dataset, it reduced the ASR to roughly 15%, vastly outperforming state-of-the-art fine-tuning baselines (like Vanilla FT, LP, and FST) which completely failed to mitigate the attack.
  • High Data Efficiency: PBP achieved these results using only 1% of the clean training data (e.g., just 923 samples for AndroZoo).
  • Architectural Stability: The defense proved highly stable across varying Multi-Layer Perceptron (MLP) model sizes (ranging from 22M to 120M parameters) and successfully generalized to Convolutional Neural Networks (CNNs) like ResNet-18 and VGG19.

Limitations and Future Work

  • Clean Accuracy Trade-off: Purifying the model can slightly lower its performance on clean data (Clean Data Accuracy) because the defense expands the decision boundary to isolate malware. The authors noted that this can be partially mitigated by continuing standard cross-entropy training for a few extra epochs post-purification.
  • Data Cleanliness Assumption: PBP assumes that the small fine-tuning dataset provided by the defender is completely pristine. The authors note that exploring how the defense handles potentially contaminated fine-tuning data remains an open direction for future work.

Summary updated

BibTeX
@inproceedings{nguyen2025pbp,
  author = {Dung Thuy Nguyen and Ngoc N. Tran and Taylor T. Johnson and Kevin Leach},
  title = {{PBP: Post-training Backdoor Purification for Malware Classifiers}},
  booktitle = {Ndss},
  year = {2025},
}
Figure