Query-Free Evasion Attacks Against Machine Learning-Based Malware Detectors with Generative Adversarial Networks

Daniel Gibert, Jordi Planes, Quan Le, Giulio Zizzo

Abstract

Malware detectors based on machine learning (ML) have been shown to be susceptible to adversarial malware examples. However, current methods to generate adversarial malware examples still have their limits. They either rely on detailed model information (gradient-based attacks), or on detailed outputs of the model - such as class probabilities (score-based attacks), neither of which are available in real-world scenarios. Alternatively, adversarial examples might be crafted using only the label assigned by the detector (label-based attack) to train a substitute network or an agent using reinforcement learning. Nonetheless, label-based attacks might require querying a black-box system from a small number to thousands of times, depending on the approach, which might not be feasible against malware detectors. This work presents a novel query-free approach to craft adversarial malware examples to evade ML-based malware detectors. To this end, we have devised a GAN-based framework to generate adversarial malware examples that look similar to benign executables in the feature space. To demonstrate the suitability of our approach we have applied the GAN-based attack to three common types of features usually employed by static ML-based malware detectors: (1) Byte histogram features, (2) API-based features, and (3) String-based features. Results show that our model-agnostic approach performs on par with MalGAN, while generating more realistic adversarial malware examples without requiring any query to the malware detectors. Furthermore, we have tested the generated adversarial examples against state-of-the-art multimodal and deep learning malware detectors, showing a decrease in detection performance, as well as a decrease in the average number of detections by the anti-malware engines in VirusTotal.

Introduction

Machine learning (ML) has become the backbone of "Next-Generation Antivirus" (NGAV) tools because it can spot patterns in new, unseen malware. However, these models are vulnerable to evasion attacks—subtle modifications to a malicious file that trick a classifier into labeling it "benign." Most existing attacks have a major catch: they are "noisy." White-box attacks require full access to the model's code, while black-box attacks (like MalGAN) rely on querying the detector thousands of times to see how it reacts, which triggers alarms in modern security environments.

This paper tackles the challenge of creating query-free attacks: generating evasive malware based solely on the knowledge of what benign software looks like, without ever interacting with the target detector during the crafting process. The core philosophy is that an attacker doesn't need to know how a detector works if they can make their malware statistically indistinguishable from "goodware." By shifting the focus from "fooling the model" to "mimicking the population," the attack becomes model-agnostic.

Methodology

The authors propose a framework based on Generative Adversarial Networks (GANs), specifically a Conditional Wasserstein GAN with Gradient Penalty (WGAN-GP). The system consists of two neural networks: the Generator, which transforms malicious feature vectors to look like benign ones, and the Critic, which learns to distinguish between real benign features and the "fake" ones produced by the generator.

The GAN-based framework architecture for generating adversarial malware features by mimicking benign software distributions.

To move from abstract feature vectors to actual, working files (an End-to-End attack), the researchers employed several techniques:

  • Byte Unigrams: To match a benign byte frequency distribution, they use Integer Linear Programming (ILP) to calculate exactly how many of which bytes to append to the end of the file (overlay). A "gap" parameter (optimally 0.001) was introduced to balance evasion success with manageable file sizes.
  • API & Strings: They use the LIEF library to inject new, benign-looking API imports and strings into the file's headers and new sections without breaking the original malicious functionality.

Key Results

The GAN-based approach proved highly effective against several state-of-the-art detectors trained on standard industry benchmarks like EMBER.

Comparison of detection rates across different attack methods for byte histogram features, showing the proposed Query-free GAN achieving near-zero detection.

Key findings include:

  • Unimodal Evasion: Against a detector looking only at byte histograms, the attack reduced detection accuracy from 90.7% to 0.37%, outperforming the query-based MalGAN (5.72%).
  • Multimodal Transferability: The attack successfully fooled complex models like EMBER v1 (dropping detection from 97.02% to 28.48%) and MalConv, a deep learning model that "reads" raw bytes.
  • Real-world Impact: When uploaded to VirusTotal, the adversarial samples saw a significant drop in the number of engines flagging them compared to the original malicious files.
  • Competitive Performance: The framework performed on par with MalGAN, despite MalGAN having the advantage of querying the detector to learn its weaknesses. Furthermore, the query-free approach avoids the massive bloat in imported functions often seen in MalGAN-generated samples.

Discussion and Conclusion

While powerful, the method has its hurdles. Functionality preservation remains a challenge for complex malware with heavy obfuscation or integrity checks. Additionally, while the attack evades ML detectors, a human analyst might notice a massive "overlay" of random bytes at the end of a file. Future work could expand the feature scope to include PE header metadata or control flow graphs to evade even more sophisticated "deep" detectors. By open-sourcing their code, the authors aim to encourage further research into making ML-based security more robust against these silent, generative threats.

Summary updated

Abstract

Malware detectors based on machine learning (ML) have been shown to be susceptible to adversarial malware examples. However, current methods to generate adversarial malware examples still have their limits. They either rely on detailed model information (gradient-based attacks), or on detailed outputs of the model - such as class probabilities (score-based attacks), neither of which are available in real-world scenarios. Alternatively, adversarial examples might be crafted using only the label assigned by the detector (label-based attack) to train a substitute network or an agent using reinforcement learning. Nonetheless, label-based attacks might require querying a black-box system from a small number to thousands of times, depending on the approach, which might not be feasible against malware detectors. This work presents a novel query-free approach to craft adversarial malware examples to evade ML-based malware detectors. To this end, we have devised a GAN-based framework to generate adversarial malware examples that look similar to benign executables in the feature space. To demonstrate the suitability of our approach we have applied the GAN-based attack to three common types of features usually employed by static ML-based malware detectors: (1) Byte histogram features, (2) API-based features, and (3) String-based features. Results show that our model-agnostic approach performs on par with MalGAN, while generating more realistic adversarial malware examples without requiring any query to the malware detectors. Furthermore, we have tested the generated adversarial examples against state-of-the-art multimodal and deep learning malware detectors, showing a decrease in detection performance, as well as a decrease in the average number of detections by the anti-malware engines in VirusTotal.
BibTeX
@inproceedings{gibert2023query,
  author = {Daniel Gibert and Jordi Planes and Quan Le and Giulio Zizzo},
  title = {{Query-Free Evasion Attacks Against Machine Learning-Based Malware Detectors with Generative Adversarial Networks}},
  booktitle = {EuroS\&P Workshops},
  year = {2023},
  url = {https://openreview.net/forum?id=9TKA8z6UlQ},
}
Figure