Malware Analysis

Multi-engine antivirus scanner: VirusTotal

Malware family 是怎麼決定的?

https://software.imdea.org/~juanca/papers/avclass_raid16.pdfarrow-up-right

Cuckoo Sandbox- 惡意程式分析沙箱

我們要怎麼透過分群演算法,分析出惡意程式們的家族歸屬?

  1. 講到分群,一定要先想到相似度分析,相似度分析就有 euclidean distance, edit distance, jaccard distance一堆演算法。

  2. 在Malware Data Science 這本書的Chapter 5,採用APT1的binary進行相似度比對,並且建立NetworkX的Graph。

  3. 在chapter 5的Listing_5_1,這個python做了以下幾件事情:

    1. argparse: 用來管理傳入參數

    2. networkx: 建立空白的networkx

    3. 將參數所指定的file paths,萃取出屬於PE header才進行後續分析,已經打包好

    4. 相似度比對:Jaccard distance

    5. 可以動態調整

  4. Homework 將51或是5_2實作

解讀listing5_1.py

結構:import, def, main

請參考 https://software.imdea.org/~juanca/papers/avclass_raid16.pdfarrow-up-right

Malware Data Science: Attack Detection and Attribution

SHARED CODE ANALYSIS

Preparing Samples for Comparison by Extracting Features How Bag of Features Models Work What are N-Grams?

Using the Jaccard Index to Quantify Similarity Using Similarity Matrices to Evaluate Malware Shared Code Estimation Methods

Instruction Sequence–Based Similarity Strings-Based Similarity Import Address Table–Based Similarity Dynamic API Call–Based Similarity

Building a Similarity Graph Scaling Similarity Comparisons

Minhash in a Nutshell

Minhash in Depth Building a Persistent Malware Similarity Search System Running the Similarity Search System Summary

Homework 20201210

請各位同學將APT1家族的惡意程式,透過Binary的字串分析,透過Jaccard Similarity,建立相似度矩陣(Similarity matrix),建立NetworkX的Graph,以及將各自串建立成NetworkX的節點,透過相似度公式計算節點是否要連成線,最後把分群後的圖檔存起來。

可以請同學上傳到github,直接交github位置給我(LINE作業貼文串)

Listing5.1的例子執行一遍,說明關鍵程式碼內容,並且做一些分析。

分析 threshold = 0.8 與 0.3 有什麼差別?(0.3, 0.4, ..., 0.9, 0.99)

threshold = 0.8
threshold = 0.3

Gathering Training Examples

VirusTotal

Extracting Features

domain knowledge

Chapter 8: 如何自己做一個惡意程式分析引擎?

不管如何,請先開virtual machine範例,研究ch8的程式結構。

在ch8中,我們發現有兩個資料夾,一個是Code,一個是Data。

  • Data: 包含了2個資料夾,很特別,一個是Benignware,另一個是Malware。

  • Code: 放了許多程式,先看install.sh與requirement.txt兩個程式,requirement.txt放了你需要環境哪些套件的版本確認,install.sh則是驅動requirement.txt。

run_completedetector.sh- 這隻程式是驅動的主程式,驅動的是completedetector.py

請同學先順利執行run_completedetector.sh,應該會看到這種圖:

執行完成,是成功的第一步!接著就是要研究這段程式碼。

scitkit-learn: https://machine-learning-python.kspax.io/arrow-up-right

https://stackabuse.com/random-forest-algorithm-with-python-and-scikit-learn/arrow-up-right Very important!!

Last updated