Manalyze:PE文件的靜態(tài)分析工具
介紹
當(dāng)我的殺毒軟件第13次嘗試隔離我的病毒樣本集時,我決心開發(fā)Manalyze。另一方面的原因也是我對殺毒軟件日益失望,它們不會解釋為什么把某個文件判斷為惡意軟件。顯然,大部分人需要有個殺毒軟件來幫他們做決定。但我認為很多專家用戶,即病毒分析人員可以使用一種能夠提供盡可能多信息的工具來分析PE可執(zhí)行文件,并且由他們自己來做最后的決定。
想要查看此工具生成的樣本報告,可訪問https://manalyzer.org/。
PE文件的靜態(tài)分析工具
Manalyze是用C++寫的,支持Windows和Linux平臺,以GPLv3協(xié)議發(fā)布。Manalyze是一款針對PE文件的強大分析器,它有靈活的插件架構(gòu),能讓用戶深入分析文件。它能夠
能夠識別PE的編譯器 識別加殼的可執(zhí)行文件 應(yīng)用ClamAV簽名 查找可疑字符串 尋找惡意的入口組合(即 WriteProcessMemory + CreateRemoteThread) 識別程序中密碼算法(跟IDA的findcrypt插件類似) 提交哈希值到VirusTotal 驗證authenticode簽名(僅Windows)
如何生成
Linux 和 BSD平臺(Debian Jessie 和 FreeBSD 10.2測試通過)
$> [sudo or as root] apt-get install libboost-regex-devlibboost-program-options-dev libboost-system-dev libboost-filesystem-devbuild-essential cmake git
$> [alternatively, also sudo or as root] pkg installboost-libs-1.55.0_8 cmake
$> git clone https://github.com/JusticeRage/Manalyze.git&& cd Manalyze
$> cmake .
$> make
$> cd bin && ./manalyze --version
Windows平臺
2. 生成boost庫
cdboost_1_XX_0 && ./bootstrap.bat && ./b2.exe--build-type=complete --with-regex --with-program_options --with-system--with-filesystem
添加一個BOOST_ROOT環(huán)境變量,指向boost_1_XX_0文件夾的路徑
3. 下載安裝Git
4. git clone https://github.com/JusticeRage/Manalyze.git && cd Manalyze &&cmake
5. Manalyze文件夾中應(yīng)該有一個VisualStudio項目manalyze.sln。
離線生成
如果你要在沒有網(wǎng)絡(luò)的電腦上生成Manalyze,你要查看以下項目:
將這兩個文件放到external文件夾,即external/yara和external/hash-library。然后運行runcmake . -DGitHub=OFF。
二進制文件
所有的二進制文件都有證書簽名,指紋為:26fc24c12b2d84f77615cf6299e3e4ca4f3878fc。
生成ClamAV規(guī)則
由于ClamAV簽名數(shù)量龐大并且更新頻繁,把它們放在二進制文件里顯然不合適。當(dāng)你第一次使用ClamAV插件時,可能會看到這個錯誤信息:[!]Error: Could not load yara_rules/clamav.yara。要生成一下的話就去bin/yara_rules運行update_clamav_signatures.py。
要更新簽名的時候就運行一下這個腳本。
用法
$ ./manalyze.exe --help
Usage:
-h [ --help ] Displays this message.
-v [ --version] Prints the program's version.
--pe arg The PE to analyze. Also accepted as a positional
argument. Multiple files may be specified.
-r [ --recursive] Scan all files in a directory(subdirectories will be
ignored).
-o [ --output ]arg The output format. May be 'raw'(default) or 'json'.
-d [ --dump ]arg Dump PE information. Available choices are any
combination of: all, summary, dos(dos header), pe (pe
header), opt (pe optional header), sections, imports,
exports, resources, version, debug, tls
--hashes Calculate various hashes of the file (may slow down the
analysis!)
-x [ --extract ]arg Extract the PE resources to the target directory.
-p [ --plugins ]arg Analyze the binary with additional plugins. (may slow
down the analysis!)
可用插件:
– clamav:使用ClamAV病毒特征庫掃描二進制文件
– compilers: 嘗試判斷生成二進制文件所使用的編譯器
– peid: 返回二進制文件的PEiD簽名
– strings: 檢測可疑字符串(anti-VM,process names…)
– findcrypt: 識別程序中密碼算法
– packer: 檢測加殼
– imports: 檢查可疑入口
– resources: 分析程序的資源
– authenticode: 檢查PE的數(shù)字簽名是否有效
– virustotal: 在VirusTotal檢查樣本檢測結(jié)果
– all: 運行所有可用插件
使用范例
manalyze.exe program.exe
manalyze.exe -dresources -dexports -x out/ program.exe
manalyze.exe –dump=imports,sections –hashes program.exe
manalyze.exe -r malwares/ –plugins=peid,clamav –dump all
樣本報告