Detecting Unknown Malware on Android by Machine Learning Using the Feature of Dalvik Operation Code

Quanmin Wang, Zhenguo Li, Shuang Zheng, Shi Gu, Yanfeng Sun, Kaiyang Wang2017

Abstract

The recent growth in network usage has motivated the creation of new malicious code for various purposes, including economic ones. Today's signature-based anti-viruses are very accurate, but cannot detect new malicious code. Recently, classification algorithms were employed successfully for the detection of unknown malicious code. However, most of the studies use byte sequence n-gram representation of the binary code of the executable files on windows. We propose the use of Dalvik Operation Code on Android, generated by disassembling the application. We then use n-gram of the operation code as features for the classification process. We present a full methodology for the detection of unknown malicious code, based on text categorization concepts. The experiment results show that the method results are in a high accuracy rate.

Introduction

The cybersecurity landscape is a perpetual cat-and-mouse game. Traditional anti-virus (AV) software relies heavily on signature-based detection, which looks for specific "fingerprints" of known malicious files. While highly accurate for known threats, this method is ineffective against "unknown" or "zero-day" malware—newly created or slightly modified variants that have not yet been indexed.

While researchers have previously used machine learning to detect Windows malware by analyzing raw byte sequences, Android presents a unique architecture. This paper addresses the need for a robust, proactive detection system specifically tailored for the Android ecosystem, focusing on the semantic behavior of the code rather than just raw binary data.

Methodology

The proposed framework utilizes a multi-stage pipeline that treats disassembled code as text, applying concepts from Natural Language Processing (NLP):

  1. Disassembly: Android applications (APKs) are unpacked, and the classes.dex file is disassembled using Apktool to produce Smali code. This allows for the extraction of Dalvik Operation Codes (opcodes)—the low-level instructions executed by the Android virtual machine.
  2. Feature Extraction (N-grams): Instead of analyzing single instructions, the system examines sequences of $n$ instructions (n-grams). For example, a 2-gram (bigram) captures pairs of consecutive opcodes, which helps represent the logic and flow of the program.
  3. Feature Selection: To combat the "curse of dimensionality" caused by millions of potential n-grams, the authors used Document Frequency (DF) to select the top 500 most relevant features. This ensures the model focuses on patterns that appear across many files rather than noise.
  4. Classification: The researchers employed the Random Forest algorithm. Random Forest is particularly effective here because it uses an ensemble of decision trees to reduce variance and prevent overfitting, a common risk when dealing with complex malware datasets.

Experimental Results

The effectiveness of the model was evaluated using Receiver Operating Characteristic (ROC) curves, which plot the true positive rate (sensitivity) against the false positive rate (1-specificity).

TF vs. TF-IDF

A key finding of this study is the comparison between Term Frequency (TF) and Term Frequency-Inverse Document Frequency (TF-IDF). While TF-IDF is standard in many NLP tasks, the authors found that Term Frequency (TF) alone actually performed better for malware detection. This is a significant insight because TF is computationally cheaper to maintain as new malware samples are added to a collection.

Figure 1: ROC curve for the TF-based model across different n-gram sizes.

As shown in Figure 1, the TF representation consistently achieved high accuracy. Lower-order n-grams, such as 1-grams and 2-grams, provided strong baseline performance, reaching high sensitivity quickly. In contrast, Figure 2 illustrates the performance of the TF-IDF representation, which showed significantly lower accuracy across the same n-gram sizes.

Figure 2: ROC curve for the TF-IDF-based model, showing lower performance compared to TF.

Dataset and Performance

The study utilized malicious samples from VirusShare and benign samples from yingyongbao. The Random Forest classifier, combined with the top 500 features selected via Document Frequency, achieved a high accuracy rate, effectively distinguishing between benign applications and unknown malicious code.

Conclusion

By using disassembled opcodes rather than raw bytes, the model captures a higher-level "intent" of the code. This makes the detection more resilient to minor code changes that might change a file's binary signature but not its underlying logic. While the results are promising, future work should address advanced obfuscation techniques and optimize the pipeline for real-time mobile protection.

Summary updated

BibTeX
@misc{wang2017detecting,
  author = {Quanmin Wang and Zhenguo Li and Shuang Zheng and Shi Gu and Yanfeng Sun and Kaiyang Wang},
  title = {{Detecting Unknown Malware on Android by Machine Learning Using the Feature of Dalvik Operation Code}},
  year = {2017},
  doi = {10.2991/icacie-17.2017.12},
}
Figure