Just another ransomware Locky version spreads via JS file

This article wants to explain a way for malware coders to spread malicious softwares in the wild. And of course the easy way is to convince the victim to run the malicoius code himlsef. No 0day is required, no known vulnerability too.

In these conditions, usually the attack pattern preferred is “Spear Phishing“, consisting in a email containing, not the malware itself, but a dropper, written with a script language (formally just a text file), with the capabilities to download the malware and run it on the target system. In others terms: a JavaScript. Below an example.

The original JavaScript file.

1
The original file

As you know, comments are useless. Just remove it!

Comments removed
Comments removed

Now, take a look at the variable named “XyuHqSR“. It is a multidimensional array, referenced in the malicious code for six times. We can parse it to extract the strings used by the JS file. Just run this code.

5
Parsing the evil string

To obtain the following strings, prepended by the array index.

Decripted strings
Decripted strings

Now, with a bit of “search & replace” and some string concatenations (follow the “+”  character…), the result is a clean file you don’t need to execute in a sandbox to get the behavioural informations.

The clean JavaScript file
The clean JavaScript file

Easy to read now, ins’t it? 🙂

IoC:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.