Malware Detection Using Frequency Domain-Based Image Visualization and Deep Learning

Tajuddin Manhar Mohammed, Lakshmanan Nataraj, Satish Chikkagoudar, Shivkumar Chandrasekaran, B. S. ManjunatharXiv 2021

This paper, published in early 2021, presents a significant step forward in static malware analysis by treating binary files not as code to be disassembled, but as signals to be visualized in the frequency domain. By combining signal processing with deep learning and introducing a massive new dataset, the authors achieve high-accuracy detection without the computational overhead of traditional behavioral analysis.

TL;DR

The authors propose a novel malware detection method that converts executable binaries into grayscale images by calculating bi-gram frequencies in the Discrete Cosine Transform (DCT) domain. Using a new dataset of over 1 million samples (MaleX), their ensemble deep learning model achieves 96% classification accuracy, outperforming traditional hand-crafted features and spatial-domain visualizations.

What Problem Does This Paper Address?

Malware detection typically falls into two camps: static analysis (examining code without running it) and dynamic analysis (monitoring behavior during execution). Dynamic analysis is effective but slow and resource-intensive. Static analysis often relies on disassembly, which can be easily defeated by code obfuscation or packing.

Recent trends have moved toward "malware-as-images," where bytes are mapped directly to pixels (byteplots). While useful, these spatial representations can remain "sparse"—meaning the data is spread out with little recognizable structure. This paper addresses the challenge of creating a more dense, feature-rich representation of malware that deep learning models can easily digest, without needing to disassemble the code.

Methods

The core innovation is the "bigram-dct" visualization pipeline:

  1. Bi-gram Counting: The binary is read as a sequence of bytes. The authors count the occurrences of every possible pair of bytes (bi-grams), resulting in a 256x256 matrix of counts.
  2. Frequency Domain Transformation: To "de-sparsify" this matrix, they apply a Discrete Cosine Transform (DCT). This shifts the data from a sparse count-based representation into the frequency domain, creating distinctive textured patterns.
  3. Visualization: The resulting DCT coefficients are normalized into a grayscale image.
Figure 1: Visualizing malware as a grayscale image in DCT domain.

For detection, the authors tested two neural network approaches:

  • 3C2D: A custom shallow CNN designed for low computational complexity.
  • Transfer Learning: Pre-trained ResNet-18 and ResNet-50 models fine-tuned on the malware images.

Finally, they created an ensemble model that takes both the frequency-domain (bigram-dct) and spatial-domain (byteplot) images as inputs, using a novel "Joint Feature Metric" to quantify how well these different features complement each other.

Datasets

The study utilizes two primary datasets:

  • smalldata: A curated set of 16,358 samples (9,130 malware from the MalImg dataset and 7,228 benign Windows files) used for initial parameter tuning.
  • MaleX: A massive new dataset introduced by the authors containing 1,044,394 Windows executables (864,669 malware and 179,725 benign). This is one of the largest publicly available datasets of its kind, designed to test the scalability of machine learning models.

Key Insights and Ideas

  • De-sparsification via DCT: Raw bi-gram counts are often very sparse. Applying DCT concentrates the energy of the signal, turning sparse "dots" into textured "gradients" that are much easier for Convolutional Neural Networks to learn from.
  • Visual Fingerprints: Different malware families produce visually distinct textures in the DCT domain. For example, the Lolyda.AT and Adialer.C families show clear, repeatable patterns that act as a visual signature.
  • Ensemble Synergy: The authors found that spatial features (byteplots) and frequency features (bigram-dct) are "non-orthogonal"—they capture different types of information. Combining them significantly boosts accuracy compared to using either alone.
  • Shallow vs. Deep: While shallow networks (3C2D) perform well, deeper architectures like ResNet-50 show superior generalization, especially when dealing with large, unseen malware samples.

Key Results

  • High Accuracy: The proposed ensemble CNN achieved 96.15% accuracy on the large-scale MaleX dataset.
  • Superiority over Hand-crafted Features: The CNN models consistently outperformed standard image descriptors like GIST (which achieved ~85% accuracy on the same data).
  • Generalization: When tested on a large "left-out" set of over 600,000 malicious samples not seen during training, the model maintained a strong performance, proving it wasn't just memorizing the training set.
  • Efficiency: The method requires no disassembly or execution, making it significantly faster than dynamic analysis or complex static analysis pipelines.

Limitations and Future Work

  • Adversarial Evasion: The authors do not explicitly discuss how their method handles adversarial attacks specifically designed to alter bi-gram frequencies or DCT textures without changing malware functionality.
  • Class Imbalance: The MaleX dataset is heavily skewed toward malware (roughly 5:1 ratio). While the results are strong, future work could explore techniques to better handle this imbalance.
  • Multi-class Classification: The primary focus was binary detection (malware vs. benign). Extending this to high-granularity family classification on the 1-million-sample scale is a logical next step.

For those interested in exploring the data, the authors have made the MaleX dataset available upon request and provided a link to their GitHub repository.

Summary updated

BibTeX
@misc{mohammed2021malware,
  author = {Tajuddin Manhar Mohammed and Lakshmanan Nataraj and Satish Chikkagoudar and Shivkumar Chandrasekaran and B. S. Manjunath},
  title = {{Malware Detection Using Frequency Domain-Based Image Visualization and Deep Learning}},
  year = {2021},
  eprint = {2101.10578},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2101.10578},
}
Figure