Malign is a static malware family classification tool that adopts multiple sequence alignment (MSA) with necessary pre-processing and leverages simple machine-learning model. It takes in hex-byte code of executable files. It not only classifies the malware family but also can find potentially malicious code segments. Read our paper for more details - https://arxiv.org/pdf/2111.14185.pdf
- C++11
- Python 3.8
- SibeliaZ
SibeliaZ can be installed using bioconda. After installing bioconda, run this command -
conda install sibeliaz
For more details, read the documentation of SibeliaZ.
We will be explaining each step in the pipeline of Malign.
-
Preprocessing
Run
converter.cppwhich takes any.txtfile containing the file path that needed to be converted. It will generate new files in a folder named 'Modified'. Then change the directory to 'Modified' and runconvertedToFasta.cppon these newly generated files. After this, you will get the.fastaversion of your hex files and you will use these files in the next steps. -
Running MSA
We will apply multiple sequence alignment on the fasta files using SibeliaZ. Run this command -
sibeliaz -o sibeliaz_out <fasta_file1> <fasta_file2> <fasta_file3>These fasta files have to be the malware files from the family of interest. Running this command will generate
blocksfolder,alignment.mafandblocks_coords.gfffiles inside the 'sibeliaz_out' folder. -
Consensus Sequence and Score Generation
Run
concat_fasta.cppfile takes in thealignment.maffile and generates themerged_sequence.fastafile that we will be using as the consensus sequence for that malware family.Run
score_calc.cppfile that takes in the samealignment.maffile and generates theScore_output.txtfile that stores the scores of all coordinates for each consensus sequence.
-
Alignment with Consensus Sequences
Run
sibeliaz_cmd_maker.cppfile that takes in the list of files that you want to align with the generated consensus sequences from Phase 1. This will generate a script namedcmd_for_alignment.shthat will contain multiple sibeliaz alignment commands each having an alignment command between themerged_sequence.fastafile and file from your list. Then run the generatedcmd_for_alignment.shscript. It will automatically create folder for each files from your list and store the alignment output. -
Input Generation for Classification Model
Run
csv_file_maker.cppfile that will take in thescore_output.txtfile generated in Phase 1. It will iterate through everyalignment.maffile from the previous step, and generate alignment score for each of them. These scores will be saved in.csvfiles depending on positive and negative labels. -
Classification
Now you can use any classification model as your choice on the generated
.csvfile. We have uploaded python notebooks for Logisitic Regression, Decision Tree and SVM models.
If you use Malign in your research, please cite:
@article{saha2021malign,
title={MALIGN: Adversarially Robust Malware Family Detection using Sequence Alignment},
author={Saha, Shoumik and Afroz, Sadia and Rahman, Atif},
journal={arXiv preprint arXiv:2111.14185},
year={2021}
}