A Wolf in Sheep's Clothing: Query-Free Evasion Attacks Against Machine Learning-Based Malware Detectors with Generative Adversarial Networks

Daniel Gibert, Jordi Planes, Quan Le, Giulio Zizzo

TL;DR

Researchers have developed a novel GAN-based framework that generates adversarial malware capable of evading machine learning detectors without ever "pinging" the target system. By learning to mimic the feature distributions of benign software, this query-free approach achieves evasion rates comparable to state-of-the-art attacks while remaining completely invisible to the detector's logs.

What Problem Does This Paper Address?

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, which attackers rarely have. 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.

Methods

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:

  1. The Generator: Takes a malicious feature vector and a bit of random noise, then transforms it to look like a "benign" feature vector.
  2. The Critic: Learns to distinguish between real benign features and the "fake" ones produced by the generator.

The "secret sauce" is how they move from abstract math (feature vectors) to actual, working files (End-to-End attack):

  • 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). They introduced a "gap" parameter to allow for slight errors, which prevents the files from bloating to unusable 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.

Datasets

The study utilizes two primary datasets:

  • BODMAS: A large, recent dataset containing 57,293 malware samples and 77,142 benign Windows PE files.
  • EMBER: Used to train the "victim" detectors. This is a standard industry benchmark for static malware detection.

Key Insights and Ideas

  • Benignity as a Target: 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.
  • The Evasion-Size Trade-off: Matching a benign distribution perfectly can result in a file growing by 20,000%. By introducing a small "gap" or error margin in the ILP solver, the authors found a "sweet spot" (gap = 0.001) where evasion remains high but file size increase is manageable.
  • Feature Stacking: The paper demonstrates that while modifying one feature type (like just APIs) helps, "stacking" modifications (Bytes + APIs + Strings) creates a much more potent adversarial example that can bypass complex, multimodal detectors.

Key Results

The GAN-based approach proved highly effective against several state-of-the-art detectors:

  • Unimodal Evasion: Against a detector looking only at byte histograms, the attack reduced detection accuracy from 90.7% to near 0%.
  • 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 with Query-based Attacks: The framework performed on par with MalGAN, despite MalGAN having the "unfair" advantage of querying the detector to learn its weaknesses.

Limitations and Future Work

While powerful, the method has its hurdles:

  • Functionality Preservation: While the authors use LIEF to ensure files still run, complex malware with heavy obfuscation or integrity checks might "break" when new bytes or sections are appended.
  • Stealth of the Modification: The paper focuses on evading ML detectors, but a human analyst or a simple script might notice a massive "overlay" of random bytes at the end of a file.
  • Feature Scope: The current work focuses on three feature types. Future work could expand this to include PE header metadata, opcode n-grams, or control flow graphs to evade even more sophisticated "deep" detectors.

The authors have open-sourced their code 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 antimalware engines in VirusTotal.
BibTeX
@inproceedings{gibert2023wolf,
  author = {Daniel Gibert and Jordi Planes and Quan Le and Giulio Zizzo},
  title = {{A Wolf in Sheep's Clothing: 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},
}

Loading related content...

Figure