How to bypass Zeus Trojan’s self protection mechanism ~ by Raashid Bhat
Spammers are good when it comes to intimidating users to open the attachment . One of the recent pathetic and cruel one was
Hi
A Person from your office was found dead outside . Please open the picture to see if you know him .
Regards
Attachment is basically a Zip file consisting of an exe file named “image.scr” with a nice mspaint icon .
Quickly opening up in IDA will give us a hint that it is basically a VBpacker. VBPackers usually create a hallow suspended process , overwrite the memory and resume within .
![zoc6xton99mw3w.jpg](https://static.wixstatic.com/media/11c37c_95ae68d08ac24fb4bee3ab7dd538a7e0.jpg/v1/fill/w_890,h_355,al_c,q_80,enc_avif,quality_auto/11c37c_95ae68d08ac24fb4bee3ab7dd538a7e0.jpg)
After successfully unpacking and fixing the dump we get the following output
![dnlvu3hvrwfnw_small.jpg](https://static.wixstatic.com/media/11c37c_21ed88f6e5534df792f90655261af31c.jpg/v1/fill/w_587,h_276,al_c,q_80,enc_avif,quality_auto/11c37c_21ed88f6e5534df792f90655261af31c.jpg)
OEP the unpacked binary is enough to tell us that it is a Zeus Banking Trojan . Well this one is a different version of Zeus with self-protection which means unpacked ones wont run . This is usually done to “force” the bot masters to buy a Cryptor service .
If you double click the binary it will not run , It will simply exit. Now lets see where things are going wrong and how to bypass the protection.
For that purpose we will generate an API call Graph made by the unpacked binary to see the exit point of program .
![s14beqgu1ljwdw.jpg](https://static.wixstatic.com/media/11c37c_f5074d9dae8843f2b0cca48de9b44d4f.jpg/v1/fill/w_637,h_598,al_c,q_85,enc_avif,quality_auto/11c37c_f5074d9dae8843f2b0cca48de9b44d4f.jpg)
![4znhlef7zvzvzq_small.jpg](https://static.wixstatic.com/media/11c37c_cbc23ee90e9544beb48ac228a76d8f3c.jpg/v1/fill/w_391,h_152,al_c,q_80,enc_avif,quality_auto/11c37c_cbc23ee90e9544beb48ac228a76d8f3c.jpg)
So from this we got an idea that it is reading file buffer and performing some operations on it and now lets see what operation it is performing on it .
Now if we dig deeper we find out the file buffer is read and the some cryptography operations are performed .
![36xhidfc9fpytw_small.jpg](https://static.wixstatic.com/media/11c37c_7913d73d58f145dfbb390a44281a36b6.jpg/v1/fill/w_573,h_417,al_c,q_80,enc_avif,quality_auto/11c37c_7913d73d58f145dfbb390a44281a36b6.jpg)
And if go inside CheckSelfProtection() function we will observe that this function will RC4 the whole binary buffer with a static encryption key and will search for placeholder “DAVE”
In my case the RC4 Key was
![izbd5bk1msjmew_small.jpg](https://static.wixstatic.com/media/11c37c_60cdc961727c499587390c9497c2d151.jpg/v1/fill/w_584,h_444,al_c,q_80,enc_avif,quality_auto/11c37c_60cdc961727c499587390c9497c2d151.jpg)
Packer integrity
![8pdyuunvwemoa_small.jpg](https://static.wixstatic.com/media/11c37c_9ceca142596542c493afca498f3808f1.jpg/v1/fill/w_650,h_253,al_c,q_80,enc_avif,quality_auto/11c37c_9ceca142596542c493afca498f3808f1.jpg)
We can copy that 0x200 byte data from the packer into the overlay of our unpacked file. And if found it goes further on verifying the integrity of that data structure and decodes another payload using a 4 byte XOR key taken from that structure.
The Total size of the data Structure is 0x200 bytes and on the basis size, Installer and injector are decrypted . Let now understand the structure of that0x200 Data Structure.
During installation phase iSizeOfPacket bytes are copied from the data chunk into heap . And then later on used to decode installer subroutine using XOR cipher .
![epd3vh9ymokrq.jpg](https://static.wixstatic.com/media/11c37c_4dbde4b204944c1e97e99bfbcf0b87c8.jpg/v1/fill/w_919,h_265,al_c,q_80,enc_avif,quality_auto/11c37c_4dbde4b204944c1e97e99bfbcf0b87c8.jpg)
struct Zeus_packer_overlay
{
DWORD SIGNATURE;
SetBackColor( cRed );
DWORD Crc32HASH;
SetBackColor( cBlue );
WORD iSizeOfPacket;
unsigned int SizeOfDecodedData;
unsigned int Unknown1;
SetBackColor( cRed );
unsigned int XorKey;
}Zeus_Packer_OverLay;