Functionality-Preserving Black-Box Optimization of Adversarial Windows Malware

Luca Demetrio, Battista Biggio, Giovanni Lagorio, Fabio Roli, Alessandro Armando

TL;DR

This paper introduces GAMMA, a novel black-box attack framework that efficiently crafts adversarial Windows malware samples. By injecting benign content into executable files and optimizing for both evasion and minimal payload size, GAMMA bypasses machine learning malware detectors with fewer queries and smaller modifications than previous methods, even fooling over 12 commercial antivirus engines.

What Problem Does This Paper Address?

Machine learning (ML) models are increasingly used for malware detection, but they are susceptible to adversarial examples – specially crafted inputs designed to fool the model. Existing black-box attacks (where the attacker only queries the model without knowing its internal workings) against Windows malware detectors face two major hurdles:

  1. Query Inefficiency: They require many queries to the target model, making them slow and resource-intensive.
  2. Functionality Preservation: They often need to run the modified malware in a sandbox at each step to ensure it still performs its malicious actions. This is computationally expensive and can be complicated by malware that detects sandboxed environments.

Furthermore, many attacks significantly alter the malware's structure, making the modified samples easily detectable by simpler, non-ML-based checks (like file size or section count). This paper aims to overcome these limitations by developing attacks that are both efficient and stealthy.

Methods

The core of the paper is the GAMMA (Genetic Adversarial Machine learning Malware Attack) framework. It tackles the problem by:

  • Functionality-Preserving Manipulations: Instead of random modifications, GAMMA injects content extracted from benign Windows executable files. This content is placed in ways that exploit ambiguities in the Portable Executable (PE) file format, such as padding at the end of the file or within newly created sections. Crucially, these injections do not alter the malware's execution trace, thus preserving its functionality without the need for constant sandboxing.
  • Black-Box Optimization: GAMMA uses a genetic algorithm to search for the optimal set of manipulations. This algorithm iteratively generates and evaluates potential adversarial samples.
  • Constrained Minimization Problem: The attack is formalized as an optimization problem. The goal is to minimize a function that combines two conflicting objectives:
  • The probability of the manipulated malware being classified as benign by the target detector (i.e., f(x + s)).
  • A penalty term (λ * C(s)) that penalizes the size of the injected benign payload. This formulation allows for optimizing the trade-off between evasion effectiveness and the stealthiness of the adversarial sample (smaller payload size). The hyperparameter λ controls this trade-off.

  • Query Budget: The optimization process is limited by a query budget T, ensuring the attack remains computationally feasible.

  • Hard-Label Adaptation: The framework can also handle detectors that only output a binary classification (malware/benign) rather than a confidence score, by adapting the objective function.

Datasets

  • EMBER dataset: Used for training the GBDT and MalConv malware detectors.
  • VirusTotal: Used to gather malware samples for evaluation and to test against commercial antivirus engines.
  • GitHub: Used to collect benign executable samples for the experiments.
  • Goodware dataset: A custom dataset of benign programs collected from GitHub, used to extract benign content for injection.

No new benchmarks were introduced; the paper evaluates against existing, well-known detectors.

Key Insights and Ideas

  • Benign Content is Key: Injecting content from benign files, rather than random bytes, is surprisingly effective. This suggests that ML models might learn to associate certain patterns or structures found in benign files with non-maliciousness, and exploiting this can lead to evasion.
  • Functionality Preservation Without Sandboxing: The ability to preserve functionality by exploiting PE format ambiguities, without needing to run the malware in a sandbox at every optimization step, is a significant efficiency gain.
  • Trade-off Optimization is Crucial: Formalizing the attack as a constrained optimization problem that balances evasion with payload size is essential for creating stealthy adversarial samples that are less likely to be caught by simpler detection methods.
  • Transferability is High: The attacks, optimized against specific detectors, show a remarkable ability to transfer and evade a large number of commercial antivirus engines, highlighting a broader vulnerability in current detection systems.
  • Packing is Not a Silver Bullet: Using packers like UPX to obfuscate malware can sometimes backfire, as it might be learned as a malicious trait by detectors trained on large datasets of packed malware.

Key Results

  • Efficient Evasion: GAMMA can bypass two popular static Windows malware detectors (GBDT and MalConv) with only a few queries and small injected payloads.
  • Soft vs. Hard Labels: The attacks are effective even when the target model only provides predicted labels, not confidence scores.
  • Commercial Evasion: The adversarial samples generated by GAMMA can evade, on average, more than 12 commercial antivirus engines from VirusTotal.
  • Section Injection vs. Padding: Section injection attacks were found to be more effective than padding attacks, likely because they perturb more features by adding a new section entry.
  • Time Efficiency: The paper notes that their method is significantly faster than previous approaches that require sandboxing at each iteration. For example, their genetic algorithm performs 1,400 queries in the same time that other methods might take for 100 queries.

Limitations and Future Work

  • Limitations:
    • The current work focuses on static analysis-based detectors. The effectiveness against dynamic analysis-based detectors is not explored.
  • The paper acknowledges that potential countermeasures (e.g., robust features, adversarial retraining) were not investigated.
  • The transferability to other commercial detectors could potentially be improved with attacks specifically optimized against them.
  • Future Work:
    • Investigate countermeasures and defense strategies against these types of attacks.
  • Extend the attack framework to include a wider range of functionality-preserving manipulations.
  • Develop attacks that can also modify the dynamic execution of malware, targeting detectors that rely on dynamic analysis.
  • Explore techniques for detecting correlated queries from a single source, which might indicate a black-box attack.

Summary updated

BibTeX
@article{demetrio2021functionality,
  author = {Luca Demetrio and Battista Biggio and Giovanni Lagorio and Fabio Roli and Alessandro Armando},
  title = {{Functionality-Preserving Black-Box Optimization of Adversarial Windows Malware}},
  journal = {IEEE Trans. Inf. Forensics Secur.},
  year = {2021},
  url = {https://openreview.net/forum?id=VqqJLoydiY},
}
Figure