Netskope Threat Research Labs has detected a malicious campaign that uses a ransomware blended attack. A ransomware blended threat package includes malware such as credential stealers, backdoors, or revenue generation malware in addition to a ransomware payload. The purpose is to provide a second means of attack and revenue. Because of this, when remediating a ransomware blended attack, it is no longer adequate to simply wipe and restore an endpoint from backup.
Netskope Threat Research Labs has recently detected an uptick in ransomware blended threats including a variety of payloads. In this analysis, we will detail a case that blended Locky ransomware with the Kovter click-fraud malware.
In the current iteration of this ransomware blended campaign, attackers mated Locky ransomware with a fileless and persistent click-fraud malware called Kovter. This particular campaign was carried out via malicious WSF (Windows Script File) script files embedded in archive file email attachments. As we blogged earlier, cloud services can also deliver Locky ransomware. The campaign uses enticing file names such as “Delivery-Receipt-[NUMBER].zip” or “Undelivered-Parcel-ID-[NUMBER].zip” etc. for archive files and uses double extensions like “.doc.wsf” for file names inside to lure victims into opening and executing script files. The campaign also uses a chain of attacks to deliver its final payloads where the first malicious script downloads other malicious JavaScript code from attacker-controlled domains, where the Locky/Kovter dual head payload resides.
Figure 1. High-level Diagram of Ransomware Blended Attack
To summarize the high-level diagram in Figure 1:
1) Victim receives archive attachment either from SPAM email or cloud services, if forwarded
2) Victim executes malicious script file inside the archive
3) First script executed by the victim then downloads second obfuscated JavaScript from the compromised or attacker-controlled domains, which will be altered and executed by the first script
4) Second JavaScript code then downloads two payloads, one for ransomware and one for click-fraud malware, and executes them one by one
5) Ransomware payload encrypts victims’ important files, displays ransom message, and waits for ransom to be paid
6) Other malware remains hidden inside Windows Registry and executes its code in memory; malware starts click-fraud activities by visiting ad or affiliates websites in background without victim knowing
7) Even if victim pays ransom or restores files from backup, persistent and fileless malware remains on victim’s machine if not detected by security solutions
8) Either way, attackers get paid
Malicious Archive File
One of the malicious files (MD5 – 8EBE75D82F77764ECE51CF1ECE191602 detected by Netskope Threat Protection as JS:Trojan.Downloadr.H) we analyzed contains tiny script, as shown in Figure 2.
Figure 2: Malicious script code using double extensions
The formatted script explaining its operation is shown in Figure 3.
Figure 3: Formatted script for better readability
The script shown in Figure 3 tries to download contents with hard-coded parameters from one of the domains from the domain array. The contents downloaded include secondary malicious JavaScript code. Once it receives an HTTP 200 response from the domain, it replaces occurrences of hard-coded string “9408721” (variable m at line 9) present inside the response code with character “a” using JavaScript split-join method making the second payload dependent on the first script. The packet capture of the response is shown in Figure 4.
Figure 4: Another malicious obfuscated JavaScript code arrives in response
As shown in the above figure, we can see that the response contains multiple occurrences of the string, “9408721.” The full JavaScript is shown in Figure 5.
Figure 5: Obfuscated JavaScript code before it is modified by original script
To deobfuscate this script, we need to replace occurrences of “9408721” with “a.” The result is shown in Figure 6.