Machine Learning for Detecting Malware in PE Files

Collin Connors, Dilip Sarkar · DOI

Introduction

The cybersecurity landscape is defined by a perpetual arms race. Traditional antivirus software has long relied on "signatures"—unique strings of code acting as digital fingerprints for known threats. However, modern malware is increasingly polymorphic and adaptive, changing its appearance with every replication to evade these static signatures. To counter this, researchers have turned to static analysis, where machine learning models examine a file's structure and metadata without execution. This study evaluates various machine learning models against the massive EMBER dataset to identify the most effective architectures and features for detecting malware in Windows Portable Executable (PE) files.

Methodology

The researchers conducted a comprehensive head-to-head comparison between several classic machine learning algorithms and a custom-built Artificial Neural Network (ANN).

  • Baseline Model: LightGBM (LGBM), a gradient-boosting framework currently considered the industry standard for tabular data, served as the primary benchmark.
  • Challenger Model: A custom ANN/DNN architecture consisting of three dense layers (512, 128, and 8 nodes) utilizing tanh activation functions and batch normalization to ensure training stability.
  • Feature Engineering: The study employed the "Hashing Trick," a dimensionality reduction technique used to process complex data such as imported and exported functions into a digestible format for the models.
  • Evaluation Metrics: Beyond standard accuracy (ACC), the models were evaluated using Area Under the Curve (AUC), Precision, Recall, and F1-score. A particular focus was placed on performance at low false-positive rates, which is critical for real-world antivirus deployment.

Datasets

The study utilized the EMBER (v2) dataset, one of the largest public benchmarks for malware detection, comprising 1.1 million samples (900,000 for training and 200,000 for testing). The data is split chronologically; models are trained on "past" files and tested on "future" files to simulate real-world "drift" and the evolution of malware threats. Each file is represented by 2,381 features categorized into nine groups, including Byte Histograms (BH), String Information (ST), and Header Metadata (HE).

Key Insights and Feature Analysis

Analysis of individual feature performance revealed that not all data points are created equal. The researchers found that Byte Histograms (BH) and Byte Entropy (BE) are the most potent individual features for detection.

Performance of individual features across ANN and LGBM models.

As shown in the feature analysis, the ANN performed exceptionally well when processing Byte Histograms (ACC 0.8949), while the LGBM model showed a relative preference for Section Information (SE). Interestingly, traditional models like SVM and QDA failed significantly on this dataset, often performing no better than a random guess.

Key Results

The custom ANN emerged as the superior model, demonstrating that deep learning architectures can provide a significant edge over traditional gradient boosting in the malware detection domain.

Comparative performance metrics of various machine learning models on the EMBER dataset.

The ANN/DNN achieved a top accuracy of 95.22%, outperforming the LGBM baseline of 93.63%. By transitioning from the industry-standard LGBM to the optimized ANN, the researchers reduced the inaccurate detection rate from 6.05% to 4.78%, representing a 20.99% improvement in error reduction. While the LGBM baseline maintained a slightly higher AUC (0.9845 vs 0.9815), the overall balanced performance of the ANN makes it a formidable candidate for modern security stacks.

Conclusion

This research demonstrates that relatively simple but strategically designed neural networks can outperform established industry standards in static malware analysis. While Byte Histograms and Entropy provide the strongest signals, the study also highlights that model-feature specificity is crucial; different architectures derive value from different aspects of the PE file structure. Future work will explore more complex feature interactions and the potential for combining high-performing static models with lightweight dynamic analysis to address the most elusive zero-day threats.

Summary updated

BibTeX
@inproceedings{connors2023machine,
  author = {Collin Connors and Dilip Sarkar},
  title = {{Machine Learning for Detecting Malware in PE Files}},
  booktitle = {Icmla},
  year = {2023},
  doi = {10.1109/icmla58977.2023.00331},
}
Figure