The $ucyLocker ransomware

Danus

Level 1
Thread author
Dec 19, 2017
2

Introduction


Ransomware is a type of malware which usually acts as a trojan horse, the user mistakes it for a legitimate file and when he activates the “program, it begins encrypting files on the computer. when the task is completed it demands a ransom, usually in bitcoins.

in most cases you have two options:

  1. pay the ransom

  2. lose your files for ever

surprisingly a lot of people choose to pay the ransom to get their files back, as seen with CryptoLocker back in 2013.
Today we will be reviewing a sample I randomly picked up at Here, a pretty good malware collection.
My Sample


Static review
Opening the file in IDA reveals that this malware is written in .NET
IDA is unable to make this file readable, expose is imports or exports but before moving on to a .NET decompiler I decide to explore the Strings and Names view.

String view seems empty:

VrssaiCy36RX_Lg_7hFT7s2i7f2E0jFtekjS7_JBF4GWd17Sy2aku1xKcUzqis7TTzFUqV90i2L2_pX_mQU_TjIFtDDr8JLLee6kBQMKoSKJnNG29UlvmBoVfbd0MSD2F4t7LeEL


Names:

RDjCDVVbIGjGqe3SJ-WA1P5uRQF5dDocHTI-NQvBthguYIDY4k0d3ZNZfak6DqYjFaU-Ic63-s2vjTK2N8nTAlIymWG18babv3AJaC_davcQR1gT9RQ3n8hZ1n5yUvhxi6cbchgm


The strings raise my suspicious since the program does not seem to hide its intentions.

dJUok2Kp7svSDSZk_N2kwEm_nSgBbaZbAtVf5VTDuQel2LbE08punfGO0V3vqJ27mH-NiPge8oeXfGDFUCVsmsjdvZZg-7v7TnWSR8dcYUZ4QGxYRTMxx2vnzE4Rve9kRclzIZA0


This was enough. I headed to the decompiler, I am using the .NET Reflector for this one how ever it is not free, you should use dotPeek.

The program contains the following structure:

8WZyvq17MWLhHiYo9qd4C8GWOphAsGF57oAgptAkhN8Bu6KWTCrAaz8oxhArTfkI7iP3FIzj9Xgr9G7_wrqO_kMDof6KsTwOXFnTsDeWSd8D71I1ddNLysKb4kMak1y18qGOOC7V


Form 1:
Fields and Methods:

d7TapnzPe8TCv0vtY4CQ1HB3v-nTYIw8c0Aa1WXRN2vV3PCyQbLUWGcBPNKcZRepvb3x6NQrSniXafOgRYb-IVEYEpNUxgQkbFz_8bgFmUtYrdqxUcj_0KR1-icz4O7tZ1zztTan


pprSwlPP4s4LraIKHZVEMfqdAy8fsQw0AVs3ut9ENYThiyzBDB0sEEb1-hS_51k4uqjLKIAPeffY9QNpEb4sIUKweB9FCSK0zjlcaYBHhXwaJSoFY9j0Ku2M9tJ2tYlCy7WAeDcF


Form1 constructor:

I would be curios why he chose to create the constructor like this:

Y6rBWv_Vreq4z9cPAdpNfIzoaf53ERxLWZOTfbM-MbX1IBwQngfBWnqP2NVO1si4MrgQDR7BkmZkagqU0dZNtP9lhQzVKfpBu05QnxvX_QjIafjIt2z1A_rCdO3pnRh9_vhYdeuA



full registry path - “Software\Microsoft\Windows\CurrentVersion\Policies\System"

This constructor disables the task manager and blacks out the wall paper.

AES_Encrypt:

This was the most interesting function, I will expand on it and explain how Symmetric encryption works.
This encryption works with one key, to encrypt a piece of plain text. both of the parties need to know the key.
The AES encryption is an iterative algorithm. which means we will need the following to construct it:

The key - passwordBytes

CipherMode -

ECB (electronic code book) is basically raw cipher. For each block of input, you encrypt the block and get some output. The problem with this transform is that any resident properties of the plaintext might well show up in the ciphertext – possibly not as clearly – that's what blocks and key schedules are supposed to protect againt, but analyzing the patterns you may be able to deduce properties that you otherwise thought were hidden.

CBC mode is short for cipher block chaining. You have an initialization vector which you XOR the first block of plaintext against. You then encrypt that block of plaintext. The next block of plaintext is xor'd against the last encrypted block before you encrypt this block.

