Among the large amount of malwares we view, we have seen a few this week that were heavily obfuscated by some sort of "polymorphic packer." Interestingly, unlike the results of most packers/protectors, the application code wasn't just decrypted and executed from a section, but rather was executed onto the heap. The applications were apparently compiled in Visual C++ and didn't have any position-independent code. (The code needs to be loaded at a given address; otherwise, it won't be able to execute correctly.)
It seems that this obfuscating tool requires the malware to be linked with a low imagebase (lower than the usual 0x400000), in order to be packed. Many reverse engineering tools dedicated to unpacking weren't meant to work on code that is on the heap, and will fail to work correctly in this situation. The protected PE file has a standard PE structure and imagebase.
On the other hand, it has a few hundred KB lines of obfuscated code (around 500 KB in the samples we had). All samples had different junk code, and obfuscation, but it was still pretty easy to find the start of the decrypted application after analysis of a few samples. We have successfully rebuilt completely decrypted samples for further analysis.
Creating a new PE file from scratch with information from the heap is rather easy, and with a little shellcode, it's possible to load all the necessary dlls, to be able to rebuild a new, clean Import Table without problems.
You can find graphs from 3 different samples using the same protector:

Once the code is totally unpacked, you can find the whole code flow of the protector. Here is an example from the 3rd graph above:
Finally, here are two blocks of code from the first sample:

Most of the custom packers we see are much simpler than this. More importantly, they are not "polymorphic" at all.
Even though these particular samples were simple to unpack, the layers were interesting to look at, and the code-on-heap feature (already done before, but in a different way) was a fun surprise on a boring night. ;-)
本周观察到部分恶意软件采用复杂的多态打包器进行混淆。这些软件不仅在解密后执行,还将应用代码放置在堆上运行。由于其特殊性,传统逆向工具难以解析。分析发现,此类恶意软件通常使用较低的映像基址链接,并通过Visual C++编译。我们已成功重建解密样本供进一步研究。

被折叠的 条评论
为什么被折叠?



