Giter Club home page Giter Club logo

microsoft_malware_classification's Introduction

Microsoft Malware Classification

1.Business/Real-world Problem

1.1. What is Malware?

Malware is any type of software created to harm or exploit another piece of software or hardware. Short for “malicious software,” malware is a collective term used to describe viruses, ransomware, spyware, Trojans, and any other type of code or software built with malicious intent.

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: Kaggle-Microsoft Malware Classification Challenge: https://www.kaggle.com/c/malware-classification]

1.4. Real-world/Business objectives and constraints.

  • Minimize multi-class error.
  • Multi-class probability estimates.
  • 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

  1. Data Source: https://www.kaggle.com/c/malware-classification/data
  2. For every malware, we have two files
  3. Total train dataset consist of 200GB data out of which 50Gb of data is .bytes files and 150GB of data is .asm files:
  4. Lots of Data for a single-box/computer.
  5. There are total 10,868 .bytes files and 10,868 asm files total 21,736 files
  6. There are 9 types of malwares (9 classes) in our give data
  7. Types of Malware:

Malware Classes

2.1.2. Example Data Point

.asm file sample

.byte file sample

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

  • 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

  1. http://blog.kaggle.com/2015/05/26/microsoft-malware-winners-interview-1st-place-no-to-overfitting/
  2. https://arxiv.org/pdf/1511.04317.pdf
  3. First place solution in Kaggle competition: https://www.youtube.com/watch?v=VLQTRlLGz5Y
  4. https://github.com/dchad/malware-detection
  5. http://vizsec.org/files/2011/Nataraj.pdf

3. My approach

  1. Extract the .asm and .bytes file and copy them to seperate folders.
  2. Now we have to create the features out of these .asm and .byte files.
  3. .byte file:
    • Create unigram features count from each byte file.
    • Get the size of each .byte file.
    • Top 2000 Bi-Gram of Byte files
  4. .asm file:
    • Create unigram features from each asm file.
    • Size of ASM Files
    • Top 500 Bigram of Opcodes of ASM Files
    • Top 800 Trigram of Opcodes of ASM Files
    • Top 800 ASM Image Features
  5. Combining the different features from .byte and .asm files into a single dataframe.
  6. Splitting the data into Train, Test and Cross Validation sets.
  7. Applied different classification ML algorithms such as Logistic Regression, KNN, Dicision Tree, Random Forest, XGBoost.
  8. Based on results obtained, we came to kn ow that XGBoost performing well.
  9. Hyperparameter Tuning is done using sklearns RandomSearchCV.
  10. Using the best parameters obtained from RandomSearchCV, final XGBoost model has run and logloss is calculated.

4.Result:

For the final dataset, i have used different classification estimators such as, Logostic Regression, KNN, Random Forest and XG Boost models. Random Forest Classifier is performing well. The results are tabulated as below.

Models_Logloss

microsoft_malware_classification's People

Contributors

siddharth-matada avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.