A Robust Defense against Adversarial Attacks on Deep Learning-based Malware Detectors via (De)Randomized Smoothing

Daniel Gibert, Giulio Zizzo, Quan Le, Jordi Planes

Abstract

Deep learning-based malware detectors are highly susceptible to adversarial evasion attacks, where subtle modifications to a binary file can bypass detection. We propose a defense mechanism inspired by (de)randomized smoothing that utilizes chunk-based ablation. By training a base classifier on small, contiguous subsets of bytes and employing a majority voting scheme at inference, we significantly enhance the robustness of detectors like MalConv. Our evaluation on the BODMAS dataset demonstrates that our approach maintains high clean accuracy while providing superior resilience against state-of-the-art evasion techniques, outperforming standard non-smoothed classifiers by a significant margin.

Introduction and Problem Statement

End-to-end deep learning models, such as MalConv, have revolutionized malware detection by learning directly from raw binary data. However, these models are notoriously vulnerable to evasion attacks. Malware authors can perform functionality-preserving manipulations—such as injecting malicious payloads into "slack space," appending overlays, or creating new sections within a Portable Executable (PE) file—to manipulate the model's output without altering the file's behavior.

PE file structure and common adversarial manipulation points.

Traditional defenses like Gaussian noise, common in computer vision, are unsuitable for the binary domain because flipping random bytes often corrupts the executable. There is a critical need for a defense that preserves file integrity while mitigating the impact of localized adversarial injections.

Methodology: Chunk-based Ablation Smoothing

We introduce a chunk-based ablation smoothing scheme designed to limit the influence of localized adversarial content. The core principle is to prevent the model from processing the entire file as a single entity, thereby isolating potential malicious payloads.

Training and Inference

  1. Training: A base classifier is trained on small, contiguous "chunks" of the file (e.g., 5% of the total size). This forces the model to identify malicious patterns distributed throughout the binary rather than relying on specific header offsets that are easily manipulated.
  2. Inference: At test time, $L$ different chunks are extracted from the input file. These chunks are classified independently by the base classifier.
  3. Consensus: The final prediction is determined by a majority vote among the $L$ chunk-level predictions.
The proposed chunk-based ablation smoothing pipeline.

Selection Strategies

We evaluate two strategies for determining chunk locations:

  • Randomized Chunk-based Ablation (RCA): Chunks are sampled from random locations within the file.
  • Structural Chunk-based Ablation (SCA): Chunks are sampled sequentially from the start to the end of the file.

Experimental Evaluation

The proposed models, RCA-MalConv and SCA-MalConv, were evaluated using the BODMAS dataset, which contains 57,293 malware samples and 77,142 benign files. The models were tested against various evasion techniques, including "Shift" attacks and "GAMMA" attacks.

Key Results

  • Robustness against Attacks: While a standard non-smoothed MalConv (NS-MalConv) saw its accuracy plummet to 40.8% under a "Shift" attack and as low as 14% under extreme evasion scenarios, our chunk-based models maintained approximately 95-97% accuracy.
  • Clean Performance: The defense does not compromise standard detection capabilities, maintaining high accuracy (~98%) on un-manipulated files.
  • Efficiency: Training time per epoch was reduced by approximately 80% because the model only processes a small fraction of the total bytes during each training step.

Conclusion

Chunk-based ablation smoothing provides a practical and effective defense against adversarial malware examples. By leveraging the consensus of localized predictions, the system becomes resilient to the injection-based attacks common in the malware domain. Future work will explore more granular labeling to handle benign library code within malicious files and the potential for automated adversarial content identification and removal.

Summary updated

Abstract

Deep learning-based malware detectors have been shown to be susceptible to adversarial malware examples, i.e. malware examples that have been deliberately manipulated in order to avoid detection. In light of the vulnerability of deep learning detectors to subtle input file modifications, we propose a practical defense against adversarial malware examples inspired by (de)randomized smoothing. In this work, we reduce the chances of sampling adversarial content injected by malware authors by selecting correlated subsets of bytes, rather than using Gaussian noise to randomize inputs like in the Computer Vision (CV) domain. During training, our ablation-based smoothing scheme trains a base classifier to make classifications on a subset of contiguous bytes or chunk of bytes. At test time, a large number of chunks are then classified by a base classifier and the consensus among these classifications is then reported as the final prediction. We propose two strategies to determine the location of the chunks used for classification: (1) randomly selecting the locations of the chunks and (2) selecting contiguous adjacent chunks. To showcase the effectiveness of our approach, we have trained two classifiers with our chunk-based ablation schemes on the BODMAS dataset. Our findings reveal that the chunk-based smoothing classifiers exhibit greater resilience against adversarial malware examples generated with state-of-the-are evasion attacks, outperforming a non-smoothed classifier and a randomized smoothing-based classifier by a great margin.
BibTeX
@inproceedings{gibert2024robust,
  author = {Daniel Gibert and Giulio Zizzo and Quan Le and Jordi Planes},
  title = {{A Robust Defense against Adversarial Attacks on Deep Learning-based Malware Detectors via (De)Randomized Smoothing}},
  booktitle = {IEEE Access},
  year = {2024},
  url = {https://openreview.net/forum?id=mgGtyPK3Os},
}

Loading related content...

Figure