IV or Initialization Vector - since the AES is iterative, each encpytion block is dependant on the previous block but the first block does not have a previous block, to solve this problem the IV was born.

Block Size - The plain text will be split into blocks, each in block size. that means that if the block size is 64 bits and the text is 130 bit size then you'll get 3 blocks, two blocks with plain text in size of 64 bits and another block with 2 bits of plain text and another 28 bits of padded bits.

Key Size

You can read all about it here:

ECB OR CBC
What is a block chiper
Why use IV's

Regarding on how AES works, I wont get into it. lets see what happens in the code

JJAWnLxy6KOp2v4i1Fab7EJ1YNVLNzWwXLKhgz9tYM9aIdRACkCu9MQ4yeisoCAJ_7E_eJYdASkkBKbKUP_Evo-hmFQq8cOtJYKOGNRQJl7B5kviR6xMiXhhf6XUvgYioHisLRDp


First the function accepts two parameters, the bytes we will encrypt and the key.
It creates a salt.

We can see also that it creates a random generated key and a IV using the DeriveBytes class.
“Rfc2898DeriveBytes is an implementation of PBKDF2. What it does is repeatedly hash the user password along with the salt.” the third parameter is the number of iterations.

The GetBytes function returns the pseudo-random key for this object.

So the key and the IV are fully randomized based on the size of the key and the block size.

Finishing it up with setting the chiper to CBC mode since AES is CBC.

So as we can see, this is not just AES encryption, first we use one key to generate a key. from that key we generate two more keys(Key for AES and the IV), then and only then we encrypt bytesToBeEncrypted.

the function translates the stream to a byte buffer and returns it .

Keep in mind, this is not complex. With a proper crypter this lame ass .NET program can bypass most AV detection.

EncryptFile:
s_hQqGKIjdG_PZuLDUG3a7RAHRINsZv0QqZMYCGeoh-f8p_aQZMn16FfPHcyfFR1XGYJaTiKDe8gVNT2yIPnoVPaHC7VW2hMYVftgCmfz7URl3cXib5P_LcQ__5sMEvRVfn2qUep


The function accepts a string file, probably the path. then it generates another another pass key, hashes it and encrypts it with the AES_Encrypt. it changes the file extension and overwrites it.

Message Creator:

Ubs2UGMPQRkqe6QVhDYDr5a3TzHQHKoRLqPyUZffmzuFLTFc35dviFA88n3KHuvsYxQUL7zJwDhnzT8mxigPAUPDNuf1CeTMneVrdQUVKDQplxxofRMSrfeDnixaUr9qbRe8ndRZ


The message creator drops a readme file onto the desktop upon function call

CreatePassword:

QRfo90ue4AqRprLnP6A-rQW8Ys4QU0gSdWwj-HIH4dh-LqSmEBC2pPddZOZXU71ap3U-nh5eDTDkx8Qw0ugmeDylHeswQxKLJsPUPbsTlPQMWuTEMeprBbca5v6ZU-Z8Jxcftpey


Basically, a random password generator.

SendPassword:
CR_6DmEJl2enh7cjrvqoAqg1BET-Hfd84wXnKZwYP_T9fWi0IUs14w544VF66562Btiyssm4zXpcVLYwU8fIGqksJBXMcLh75dJFCJpXPv5Iuf0CqDH9S5ad0_CiSsDQitu5UbM9


I am confused for what this function is doing seems like nothing, more on the dynamic analysis.

EncryptDirectory:
QNba3SEeXZM5y_GddCGEFZuw5mS2KpMXSdUGNz3cg-NcP2LAYzWGtqSERFsA2WzjnOS4BuX0u0HqxoyHiJD354jE4z4J83uAnWBEEhKSotD4aLU1fUkRgCQE39JvXRjpTpk8lkDL


Encrypts all the files in the directory, it gets all the extensions to the files in the directory and if the current file has one of the extensions the malware is looking for, it encrypts the file.

The main functionality:

y52W-UziR51bS3ScuO1REMqyWJqQtrwy9jMLsSfpztS6nIvGH31BGYO8hM72vz7MW8vBz2d9ZKeiGCCHBW-quRKQDUBW0ONVAa9bOiC0_wnWJ4yAUW0vtG6Nh-U_t9UbpZC7lhU7


It seems the malware is only encrypting files on the desktop, since it is hard coded as a function parameter.

