manish-vi / malware_detection

Microsoft malware detection.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Malware Detection

1.Business/Real-world Problem

1.1. What is Malware?

The term malware is a contraction of malicious software. Put simply, malware is any piece of software that was written with the intent of doing harm to data, devices or to people.
Source: https://www.avg.com/en/signal/what-is-malware

1.2. Problem Statement

In the past few years, the malware industry has grown very rapidly that, the syndicates invest heavily in technologies to evade traditional protection, forcing the anti-malware groups/communities to build more robust softwares to detect and terminate these attacks. The major part of protecting a computer system from a malware attack is to identify whether a given piece of file/software is a malware.

1.3 Source/Useful Links

Microsoft has been very active in building anti-malware products over the years and it runs it’s anti-malware utilities over 150 million computers around the world. This generates tens of millions of daily data points to be analyzed as potential malware. In order to be effective in analyzing and classifying such large amounts of data, we need to be able to group them into groups and identify their respective families.

This dataset provided by Microsoft contains about 9 classes of malware. ,

Source: https://www.kaggle.com/c/malware-classification

1.4. Real-world/Business objectives and constraints.

  1. Minimize multi-class error.
  2. Multi-class probability estimates.
  3. Malware detection should not take hours and block the user's computer. It should fininsh in a few seconds or a minute.

2. Machine Learning Problem

2.1. Data

2.1.1. Data Overview

  • Source : https://www.kaggle.com/c/malware-classification/data
  • For every malware, we have two files
    1. .asm file (read more: https://www.reviversoft.com/file-extensions/asm)
    2. .bytes file (the raw data contains the hexadecimal representation of the file's binary content, without the PE header)
  • Total train dataset consist of 200GB data out of which 50Gb of data is .bytes files and 150GB of data is .asm files:
  • Lots of Data for a single-box/computer.
  • There are total 10,868 .bytes files and 10,868 asm files total 21,736 files
  • There are 9 types of malwares (9 classes) in our give data
  • Types of Malware:
    1. Ramnit
    2. Lollipop
    3. Kelihos_ver3
    4. Vundo
    5. Simda
    6. Tracur
    7. Kelihos_ver1
    8. Obfuscator.ACY
    9. Gatak
  • 2.2. Mapping the real-world problem to an ML problem

    2.2.1. Type of Machine Learning Problem

    There are nine different classes of malware that we need to classify a given a data point => Multi class classification problem

    2.2.2. Performance Metric

    Source: https://www.kaggle.com/c/malware-classification#evaluation

    Metric(s):

    • Multi class log-loss
    • Confusion matrix

    2.2.3. Machine Learing Objectives and Constraints

    Objective: Predict the probability of each data-point belonging to each of the nine classes.

    Constraints:

    * Class probabilities are needed. * Penalize the errors in class probabilites => Metric is Log-loss. * Some Latency constraints.

    2.3. Train and Test Dataset

    Split the dataset randomly into three parts train, cross validation and test with 64%,16%, 20% of data respectively

    2.4. Useful blogs, videos and reference papers

    http://blog.kaggle.com/2015/05/26/microsoft-malware-winners-interview-1st-place-no-to-overfitting/
    https://arxiv.org/pdf/1511.04317.pdf
    First place solution in Kaggle competition: https://www.youtube.com/watch?v=VLQTRlLGz5Y
    https://github.com/dchad/malware-detection
    http://vizsec.org/files/2011/Nataraj.pdf
    https://www.dropbox.com/sh/gfqzv0ckgs4l1bf/AAB6EelnEjvvuQg2nu_pIB6ua?dl=0
    " Cross validation is more trustworthy than domain knowledge."

    3. Getting Started

    Start by downloading the project and run "Microsoft_Malware_Detection.ipynb" file in ipython-notebook.

    4. Prerequisites

    You need to have installed following softwares and libraries before running this project.

    1. Python 3: https://www.python.org/downloads/
    2. Anaconda: It will install ipython notebook and most of the libraries which are needed like sklearn, pandas, seaborn, matplotlib, numpy and scipy: https://www.anaconda.com/download/

    5. Libraries

    • xgboost: It is used to make xgboost regression model.

      • pip install xgboost
      • conda install -c conda-forge xgboost
    • scikit-learn: scikit-learn is a Python module for machine learning built on top of SciPy.

      • pip install scikit-learn
      • conda install -c conda-forge scikit-learn
    • PIL: PIL is the Python Imaging Library by Fredrik Lundh and Contributors.

      • pip install Pillow
      • conda install -c anaconda pil

    6. Authors

    • Manish Vishwakarma - Complete work

    About

    Microsoft malware detection.


    Languages

    Language:Jupyter Notebook 100.0%