SpiderLabs Blog

Yet Another Archive Format Smuggling Malware

Written by Diana Lopera | Jun 24, 2021 7:39:00 AM

The use of novel disk image files to encapsulate malware distributed via spam has been a theme that we have highlighted over the past couple of years. As anticipated, we have seen more disk image file formats being used, in addition to .ISO, .IMG, and .DAA which we blogged about.

We recently spotted another file format being used. These spams, spoofing courier companies, contain a malicious WIM (Windows Imaging Format) file disguised as an invoice or consignment note. WIM is a file-based disk image format developed by Microsoft. The file format serves to deploy Windows software components and updates ever since Windows Vista. This format uses a ".wim" extension and its content can be extracted using archiving tools like 7Zip, PowerISO, and PeaZip. Below are some samples from this campaign.

Figure 1: A DHL spam containing a fake invoice attachment
 
Figure 2: A DHL spam containing multiple malicious attachments disguised as consignment documents
 
Figure 3: A spam spoofing AlphaTrans containing a fake invoice attachment

 

The attachments, although they have a ‘.wim.001’ file extension which denotes that they are the first part of a larger WIM file, have the complete file structure of a WIM file. Using the ImageX tool, we verified that all the WIM attachments we collected are not compressed and have one file only.

Figure 4: The information about the WIM attached in Fig. 1 using the tool ImageX
 

 

Opening the WIM files in a hex editor, its immediately noticeable that an executable file is hiding in them. Using the archiving tool 7Zip as displayed in Fig. 3, the EXE file bearing the same name as its WIM container can be extracted.

Figure 5: The WIM attachment shown in Fig. 1 viewed using the tool Hiew
 

 

All the WIM files we gathered from our samples contain Agent Tesla malware. This threat is a Remote Access Trojan (RAT) written in .Net which can take full control over a compromised system and can exfiltrate data via HTTP, SMTP, FTP, and Telegram. In 2020, Agent Tesla was one of the predominant RATs and early this year, we reported that this malware is still actively getting distributed in spam emails.

Figure 6: The SMTP process of the Agent Tesla malware contained in Fig. 5 using DNSpy

 

 
Figure 7: The Agent Tesla malware extracted from the spam seen in this blog
 

 

Summary

Encapsulating malware in an unusual archive file format is one of the common ways to bypass gateways and scanners. However, this strategy also poses a hurdle – the target system must recognize the file type or at least have a tool which can unpack and process the file. In contrast to the more popular .IMG and .ISO disk image files, WIM files are not supported by Windows built-in ability to mount disk image files. Moreover, the other popular archive utilities WinRAR and WinZip do not recognize the WIM disk image. WIM files can be processed with the widely used 7Zip.

In terms of suspiciousness, an inbound email containing a WIM file is not usual and should raise a few flags. Administrators could look to block these outright. Trustwave MailMarshal detects these threats bundled inside unusual disk imaging containers using a combination of its unpacking engine and its multi-layered threat detection technology.

IOC

WIM Files:
DHL Airway 3426983794.wim.001 (782102 bytes)    SHA1: 91E3FE9AF48482484A4AAC9573D1FB13CB428738
Invoice_for_part_shipped(Feb 19,2021).wim.001 (634678 bytes)    SHA1: D37C13A36A92114A927860B7021EB0C71BE73FBF
Monthly Statement.wim.001 (747278 bytes)    SHA1: 2498342105E1C196C73960654E751D441925ED5C

Agent Tesla:
DHL Airway 3426983793.exe (780800 bytes)    SHA1: 62FC617343B3D823362C8D9EA89AA676F79CE972
DHL Airway 3426983794.exe (780800 bytes)    SHA1: 62FC617343B3D823362C8D9EA89AA676F79CE972
Invoice_for_part_shipped(Feb 19,2021).exe (633344 bytes)    SHA1: F02FAFB08125D877584F73D5077DFCA95D66318C
Monthly Statement.exe (745984 bytes)     SHA1: 236D1F71EB2EFA0C24E7EBA4390FEFE3691F1C68

Other:
DHL Airway 3426983793.tar.001 (782336 bytes)    SHA1: E31107CCE2AA0DCF8B8C064EFEACAD5508C69D29