Learn2Evade: Learning-Based Generative Model for Evading PDF Malware Classifiers

Ho Bae, Younghan Lee, Yohan Kim, Uiwon Hwang, Sungroh Yoon, Yunheung PaekIEEE Trans. Artif. Intell 2021 · DOI

Introduction

Machine learning (ML) has become a cornerstone of malware detection, particularly for complex file formats like the Portable Document Format (PDF). However, these classifiers are vulnerable to adversarial examples (AEs)—malicious files slightly modified to appear benign.

Existing evasion techniques, such as EvadeML, rely heavily on random mutation and genetic programming. These methods face two major hurdles: the "crash" problem, where random structural changes break the embedded exploit, and computational inefficiency, often requiring thousands of queries to a sandbox or classifier. Learn2Evade introduces PDF-GAN, a generative adversarial network designed to learn the intrinsic structure of PDFs and generate functional, evasive variants with minimal trial and error.

Methodology

The core of the framework is PDF-GAN, which is tailored for discrete tree structures. The system follows a multi-stage pipeline encompassing pre-processing, training, and verification.

Overview of the Learn2Evade pipeline, including pre-processing, PDF-GAN training, and evasion verification.

Feature Extraction and Representation

PDFs are parsed into a tree representation using tools like PDFrw. Features are defined as paths from the root to leaf nodes (e.g., /Root/Pages/Kids/Type). This mapping allows the model to manipulate the document's internal hierarchy while maintaining structural integrity.

PDF internal structure and its corresponding tree representation used for feature extraction.

Feature Selection by Pooling

To handle the imbalance between benign and malicious features, the authors categorize features into four "pools" based on their frequency in benign vs. malicious sets. A balanced set of 297 features is selected for training the model.

PDF-GAN Architecture

  • The Generator ($G$): Instead of random noise, $G$ takes a malicious PDF as input and learns a stochastic mapping to a new feature representation that maintains "maliciousness" while appearing benign.
  • Dual Discriminators: A standard GAN discriminator ($D$) ensures the generated feature set looks like a realistic PDF structure. Simultaneously, a surrogate classifier ($C^s$) mimics the target malware detector to guide the generator toward the detector's specific "blind spots."
  • PDF Repacker: Once the GAN suggests a mutated feature set, a repacker applies these changes (insert, replace, or delete) to the original file to create a functional PDF.

Datasets

The authors utilized several key data sources to train and validate the model:

  • Contagio Dataset: 9,109 benign and 11,105 malicious PDF files.
  • VirusTotal: 10,673 recent PDF malware samples to test against modern commercial engines.
  • CVE-Specific Samples: 14 unique seeds representing specific vulnerabilities (e.g., JavaScript-based, ActionScript-based) to ensure cross-vector effectiveness.

Key Insights

  • Robust vs. Non-robust Features: By identifying and avoiding the mutation of "robust" features crucial for the exploit to work, PDF-GAN solves the "crash" problem that plagues random mutation methods.
  • Minimal Perturbation: The model discovered that evading a classifier usually requires very few changes—often fewer than 12 feature mutations.
  • Surrogate Transferability: Adversarial examples generated against a small surrogate model effectively "transfer" their evasiveness to actual black-box target models.
  • The "Insert" Trick: One of the most effective mutations found was inserting a /Root/Pages/Rotate object, a signal many classifiers over-rely on as a marker for benign files.

Key Results

PDF-GAN achieved a 100% evasion rate against three major academic classifiers: Hidost’13, Hidost’16, and PDFrate-v2. It demonstrated significant efficiency gains, operating 13x to 30x faster than previous genetic-algorithm-based approaches. Furthermore, testing against 45 commercial AV engines on VirusTotal yielded a 100% evasion rate against 7 engines and over 60% on average across all 45, proving the real-world implications of this research for commercial security products.

Limitations and Future Work

While highly effective, the system faces challenges such as information loss during tree conversion and a dependency on dynamic analysis sandboxes (e.g., Cuckoo) for verification. Future work includes exploring more sophisticated embedding techniques like Graph2Vec and extending the GAN-based approach to other complex file formats, such as Word documents or Windows PE binaries.

Summary updated

BibTeX
@article{bae2021learn,
  author = {Ho Bae and Younghan Lee and Yohan Kim and Uiwon Hwang and Sungroh Yoon and Yunheung Paek},
  title = {{Learn2Evade: Learning-Based Generative Model for Evading PDF Malware Classifiers}},
  journal = {IEEE Trans. Artif. Intell.},
  year = {2021},
  doi = {10.1109/tai.2021.3103139},
}
Figure