Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Double Loaded Zip File Delivers Nanocore

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.

The Spam

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:

  • Headers mismatched: The Reply-To and From email address were different. Furthermore, the email address used in Reply-To is from a free email client Gmail.
  • Suspicious message body: The attachment was mentioned in the message body twice, making sure to direct the reader’s attention towards the attachment.
  • Suspicious attachment name: The name of attachment “SHIPPING_MX00034900_PL_INV_pdf.zip” ends with “pdf.zip”. That usually means that the name of the file inside the archive ends with 2 known file extensions “pdf.<extension>” (archiving tools usually defaults the <extension> to the archive’s format e.g. zip)
Email sample
Figure 1: Trustwave Security Email Gateway (SEG) console displaying the spam containing NanoCore RAT

The Attachment

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_attachment
Figure 2: The attachment “SHIPPING_MX00034900_PL_INV_pdf.zip“

 

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 Decoy

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 NanoCore RAT

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.

Process flow
Figure 3: Process flow of the NanoCore RAT
 
Memory dump
Figure 4: Memory dump of NanoCore RAT captured from the last process in figure 3

 

The ZIP Content as viewed by different Archiving Tools

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.)

WinZip 11.2 error prompt
Figure 5: WinZip 11.2 error prompt and the snippet of the 2nd ZIP structure’s central directory and EOCD
 
 Unzip
Figure 6: Windows’ Unzip prompted an error that the attachment in this spam is invalid

 

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 ZIP content as per the archiving tools

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.

PowerArchiver2019 extracted the executable
Figure 7: Process monitor tool displaying the PowerArchiver 2019 executable extracting “SHIPPING_MX00034900_PL_INV_pdf.exe”

 

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.

7Zip extracted the image file
Figure 8: 7Zip version 19.0 extracted “order.jpg” from the ZIP attachment and a warning has been made. The Tail Size from the image’s properties is the size of the second ZIP structure.

 

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!

WinRar 3.30
Figure 9: WinRar version 3.30 displays in its UI “order.jpg” as the sole content of the ZIP attachment. However, it extracts “SHIPPING_MX00034900_PL_INV_pdf.exe”

 

Summary

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.

IOC

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

Latest SpiderLabs Blogs

Ukrainian Intelligence Claims Successful Compromise of the Russian Ministry of Defense

On March 4, 2024, the Telegram channel of the Main Directorate of Intelligence of the Ministry of Defense of Ukraine (GUR) was updated with assertions that they executed a successful cyberattack...

Read More

Cost Management Tips for Cyber Admins

As anyone who has filled out an expense report can tell you, cost management is everyone's responsibility. Organizations must apply a careful balance of budget planning and expenditures that are in...

Read More

Resurgence of BlackCat Ransomware

Updated March 8: Based on our experience, we believe that BlackCat's claim of shutting down due to law enforcement pressure is a hoax. We anticipate their return under a new guise or brand after...

Read More