The rest of the forms don't have anything special, except from this :
BD9zqRYh_T5fODF8qUEFu7Wkj9DGaSZ7RNWQ4FVYYVtw8nMWCAPVZQOkAy2zPmFPJsnUHayklN-gUFcejX60xNoPACz4yFdq7eAGVdQpzSRQuTIuHdU9emkfaPVR7nehpOOIPwMI


Found on form3, this is very worrying. I also did not see any decryption methods that could be triggered.

Static Conclusion:

The malware generates a new password, or a key. then it uses that key to encrypt all the files on the directory which is the desktop in this malware’s case. when this task is completed it drops a readme file and pops up a window with payment options and warning options.

Dynamic Review:

Running Process explorer and Process monitor, I filtered unrelated process events out of the program.

The program indeed, dropped a read_it file and encrypted only the files located on the desktop and disabled the task manager.

Attempt to black out the wallpaper as seen in Process Monitor:

4rBO4viqw0FLDzbXYbEVI1XtzhNEQ0HeFDeyS2VZcInIINtI80tRBmiiO8WbJv0UH10sO3B2t6R5sSxoc3UddeNRK-D1RqWNbBG7yLAOkmTnJFgJBTvLZxl8og5hQpWVVjY2u7_H


Disable Task Manager:

JBRe7EpRLRSpMGOZopGeV80i9IT1ST9Mz2ffeAj96I4EgIIHLHdNUvzZe3tHYaAnQ3YlDWndVDbwmr2u1dh4_3toz8juaWQ6u1WHlDHq6h5iV3mGfhwzmMhbmsSLkR6p9CvKPE9x


Drop READ_IT file:

pHUg9ZPRU7MYouimAuhfpfeO25Bct1ugPHe5HwK5d89a1JqdllefH9v1gRB2B6D9AjNMvKWd_rcaj625RhsUHOofKVymyxpG4wvHq4vYsFg49zjA7cBG3X69BQUecNNVtKl2a1IJ


ibJdyMeP25cGM9RqgBDVCsOKSWeJj-ByimKJYtKLfmUSapdxyGUbnOuLcz22MbqovgzXdFEgNY0w1qpvARiePoClx7Cb5hBpC7E8saT7DqdoQOMpldKjMjPVUPP0RwLMHJN5PKQX


But it's easy to revert most of its effects.

The desktop has not been changed, and we simply need to remove the registry key that I showed above to restore the Task Manager operations.

The program has suspected made no contact with any server or IP if your files are encrypted with this program you cannot revert the files back, EVER.

When you click that you paid for the decryption the program prompts this message:

fMH8CpNdJhLdXyQmS3GP8eJCajMD9ZW0iiHJgwZCI7jYlsI02PmT1QYQAiRPfvgSy107lutAhFxR6bb6QOZpUjT04viXj2H0lME0SH_08oyqeultNJceV2YiJG6vdw0hkiwYSqj7


Clicking “OK” will always result in the following message as seen in the code:

Dr4fJxUr5JKspN05SsyjY3vYCCAKRO4fmTspbZhRN2lYhExByqqYfYuLY1OxVD8kqKtk5vf5zdIdsPc7RSuOmuPXrnBmCOiO15YqMYkzbwCRjE0PzNoWjLI6yaBH5jCdUJNzHpdt


But the money will not be refunded as there are no other function triggers to this button click as seen in the code

The program adds the .WINDOWS extension to all files it encrypts on the desktop (It only encrypts files on the desktop), removing that extension back to the original one will show a messed up file.

NbmlSZO6mqGJDo248HEyt_mVK3_yZb3DMd1W41LlN2zNQTCLqgv9EEaNgIM6IwV6ALYVnGJB7hwyrZcAh_4_6V2esyQWWIYyPrIMg-Uj972k9QaVKF-cFbevxL4UuoKBhdcyvy8W


Conclusion:

This program is dangerous, but not the most dangerous. you can't run it unless you have the correct version of .NET installed on your computer.

It only encrypts files on the desktop and not to mention that it does not encrypt all file extensions.

It does disable the task manager and attempts to change the desktop background but you can revert those effects back.

The only thing that you won't get back is your files.

This example shows how easy it is to construct ransomware, how easy it is to steal money and even in 2017 (this sample was caught in june 2017) people still download and double click on files called “VapeHacksLoader” and run them.

Be careful out there

This is my first malware analysis report :) any feedback would be welcome!
 

Danus

Level 1
Thread author
Dec 19, 2017
2
I am seeing that not all pictures are displayed properly and I am unable to change them.
I'm posting a link to the google drive version of the file for people that are interested

Google version
 

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top