Certified Adversarial Robustness of Machine Learning-based Malware Detectors via (De)Randomized Smoothing

Daniel Gibert, Luca Demetrio, Giulio Zizzo, Quan Le, Jordi Planes, Battista Biggio · DOI

Abstract

Deep learning-based malware detection systems are vulnerable to adversarial EXEmples - carefully-crafted malicious programs that evade detection with minimal perturbation. As such, the community is dedicating effort to develop mechanisms to defend against adversarial EXEmples. However, current randomized smoothing-based defenses are still vulnerable to attacks that inject blocks of adversarial content. In this paper, we introduce a certifiable defense against patch attacks that guarantees, for a given executable and an adversarial patch size, no adversarial EXEmple exist. Our method is inspired by (de)randomized smoothing which provides deterministic robustness certificates. During training, a base classifier is trained using subsets of continguous bytes. At inference time, our defense splits the executable into non-overlapping chunks, classifies each chunk independently, and computes the final prediction through majority voting to minimize the influence of injected content. Furthermore, we introduce a preprocessing step that fixes the size of the sections and headers to a multiple of the chunk size. As a consequence, the injected content is confined to an integer number of chunks without tampering the other chunks containing the real bytes of the input examples, allowing us to extend our certified robustness guarantees to content insertion attacks. We perform an extensive ablation study, by comparing our defense with randomized smoothing-based defenses against a plethora of content manipulation attacks and neural network architectures. Results show that our method exhibits unmatched robustness against strong content-insertion attacks, outperforming randomized smoothing-based defenses in the literature.

Introduction

Deep learning has revolutionized malware detection by enabling models to analyze raw bytes directly, bypassing the need for manual feature engineering. However, these models remain vulnerable to Adversarial EXEmples: malicious files modified with small, non-functional perturbations that trigger misclassification as benign. A particularly potent class of attacks involves content insertion, where adversarial payloads are injected into new sections or appended to the file. These attacks not only introduce malicious bytes but also shift the alignment of the entire file, often breaking traditional defenses. This paper introduces Chunk-based Smoothing (CS), a framework that provides deterministic mathematical guarantees—certificates—that no attack of a certain size can succeed.

Methodology: Chunk-based Smoothing (CS)

The CS framework localizes the influence of adversarial perturbations by processing files as a collection of independent units. The pipeline consists of three main stages: training on contiguous byte chunks, a specialized preprocessing step, and a majority-vote inference mechanism.

Overview of the Chunk-based Smoothing (CS) pipeline.

At runtime, the file is split into non-overlapping chunks, each classified independently by a base classifier. The final verdict is determined by a majority vote. Because the influence of an adversarial patch is restricted to the specific chunks it occupies, the system can mathematically guarantee robustness if the "malicious" vote margin exceeds the number of chunks an attacker can feasibly corrupt.

Preprocessing and Alignment

The "secret sauce" of the CS defense is its handling of alignment-shifting injection attacks. Standard smoothing techniques are often sensitive to the displacement caused by new code. To counter this, the authors implement a PREPROCESS step that pads file headers and sections with zero-bytes, ensuring every section starts at a multiple of the chunk size.

Preprocessing mechanism ensuring adversarial payloads are isolated within specific chunks.

As shown in the figure above, this alignment ensures that if an attacker injects code into one section, it does not "displace" the bytes in other sections into different chunks. This keeps the model's view of the original code stable and confines the adversarial influence to a predictable number of chunks.

Experimental Evaluation

The study utilizes the BODMAS dataset, focusing on a subset of approximately 76,000 Windows PE files (39,000 benign and 37,000 malicious) under 1MB. The method was tested across three popular architectures: MalConv, MalConvGCT, and AvastConv.

Key Results

  • Unmatched Robustness: Against state-of-the-art attacks like GAMMA (injecting benign sections) and Shift (moving headers), CS-based models maintained nearly their original accuracy (often >90%), while undefended models saw accuracy plummet to 20-30%.
  • Certified Accuracy: For a chunk size of 512 bytes, the models could certify robustness against patches up to 10% of the file size with ~94% accuracy.
  • Efficiency: CS is significantly faster than probabilistic randomized smoothing. For example, CS-MalConv takes approximately 0.05 seconds per sample on a CPU, compared to ~0.28 seconds for randomized versions.

Conclusion

Chunk-based Smoothing provides a robust, deterministic defense against content-injection attacks in malware detection. While the defense is subject to the "50% Rule"—where an adversarial payload larger than the original file can overwhelm the majority vote—it represents a significant step forward in certifiable security. Future work will explore techniques to identify and prune adversarial chunks and scaling the method to handle larger, multi-gigabyte executables.

Summary updated

BibTeX
@article{gibert2026certified,
  author = {Daniel Gibert and Luca Demetrio and Giulio Zizzo and Quan Le and Jordi Planes and Battista Biggio},
  title = {{Certified Adversarial Robustness of Machine Learning-based Malware Detectors via (De)Randomized Smoothing}},
  journal = {ACM Trans. Priv. Secur.},
  year = {2026},
  doi = {10.1145/3827613},
}
Figure