Towards Adversarial Malware Detection: Lessons Learned from PDF-based Attacks

Davide Maiorca, Battista Biggio, Giorgio Giacinto · DOI

Abstract

Malware still constitutes a major threat in the cybersecurity landscape, also due to the widespread use of infection vectors such as documents. These infection vectors hide embedded malicious code to the victim users, facilitating the use of social engineering techniques to infect their machines. Research showed that machine-learning algorithms provide effective detection mechanisms against such threats, but the existence of an arms race in adversarial settings has recently challenged such systems. In this work, we focus on malware embedded in PDF files as a representative case of such an arms race. We start by providing a comprehensive taxonomy of the different approaches used to generate PDF malware, and of the corresponding learning-based detection systems. We then categorize threats specifically targeted against learning-based PDF malware detectors, using a well-established framework in the field of adversarial machine learning. This framework allows us to categorize known vulnerabilities of learning-based PDF malware detectors and to identify novel attacks that may threaten such systems, along with the potential defense mechanisms that can mitigate the impact of such threats. We conclude the paper by discussing how such findings highlight promising research directions towards tackling the more general challenge of designing robust malware detectors in adversarial settings.

Introduction

Malware authors have increasingly shifted from simple executable files to "infection vectors"—non-executable files like PDFs that exploit vulnerabilities in third-party applications (like Adobe Reader) to drop malicious payloads. Because these files can be easily obfuscated, traditional signature-based antivirus tools often fail. Researchers turned to Machine Learning (ML) to solve this, using structural features and JavaScript analysis to identify malicious patterns. However, this created a new problem: Adversarial Machine Learning. Attackers began crafting "adversarial examples"—malicious PDFs that are functionally identical to the original exploit but are mathematically tuned to look "benign" to an ML model.

The Detection Pipeline

The standard ML detection process for PDF malware is typically modeled as a three-stage pipeline: Pre-processing (parsing the PDF), Feature Extraction (turning the data into numerical vectors), and Classification (the actual ML algorithm, like Random Forests or SVMs). This pipeline is often augmented with a training phase where the classifier learns to distinguish between malicious and legitimate samples.

The standard learning-based PDF malware detection pipeline, illustrating the flow from file input to classification.

Adversarial Framework and Exploitation

To understand the adversarial landscape, the field can be categorized into three main pillars:

  1. PDF Exploitation Techniques: Weaponization methods include JavaScript-based exploits (the most common), ActionScript-based (Flash), and File Embedding (hiding malicious files like .exe or .tiff inside the PDF structure).
  2. The Adversarial Framework: Attacks are categorized based on the attacker's goal (integrity, availability, or privacy), knowledge (white-box, gray-box, or black-box), and capability (evasion at test time vs. poisoning at training time).

Key Insights: Structural Flexibility as a Weapon

A major challenge in this field is the "Inverse Feature-Mapping" problem. While it is mathematically easy to find a feature vector that evades a model, it is physically difficult to "invert" that vector back into a valid, working PDF file that still executes its exploit. However, the inherent structural flexibility of the PDF format provides a loophole.

The internal structure of a PDF file, consisting of a Header, Body (objects), Cross-reference Table, and Trailer.

As shown in the figure above, PDFs are essentially graphs of objects. Attackers can inject "dead" objects—content that is never parsed by the reader but is counted by the ML model—to trick the classifier without breaking the malware's functionality. This allows for techniques like Mimicry, where benign features are added to a malicious file, or Reverse Mimicry, where a stealthy malicious payload is injected into a known benign file.

Results and Future Directions

While most detectors (like PDFRate and Hidost) report >99% accuracy on standard datasets, their robustness drops significantly under adversarial pressure. Optimization-based attacks can often evade detectors with fewer than 10 small structural changes.

To move forward, the research community must address the "F1-Score Trap," ensuring models are evaluated at very low False Positive thresholds suitable for real-world deployment. Furthermore, there is a dire need for "Security by Design." Rather than patching models after they are broken, we must incorporate "adversarial training"—integrating attack scenarios directly into the training phase to build inherent robustness against the evolving arms race.

Summary updated

BibTeX
@article{maiorca2019towards,
  author = {Davide Maiorca and Battista Biggio and Giorgio Giacinto},
  title = {{Towards Adversarial Malware Detection: Lessons Learned from PDF-based Attacks}},
  journal = {ACM Computing Surveys},
  year = {2019},
  doi = {10.1145/3332184},
}
Figure