Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Services
Managed Detection & Response

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

Co-Managed SOC (SIEM)

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

Advisory & Diagnostics

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

Penetration Testing

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

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

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

Digital Forensics & Incident Response

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

Firewall & Technology Management

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

Solutions
BY TOPIC
Microsoft Security
Unlock the full power of Microsoft Security
Offensive Security
Solutions to maximize your security ROI
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

3-in-1 Malware Infection through Spammed JavaScript Attachments

Recently we've observed a massive uptick of malicious spam with JavaScript attachments with an intention to spread and infect Windows systems with variety of malicious executables. The spam usually contains a ZIP file attachment containing only one JavaScript file.

10036_77edfb38-9375-449c-be55-ea329891a405
 

The spam campaign has been ongoing for the past months but last week we've observed a massive huge uptick in our spam traps

An example of the spam campaign claims to be a resume from a fake named sender.

8789_3a35b41a-e3a7-4abb-80a1-7bc213aeb0e5

Extracting the ZIP file contains a file with .JS file extension

9527_5e5e60fd-24ab-466f-9fdb-1879c5bf2ed5

JavaScript De-obfuscation and Analysis

The attached JavaScript file is obfuscated. One of the easiest ways to de-obfuscate this script is to look for the eval() method within the script and replace it with alert() method. The alert() method will display a dialogue box of the de-obfuscated JS string instead of the eval() method that compiles and runs the string. For this particular sample, the eval() method is not called directly in the code and is hidden inside a variable that appears to be a random string.

9799_6d0932dc-078e-4fb7-8bf7-b0eff858acc8

After replacing the variable to alert() method, we will then save the file and run the script by opening it through a browser. If successful, a Message box will popup containing the de-obfuscated JavaScript:

12502_ec5e1c9d-1c98-4c00-b9ad-60af99708009

Cleaning up the code shows a function named "dl" that carries out the download routine using ActiveXObject framework, saving downloaded files to the Windows Temporary folder and then executing them.

9836_6e541027-0972-469d-95b0-90d79b76bc9f

Payloads

The downloaded files have a destructive payload, one of which may result to permanent loss of files. The de-obfuscated URL shows the link pointing to .JPG files; these are actually malicious Windows executables. Once they are downloaded, the files are renamed to .EXE file extension and saved in the Temporary folder. The file named 2.jpg belongs to a Fareit botnet that is designed to steal credentials from FTP clients, web browsers, mail clients and even bitcoin wallets.

10217_7e15e7e1-523b-45d3-acaf-3ec7043df058
The routine where the malware tries to steal user credentials from FireFTP Firefox add-on

 

8044_147b0959-cc1e-43ab-b259-d1b726638fa3
 

Fareit Trojan also attempts to steal bitcoin in the infected system

The stolen credentials are then sent to a list of remote control servers.

12156_dc986c2d-1ed9-4ef5-b84c-f374e76052b0

The other downloaded executable disguised in the URL link as 3.jpg is an Outlook email harvester. The Trojan attempts to harvest Outlook contacts and sends the collected data to the domain name spamhausgandon[.]com.

8121_18e8f59f-f597-4a5b-8841-c10805c168be

The last payload is the file 1.jpg that is actually an executable file of a ransomware otherwise known as a Cryptolocker. The Trojan encrypts targeted files which include Office documents such as .doc, .docx, .xls, .xlsx, .pdf, also of images such as .jpg, .png, .raw, .svg and others

12541_edfe9360-dabc-4541-a0a0-f57dac0d427c

After encrypting the target files, an instruction note in different file format (html or txt or image) is dropped in the victim's computer with instructions on how to pay the operators in exchange for restoring the encrypted files.

7715_057d6b23-d12f-429b-814a-f220311d5de6

Conclusion

Malicious JavaScript is just another method used by the crooks to spread malware, but it is increasing in popularity it seems even with such a small amount of obfuscated code, it is capable of downloading multiple payloads.

Email administrators should consider blocking inbound JavaScript files outright at the gateway. For end users, consider disabling the Windows Script Host (WSH). Instructions for disabling WSH can be found in this link from Microsoft.

Trustwave Secure Email Gateway blocks this malicious spam campaign

ABOUT TRUSTWAVE

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.

Latest Intelligence

Discover how our specialists can tailor a security program to fit the needs of
your organization.

Request a Demo