Deep learning at the shallow end: Malware classification for non-domain experts

Quan Le, Oisín Boydell, Brian Mac Namee, Mark Scanlon · DOI

Abstract

Current malware detection and classification approaches generally rely on time-consuming and knowledge-intensive processes to extract patterns (signatures) and behaviors from malware, which are then used for identification. Moreover, these signatures are often limited to local, contiguous sequences within the data while ignoring their context in relation to each other and throughout the malware file as a whole. We present a Deep Learning based malware classification approach that requires no expert domain knowledge and is based on a purely data-driven approach for complex pattern and feature identification.

Introduction

Digital forensic investigators are currently facing a data deluge. As the volume of seized devices grows, a massive backlog has formed, particularly in malware analysis—a task that traditionally requires highly specialized skills in reverse engineering, disassembly, and behavioral sandboxing. The "barrier to entry" for malware analysis remains high because most existing automated tools rely on "signatures" or complex feature engineering (like extracting API calls or control-flow graphs), which still require experts to tune and interpret.

This research seeks to lower this "shallow end" of the pool, enabling non-experts to accurately classify malware families using a purely data-driven approach. By ignoring the semantic "meaning" of the code in favor of its underlying structural patterns, the proposed system allows for rapid triage without the need for deep reverse engineering expertise.

Methodology

The authors propose a "context-independent" pipeline that treats a malware file as a simple sequence of bytes. This approach bypasses the need for disassembly or execution in a sandbox.

  1. Preprocessing: Instead of disassembling the code, the raw hexadecimal content is converted into a 1D vector. To handle varying file sizes, a generic 1D "image scaling" algorithm (downsampling) is used to resize every file to a fixed length of 10,000 bytes.
  2. Architecture: The study compared three deep learning configurations:
  3. CNN: Three convolutional layers to capture local spatial patterns (short sequences of bytes).
  4. CNN-UniLSTM: Adding a unidirectional Long Short-Term Memory layer to capture dependencies from the start of the file to the end.
  5. CNN-BiLSTM: A bidirectional LSTM that reads the sequence in both directions, allowing the model to capture the relationship between distant pieces of code regardless of their order.
  6. Class Rebalancing: Because some malware families are much rarer than others, a Class Rebalance Batch Generator (CRBG) was implemented to ensure the model did not become biased toward the most common types.

Dataset Analysis

The study utilized the Microsoft Malware Classification Challenge (BIG 2015) dataset from Kaggle, which includes 10,868 labeled samples across 9 distinct malware families (e.g., Ramnit, Lollipop, Vundo, Simda). The data consists of raw hexadecimal representations of the file's binary content with PE headers removed for security.

Distribution of malware file sizes in the BIG 2015 dataset.

As shown in the figure above, the dataset contains a wide variety of file sizes, ranging from a few kilobytes to several megabytes. This variance justifies the use of a fixed-length downsampling technique to ensure the neural network receives a consistent input size while preserving the overall structural "fingerprint" of the file.

Key Insights and Ideas

One of the primary arguments of this paper is that 1D is superior to 2D for malware classification. Previous researchers often wrapped byte sequences into 2D "images" to utilize standard computer vision models. However, this paper argues that 1D preserves the natural sequential order of the code and avoids arbitrary decisions about image width and height that can break local patterns.

Visual representations of raw binary data from different malware families.

While the model processes data in 1D, visualizing the binaries in 2D (as seen above) highlights the distinct visual textures and patterns inherent to different malware families. The "Aha!" moment of the research was finding that adding a BiLSTM on top of a CNN significantly boosted performance. While the CNN identifies the "words" (local patterns), the BiLSTM understands the "sentences" (how those patterns relate across the entire file).

Key Results

The best-performing model, the CNN-BiLSTM with class rebalancing, achieved a remarkable 98.2% classification accuracy. Beyond accuracy, the model is highly efficient; on a standard desktop CPU, it takes only 0.02 seconds to process and classify a single binary file.

When submitted to the Kaggle leaderboard, the model maintained high performance on the unseen test set with a log-loss of 0.0655, proving it was not merely "memorizing" the training data but learning generalizable features. It outperformed previous methods that relied on 2D image representations or manual feature engineering, which typically achieved around 95% accuracy on the same dataset.

Limitations and Future Work

Despite its success, the model has "semantic blindness." It identifies patterns but does not "understand" what the code is doing, meaning it cannot explain why a file is malicious. Additionally, downsampling a 60MB file to 10KB inevitably loses some detail, and the paper does not address how easily a malware author could obfuscate their code with junk bytes to break the pattern recognition.

Future work will explore "residual modules" (ResNets) to help the model learn even deeper features and test the architecture on larger, more diverse datasets to improve its robustness against adversarial obfuscation.

Summary updated

BibTeX
@article{le2018deep,
  author = {Quan Le and Oisín Boydell and Brian Mac Namee and Mark Scanlon},
  title = {{Deep learning at the shallow end: Malware classification for non-domain experts}},
  journal = {Digit. Investig.},
  year = {2018},
  doi = {10.1016/j.diin.2018.04.024},
}
Figure