# IcedID gziploader analysis (Part1) **eln0ty.github.io/malware analysis/IcedID/** 5 minute read ## Introduction March 17, 2022 IcedID, also known as BokBot, was among one of the most active malware families and has been known for loading different types of payloads such as Cobalt Strike. In this report, I’m going to walk through an analysis of a malicious document that distributes and executes an IcedID DLL payload then, the malicious payload itself. Our process divided to 3 stages (Entry stage + 1st stage + 2nd stage) but unfortunately, I can’t get to the second stage because the C2 server is down. Here I will review some of the characteristics of our different stages: Entry stage: Malicious document executes VBA macro to download `IcedID on the disk.` First stage: Loader is executed and download the the real malware (C2 is down in this step) The Second: The malware for which this process was being performed is being executed and this is something that is determined by the server administrator (Cobalt Strike for example). ## Entry Stage **sha256:** `f604ca55de802f334064610d65e23890ab81906cdac3f8a5c7c25126176289c8` I used `olevba to extract the embedded script from the .doc file.` ----- I just want to point out that I used `Exiftool to extract some meta data to understand the script:` -> `Exiftool ` ----- When I opened the document, I found obfuscated content with white color and too small size. So, I griped it and removed all `%1 instances. This is some of code after beautifying:` The main function for the whole script is decoding the 2 strings in the top of HTML code then creates a connection with the server to download IcedID dll Loader. I `cyberchef to get these` strings. Final results: ----- ## First Stage The main purpose of this stage is to drop the payload and it could be a real malware or another dropper. This process depends on the malware developer and what he wants. Let’s start the analysis with our dropped DLL payload. Dropped file is packed. I tried to upload it to [automatic unpacker umpac.me but it doesn’t support x64 binaries. Let’s unpack in manually with](https://www.unpac.me/) **x64dbg.** The unpacking process is really simple. It allocates memory for the unpacked code using ``` VirtualAlloc() . So we just set a breakpoint at VirtualAlloc() and run the debugger twice, ``` then dump the file from memory. ----- ## Decrypt Config The first function that malware performs, it decrypts C2 server and campaign number. Malware uses a pretty simple decryption algorithm. It retrieves the encrypted data from `.data` section then -> `data[0:32] ^ data[64:96]` . I wrote a python script to decrypt the config. ----- ``` import struct #data[0:32] data = [0x55,0x00,0x29,0x36,0x84,0x33,0x8f,0x67,0x5d,0xe1,0x1b,0xc1,0x4e,0xe6,0x17,0xf5,0x2b,0x35,0x #data[64:96] key = [0x16,0x68,0x29,0x53,0xe2,0x5a,0xfd,0x02,0x33,0x88,0x78,0xa0,0x3a,0x94,0x7e,0x97,0x47,0x50,0x res = bytearray() for i in range(32): res.append(data[i] ^ key[i]) print("CampaignID:", struct.unpack(" f604ca55de802f334064610d65e23890ab81906cdac3f8a5c7c25126176289c8 Packed dll -> CFE2CAF566857C05A6A686CA296387C5E1BFDDA6915FF0ED984C1C53CD5192A3 Unpacked dll -> 1A2A8F604B8E4917A7E5A2A8994F748B59CA435C8AABC6D3ED211C696B883BC4 URLs maldonadoposts.com firenicatrible.com Files c:\users\public\youYou.jpg c:\users\%username%\documents\karolYouYou.hta -----