Netskope Threat Research Labs has detected a new strain of the Zepto ransomware shared among cloud users. As has been the trend in recent months, this strain of Zepto arrives at its destination via spam emails that use enticing messages and filenames to encourage the recipient to open the email and download the infected file. These files use an extension of .wsf, which causes Windows to assign an icon that appears similar to a spreadsheet icon. This icon, coupled with a filename of spreadsheet_286..wsf may cause all but the most attentive recipient to view the attachment as legitimate. These messages are then shared among colleagues using cloud SaaS applications such as Microsoft OneDrive, Google Drive, Box, Dropbox, etc.
We have observed sharing and collaboration in cloud apps to represent an often ill-considered secondary propagation vector for malware. Once the spreadsheet_286..wsf file is shared in the cloud, share recipients could easily assume that this “spreadsheet” originated locally and was legitimate, causing the malware to be executed within the protected domain.
Zepto has been observed spreading through “.wsf” (Windows Script File) files within the archive unlike regular JavaScript files. Upon execution, the Windows Script File is executed by Microsoft Windows Script Host which allows mixing the scripting languages JScript and VBScript within a single file. This interlacing of languages permits the attacker to evade detection engines reliant upon emulation of one language.
Netskope Active Threat Protection detected a zip file being shared on Microsoft OneDrive containing a malicious script file with .WSF (Windows Script File) extension. As shown in Figure 1, this WSF file was named spreadsheet_286 with two “.” s in the extension.
Figure 1: Zip attachment with .wsf file insideThe script file starts with <job>tag and is heavily obfuscated. The obfuscated JavaScript code is shown in Figure 2 below:
Figure 2: Obfuscated WSF script code
Once the WSF script is de-obfuscated, the outer layer code looks as shown in Figure 3 below.
Figure 3: De-obfuscated script code
The script is again encoded using string substitution encoding, where strings are split into multiple variables. The above decoded script has many interesting strings being broken into different variables just to make manual analysis more difficult. By looking at the interesting variables with strings like “http” we are able to echo those variables using “WScript.Echo()” to understand behavior of this script. A closer look at the de-obfuscated code reveals some interesting variables as shown in Figure 4 below:
Figure 4: URLs split into different variablesThe URLs are split into different named variables and we can find references to these variables in our script as shown in Figure 5 below:
Figure 5: URL variables concatenated into one variableOnce we echo interesting variables, the script reveals its malicious purpose as shown in Figure 6 & 7 below:
Figure 6: Compromised domains listFigure 7: Temp file name for Zepto
As shown above, the script will download the main payload of Zepto which is in custom encrypted format from any of these 3 compromised domains, decrypt it using code shown in Figure 8 below, performs some validity checks and will save that under %TEMP% folder with name “HRKFnZpT.exe” to execute it later. The DecryptFile code after some string substitutions is shown in Figure 8 below:
Figure 8: DecryptFile code and MZ file Check code