EGAN: Evolutional GAN for Ransomware Evasion

Adversarial ML Ransomware GAN

The 20-Second Summary

Adversarial malware research needs evasive samples that still work, but most mutation pipelines either break functionality or require unrealistic white-box access to commercial detectors. EGAN combines an evolution strategy with a GAN to search for mutation sequences that preserve ransomware behavior while evading real-world detection. In the reported evaluation, the generated variants evade a majority of VirusTotal engines while remaining functional. (IEEE LCN 2023.)


The Problem

Machine learning-based malware detectors are increasingly deployed in commercial antivirus products. They analyze static features - byte sequences, PE header fields, import tables, section entropy - to classify files as malicious or benign. These detectors are effective against known malware families, but they share a fundamental vulnerability: they are susceptible to adversarial examples.

In the image domain, adversarial examples are perturbed pixels that fool a classifier. In the malware domain, the equivalent is a modified binary that fools a detector. But malware adversarial examples are much harder to craft than image adversarial examples, for one critical reason: the modified binary must still execute correctly.

You can’t just add random noise to a PE file. Change the wrong byte and the program crashes. Modify an import table entry and the loader fails. Corrupt a section header and Windows refuses to run it. The attacker needs mutations that:

  1. Change the features the detector relies on
  2. Preserve the binary’s execution semantics
  3. Maintain the malicious payload’s functionality (encryption, exfiltration, etc.)

    This three-way constraint makes adversarial malware generation a hard optimization problem - and one that defenders need to understand to build robust systems.


Why Existing Approaches Fall Short

Approach Limitation
Random mutation Low success rate; most mutations break functionality
Gradient-based attacks Require white-box access to the detector’s model; don’t apply to commercial AV
Reinforcement learning (e.g., gym-malware) Learns one mutation policy; slow to adapt to new detectors
Standard GAN Generates feature vectors, not executable binaries; functionality not guaranteed
Manual obfuscation Labor-intensive; doesn’t scale; signature-specific

The core issue: generating adversarial malware that actually works requires jointly optimizing evasion and functionality, and most existing methods only address one side of this equation.


Our Approach: EGAN

EGAN (Evolutional GAN) combines two optimization paradigms to navigate the constrained search space of functional, evasive malware variants.

Architecture Overview

The framework has two coupled components:

1. The GAN Component learns the distribution of feature modifications that are likely to evade detection. The generator produces candidate mutation parameters, and the discriminator (trained on detector feedback) guides the generator toward more evasive modifications.

2. The Evolution Strategy explores the space of mutation sequences - ordered chains of binary transformations applied to the original ransomware sample. Evolution provides the exploration; the GAN provides the exploitation.

The Mutation Process

We operate on functionality-preserving mutations: transformations that modify the binary without changing its runtime behavior. In practice this includes operations like section appending (shifting feature distributions with benign content), import table padding (adding unused imports), packer/unpacker chaining, overlay manipulation, and entry-point obfuscation (routing execution through added stubs).

Each mutation is a discrete operation. The challenge is finding the right sequence and parameterization of mutations that collectively push the binary past the detector’s decision boundary.

The Optimization Loop

1. Start with original ransomware sample S
2. Evolution strategy proposes a population of mutation sequences
3. Each sequence is applied to S → produces variant S'
4. GAN evaluates S' features and predicts evasion likelihood
5. Variants are submitted to detectors for ground-truth feedback
6. Fitness = f(evasion_rate, functionality_preserved)
7. Top-performing sequences survive; GAN updates on new examples
8. Repeat until convergence

The evolution strategy handles the combinatorial nature of mutation ordering, while the GAN accelerates convergence by learning which feature-space directions are most effective for evasion.

Functionality Verification

A critical step that many adversarial malware papers skip: we verify that generated variants actually execute their intended payload. Each candidate variant is run in a sandboxed environment to confirm that ransomware behavior (file encryption, ransom note generation) is preserved. Variants that crash or lose functionality are assigned zero fitness regardless of their evasion score.


How We Evaluated

Malware samples: Ransomware families representing diverse encryption and evasion strategies.

Detection targets: Commercial antivirus engines accessed via VirusTotal, representing the real-world detection landscape. This is a black-box evaluation - we have no access to the internal models, training data, or decision logic of any engine.

Metrics:

We measure evasion rate (fraction of AV engines that miss the variant), functionality preservation (payload executes correctly in a sandbox), and mutation efficiency (how many generations are needed to find strong variants).

Baselines: We compare against random mutation, single-step GAN generation, and reinforcement learning-based mutation strategies.


Key Results

EGAN demonstrated significant evasion improvements over the original ransomware samples:

Where original ransomware is detected by most VirusTotal engines, EGAN-generated variants evade a majority of those same engines while still executing their ransomware payloads in sandbox tests. The hybrid design also converges faster than evolution-only or GAN-only baselines, and the results hold across multiple ransomware families (suggesting the approach is not tied to a single malware type).

The implication is sobering: a moderately resourced attacker can systematically generate ransomware variants that evade most commercial detection using a largely automated pipeline.


Discussion

This is an offensive security paper, but its value is defensive: it demonstrates that automated, black-box evasion is practical against static-feature-heavy detectors. The core lesson is that if a detector leans on brittle byte/header features, an attacker can change those features without changing behavior; query access to a service like VirusTotal can be enough to guide the search; and functionality preservation is measurable (and should be measured) via sandbox checks. For defenders, the natural counterweight is stronger behavioral detection and robustness evaluation—EGAN-style pipelines can serve as stress tests.


Limitations and Next Steps

Current Limitations:

The evaluation focuses on ransomware, and other malware families may require different mutation operators. Sandbox-based functionality checks are also imperfect (some behaviors may not trigger under automated analysis), and the evolution loop depends on repeated VirusTotal queries (which are rate-limited). Finally, the results are point-in-time: AV engines evolve, so evasion longevity remains an open question.

Future Work:

Next steps include expanding to broader malware families and testing transferability, designing defensive countermeasures informed by which features are robust to these mutations, and evaluating combined attacks against behavioral systems. A useful community output would be a responsible red-team benchmark for detector robustness.


Reference