Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
Get access to immediate incident response assistance.
Get access to immediate incident response assistance.
Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
Most malware sent via emails is packaged in archives such as ZIP, RAR, and 7z (7-Zip). Occasionally, we encounter some clever and creative ways these malicious archives are crafted. Here we will examine an example of an oddly formatted ZIP archive hiding the NanoCore malware.
We spotted a courier themed spam campaign on our Secure Email Gateway (SEG) cloud recently. The message claimed to be from an Export Operation Specialist of USCO Logistics and that it was sent as per their customer request. Aside from this, there were several other suspicious items we noted:
The attachment “SHIPPING_MX00034900_PL_INV_pdf.zip“ makes this message stand out. The ZIP file had a file size significantly greater than that of its uncompressed content. Typically, the size of the ZIP file should be less than the uncompressed content or, in some cases, ZIP files will grow larger than the original files by a reasonable number of bytes.
ZIP archives are supposed to have one “End of Central Directory” (EOCD) signifying the end of the archive. Looking deeper into the structure of “SHIPPING_MX00034900_PL_INV_pdf.zip“, the attachment has two EOCDs. After the first EOCD comes some extra data – another ZIP file structure. It turns out that the first ZIP structure is for the image file “order.jpg” while the second one is for an executable file “SHIPPING_MX00034900_PL_INV_pdf.exe“. Both are compressed when archived, and both indicate that they are the only file in their ZIP structures as indicated in their local file headers and EOCDs respectively.
The image file “order.jpg” contained in the first ZIP structure is actually a non-malicious PNG formatted image file. This serves as a decoy, an attempt to hide the content of the other ZIP structure. The image file has been correctly identified by SEG as a PNG when its file extension is “.jpg” denoting a JPEG formatted image.
The second ZIP structure contains “SHIPPING_MX00034900_PL_INV_pdf.exe“, which is a NanoCore RAT. This remote access trojan has the capability that allows an attacker to completely take control of the compromised machine. It connects to its command and control server at 194.5.98.85 on port 11903. This NanoCore RAT is version 1.2.2.0 which has been found to be offered for free on the Dark Web just a few months ago.
Obviously the attacker is trying to evade scanning gateways with this dual archive trick. But how do various archive utilities handle the unpacking of this sample?
We used different archiving tools such as PowerArchiver 2019, WinZip, WinRar, 7Zip, and Unzip that is built into the Windows OS in attempting to extract the content of the attachment “SHIPPING_MX00034900_PL_INV_pdf.zip”. Among these 5 tools, only WinZip and Windows’ Unzip were not able to extract anything from the ZIP file as they encountered an error at the start of the extraction process. The other archiving tools were able to extract one file from the ZIP attachment – either “order.jpg” or “SHIPPING_MX00034900_PL_INV_pdf.exe”.
WinZip version 11.2 and 24.0, and the built-in Unzip tool in Windows, recognized that the attachment “SHIPPING_MX00034900_PL_INV_pdf.zip“ is an invalid archive. Only WinZip gave an explicit reason – the start of central directory of the ZIP was not found. The central directory it pertained to is the one in the second ZIP structure. At figure 2, the second EOCD indicates that its only central directory is located at file offset 0xd148f whereas it is at 0xd40d41. (The size of the first ZIP structure was not considered.)
Meanwhile, the archiving tools PowerArchiver 2019, WinRar, and 7Zip were able to extract a file from the attachment “SHIPPING_MX00034900_PL_INV_pdf.zip“. Below is the matrix:
The latest versions of PowerArchiver 2019 and WinRar displayed in their respective UI the executable “SHIPPING_MX00034900_PL_INV_pdf.exe” as the only content of the ZIP attachment. No error or warning was prompted during the extraction.
Older versions of 7Zip also behave like PowerArchiver and WinRAR. 7Zip version 9.22 and older saw the executable as well. However, starting from 7Zip version 9.34 (next available installer after version 9.22) up to its latest version 19.0, 7zip saw and was able to extract the image file “order.jpg” instead. The second ZIP structure was treated as extra data; hence, a warning was added to the extracted image file’s properties.
Among the archiving tools we tried, WinRar 3.30 behaved differently and unexpectedly. The content of the ZIP attachment it displayed in its UI was not the one it extracted!
This sample challenges gateways scanners. Depending on the type of decompression engine used, there is a good probability that only the decoy file may be scrutinized and vetted, and the malicious content unnoticed – just like how some of the most popular archiving tools failed to notice the second ZIP structure.
Despite what the gateway does, this attack would only succeed if the message got through the gateway and a particular archive utility is used by the end-user, such as certain versions of PowerArchiver, WinRar, and older 7Zip as described above.
In this case, the Trustwave Secure Email Gateway flagged the message as suspicious and it did not get through. Nevertheless, this case does highlight the types of tricks the bad guys are using in an attempt to deliver malware through email.
SHIPPING_MX00034900_PL_INV_pdf.zip (868,519 bytes)
SHA1: 9474e1517c98d4165300a49612888d16643efbf6
SHIPPING_MX00034900_PL_INV_pdf.exe (1,276,928 bytes)
SHA1: 06b80f9a0fba1d830dcf2ecf225ed1d19060589a
order.jpg (11,247 bytes)
SHA1: 0429b924e7cdbaf9f9b6aec6744eda19e8131d08
Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.
Copyright © 2024 Trustwave Holdings, Inc. All rights reserved.