Home

Awesome

Deep Android Malware Detection

This repository contains the code for the paper "Deep Android Malware Detection" (pdf download) | (citation)

We use a convolutional neural network (CNN) for android malware classification. Malware classification is performed based on static analysis of the raw opcode sequence from a disassembled android apk. Features indicative of malware are automatically learned from the raw opcode sequence thus removing the need for hand-engineered malware features. The network runs on GPU, allowing a very large number of files to be quickly scanned.

<p><img src='malware_network_diagram.png'></p>

If you use this code please cite the following paper:

@inproceedings{mclaughlin2017codaspy,
title = "Deep Android Malware Detection",
author = "Niall McLaughlin and {Martinez del Rincon}, Jesus and BooJoong Kang and Suleiman Yerima and Paul Miller and Sakir Sezer and Yeganeh Safaeisemnani and Erik Trickel and Ziming Zhao and Adam Doupé and {Joon Ahn}, Gail",
year = "2016",
month = "12",
booktitle = "Proceeding of the ACM Conference on Data and Applications Security and Privacy (CODASPY) 2017",
publisher = "Association for Computing Machinery (ACM)",
}

How to run the code

Given an existing dataset directory (see below for details), the run.sh file will do the following:

  1. Partition the dataset into training-set and held-out test-set
  2. Train a neural network
  3. Test the trained network on the test-set

Prerequisites

Dataset structure

An example dataset with the required directory structure is provided in ./dataset

The neural network requires opcode sequence files in the correct format, and a dataset directory with sub-directories containing malware and benign opcode sequence files.

An example dataset directory is provided in ./dataset. The dataset directory must have the following structure:

  1. There must be a directory called 'Benign', and contains non-malware opcode sequences files
  2. The other directory can have any name ,and contains malware opcode sequence files

Opcode Sequence files

Opcode sequence files can be created from android APK files using the opcode sequence creation tool. This tool is located in ./opcodeseq_creator Please see the readme file in this directory for more information.

Setup

The neural network code is implemented using Torch. It is recommended to use a GPU to achieve acceleration of testing and training. For details on installing Torch please see http://torch.ch

The opcode sequence creator tool requires APKTool https://ibotpeaches.github.io/Apktool/