Hey you,
BE IN THE KNOW!

35,000 ransomware infections per month and you still believe you are protected?

Sign up to receive:

  • alerts
  • news
  • free how-to-remove guides

of the newest online threats - directly to your inbox:


.WNCRY .WCRY Virus – Try to Decrypt Files (Update May 2017)

Update May 2017! This article aims to provide instructions on different methods on how to try and restore .WNCRY files encrypted by the second version of the WannaCry ransomware also known as Wana Decrypt0r 2.0, WanaCrypt0r 2.0 and WCry.

“EternalBlue” and “DoublePulsare” are the names of the exploits used by the organization spreading the .WNCRY file infection and what is worse is that they were leaked online somewhere around the Easter holidays by a hacking entity known as “The Shadow Brokers”. This exploit is primarily addressing issues in Windows systems so anyone who is still not infected with this virus is strongly advised to back up your system and then update it.

In case you have become a victim of this ransomware virus, we have created several methods that might prove to be useful in helping you recover your files. The methods are not guaranteed to work, but they are surely the closest you can get to restoring your files, so we advise you to follow them and ask us any questions on our Support Topic about WannaCry ransomware.

Update May 2017: Malware researchers are in progress of developing a decrypter for the WannaCry 2.0 ransomware virus. We have created decryption instructions which we will update as they progress on the development. So far there is a method to locate the private RSA keys. For more information, please follow the related article below:

Related:Wana Decrypt0r 2.0 – Decrypt Encrypted Files

Method 1: Use Wireshark To Sniff Decryption Keys

It is very difficult to stay ahead of ransomware, like WannaCry, but despite all, we have decided to show you how to use Wireshark to your benefit and hopefully intercept HTTP traffic in the correct moment. However, bear in mind that these instructions are THEORETICAL, and there are a lot of factors that may prevent them from working in an actual situation. Still, it is better than not trying before paying the ransom, right?

Before downloading and using Wireshark – one of the most widely used network sniffers out there, you should have the malware’s executable on standby and infect your computer once again. However, bear in mind that some ransomware viruses perform new encryption every time a computer is restarted as well, so you should also configure Wireshark to run automatically on startup. Let’s begin!

Step 1: Download Wireshark on your computer by clicking on the following buttons( for your version of Windows)

Download

Wireshark

Step 2: Run, configure and learn how to sniff packets with Wireshark. To learn how to start analyzing packets and check where your packets save the data, you should open Wireshark first and then choose your active network interface for analyzing packets. For most users, that would be the interface with traffic bouncing up and down on it’s right. You should choose it and click twice fast to start sniffing:

1-decrypt-files-wireshark-sensorstechforum

Step 3: Sniffing packets. Since ransomware viruses communicate via HTTP traffic, you should filter all the packets first. Here is how the packets look initially after you choose your interface and sniff traffic from it:

2-ransomware-decryption-keys-mixed-sensorstechforum

To intercept only HTTP traffic, you should type the following into the display filter bar:

http.request – to intercept the requested traffic

Once filtered it should look like this:

http-traffic-sensorstechforum-filtered

You can also filter the source and destination IP addresses by scrolling up and down and choosing one address, then right clicking on it and navigating to the following feature:

filter-host-dest-sensorstechforum

Step 4: Configure Wireshark to run automatically. To do this, first, you should go to the command prompt of your computer by typing cmd on your Windows search and running it. From there, type the following command with capital “-D” setting to get the unique key for your interface. The keys should look like the following:

wireshark-keys-sensorstechforum

Step 5: Copy the key for your active connection and create a New Text Document and in it write the following code:

→ wireshark -i 13MD2812-7212-3F21-4723-923F9G239F823(<= Your copied key) –k

You can additionally modify the command by adding the –w letter and creating a name for the file that will save it onto your computer, allowing you to analyze the packets. The result should look similarly to this one:

wireshark-sensorstechforum-text-file

Step 6: Save the newly created text document as a .bat file, by going to File>Save As… and choosing All Files after which typing .BAT as a file extension, like the picture below shows. Make sure the name of the file and the location where you save it are easy to find:

sensorstechforum-pic-wireshark-save-as-all-files

Step 7: Paste the .bat file in the Windows startup folder. The original location of the folder is:

→ C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup,/p>

To easily access it, press Windows Button + R key combination and in the Window box type – shell:startup, like the picture below shows and click OK:

shell-startup-bat-file-sensorstechforum
wireshark-startup-sensorstechforum

After your computer is restarted, if the ransomware virus encrypts your files after which generates a key and sends it to the cyber-criminals’ servers, you should be able to intercept the communication packets and analyze them.

Step 8: How to analyze the traffic?

To analyze the traffic of a given packet, simply right-click it and then click on the following to intercept the traffic:

intercept-traffic-sensorstechforum-ransomware

After doing this, a Window will appear with the information. Make sure to inspect the information carefully and look for keywords that give away the encryption keys, like encrypted, RSA, AES, etc. Take your time and check the packets’ size, make sure that they are similar to the size of a key file.

intercept-stream-sensorstechforum-intercepted

Method 2: Using Python in Ubuntu

The second method by which you may want to try and recover your files is also not guaranteed to work, but you may succeed in the event that this WannaCry ransomware variant is using the RSA (Rivest-Shamir-Adleman) encryption to generate unique keys for the files. The factorization script was originally designed for CryptoWall ransomware, but it may be useful for this infection as well. Either way, we urge you to be careful and create copies of the encrypted files when following the instructions below:

For this particular tutorial, we have used extension files from another virus, called Bitcrypt. We have also used Ubuntu version 14.04 which assisted us in using special software appropriate for this distribution. You can get it from their website’s download page and you can either:

  • Install it along with your operating system by booting a live USB drive.
  • Install it on a virtual drive (Recommended).

Here we have brief tutorials for both:

Installation of Ubuntu on your machine:

Step1: Get a USB flash drive that has above 2GB of space.

Step2: Download the free software, called Rufus from here and install it on your windows.

Step3: Configure Rufus by choosing NTFS as a system and selecting the USB drive as the one to be created as a bootable USB. After that boot the Linux image from the following button:

rufus

Make sure you locate it and select it from where you downloaded it.

Step4: After the flash drive is ready, restart your computer, and it should run the Ubuntu installation. If it does not, you should go to the BIOS menu by pressing the BIOS hotkey on startup for your PC (Usually it is F1) and from there select the first boot option to be the USB bootable drive or CD/DVD in case you have burnt Ubuntu on such.

Installation Of Ubuntu on your Virtual Drive

For this installation, you need to download VMware Workstation from their download page or any other Virtual Drive Management program. After installed you should:

Step1: Create a new virtual drive.

Step2: Set the drive size. Make sure you have a minimum of 20 gigabytes of free space fro Ubuntu on your computer. Also choose ‘Run as a single drive’.

Step 3: Select the ISO image. For this option, you should know where it is.

Step 4: After that play the Virtual Machine and it will install automatically.

File Decryption

Once you have Ubuntu or any other Linux distribution on your computer open the terminal by doing the following:

Open-terminal

Then update your Linux and install greater version than Python 3.2 by typing the following in the terminal:

→sudo apt-get update
sudo apt-get install python3.2

Also, if your Linux does not have sqlite3 module, install it by typing:

→sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby

Now after we have Python installed, we need to download a script created by 2014 Airbus Defence and Space Cybersecurity. To do this click on this link. Download the file in your ‘Home’ folder after it prompts you where to save it. Keep this as decrypt.py in case it is not saved in this format.

Now that we have Python and the script, it is time to find out the key of the .bytrcypt encrypted file. To do this move your encrypted files ot the home folder by using the file manager:

File-manager

After you located all of the encrypted files there along with the “decrypt.py” file type the following into the terminal to initiate the script:

→python ./decrypt.py “Your_Encrypted_Document_Name_and_Format”

It will show an error, and this is entirely normal as long as you see this code:

code

This is the RSA code for this file. Now, we need to decrypt it, and we are halfway there. To do this download a program called cado-nfs2.0.tar.gz from their download page here. We recommend the 2.0 version. However, the newest version is also on a good level.

It will download a .tar archive file (.tar files are very similar to .rar or .zip files). Simply open it and click on the Extract button on top and choose the ‘Home’ folder. It should look like this:

Extract

After the we have all the files extracted in the ‘Home’ folder, we need to compile cado-nfs. To do this, open another terminal and type:

→cd cado-nfs-2.0
make

After this is set, it is time to run the key cracker. Important – this process can take from several hours to days to be finished. To begin the process type in your cd cado-nfs terminal:

→./factor.sh YOUR_UNIQUE_KEY_WHICH_IS_LETTERS_OR_NUMBERS_HERE -s 4 -t 6

After the process completes, you should see the following:

→Info:Complete Factorization: Total cpu/real-time for everything: hhhh/dddd
LongNumber1 LongNumber2

After we have the decrypted key, we need to insert in the “decrypt.py” script. Do this by opening decrypt.py in a text editor and finding this part of it:

→known_keys = { many long numbers }

We need to add before the second bracket (“}”) these lines:

The Previous Key, a column, opened parenthesis, LongNumber1, Comma, LongNumber2, closed parenthesis. It should look like this:

→The Previous Key:(LongNumber1,LongNumber2)

Be advised that you should do this only one time. After this it is time to decode the files. To do this type:

→python ./decrypt.py “Your_Encrypted_Document.docx.bitcrypt”

Executing this command will make a file that is called “Your_Encrypted_Document.docx.bitcrypt.CLEAR”

Just rename the file by removing the .clear extension and you should be all set. Repeat the process for your other files as well. But remember that first you should find out their initial keys to decrypt them. You should be able to open them now. We hope this works for you.

Method 3: Using .VHD File Types and Data Recovery Software

This method is likely to bring back the most files of the methods illustrated above, purely because it does not seek a direct solution to decrypt the encrypted files which is impossible if you do not have the keys. Instead it uses different algorithms to recover the files, treating them as if they are deleted. One of the many algorithms used by different data recovery programs is known to be based on branch predictors.

The reason we decided to bring up this method is that many victims of recent ransomware outbreak of Dharma ransomware, another undecryptable virus, were actually able to restore over 90% of their files using this method.

Its primary core competence is that it takes advantage by converting the files into a .VHD file type which is basically a virtual drive partition on your PC. So it treats your encrypted file as a partition. Then, this drive can be booted and you can try to scan the partition itself using data recovery software. The method may not be 100% guarantee, but some users have reported it to be most successful of the ones above. Here are the instructions for it:

Step 1: Make sure to make copies of the .onion encrypted files on another drive or PC:

Step 2: After creating the copies, download a tool that converts files in .VHD format. One good tool is Microsoft’s VHD conversion software. You can download it, by clicking on the button below:


Download

VHDTOOL


Step 3: Now, make sure to rename a file that you want to recover in the .VHD file extension. For example, if the file is test.onion, it should be test.vhd

Step 4: Now you need to run the VHDTOOL you previously downloaded from Windows Command Prompt. To do this, run Windows Command Prompt as an administrator by typing “cmd” in Windows Search and right-clicking after which choosing “Run as administrator”.

Then type the following commands exactly as it they are:

→ cd {The location of the file, for example C:\Users\Lenovo\Desktop}
vhdtool.exe /convert “{the location of your file and the name goes here}

The final result should look like the following image:

Step 5: After you convert the drive into VHD, make sure to mount it on your computer. To do this:

Right-click on My Computer or This PC and then click on “Manage”

Then right-click on Disk Management after which click on Attach VHD

Then click on the Browse button in order to locate and open the .vhd file

After this, to initialize the disk, right-click on it and click New Simple Volume. After this click on Next and set it up:

At the end, the volume should appear like the following:

Step 6: Download and recover the .VHD image using data recovery software. The data recovery software you should download has to support the option “Partition Recovery”. Here is a comprehensive list of multiple data recovery programs that are able to recover partitions:

IMPORTANT! If you fail to boot the file as a partition, you can also do a direct scan with the data recovery software to see if it will find any of your files this way.

Wana Decrypt0r 2.0 Conclusion and Removal

Whatever the case may be, we will keep looking into this virus and update with any new instructions that are available for it. Keep following our blog posts, Twitter and Google Plus for new updates on this threat. Also, make sure to remove this virus in case you have tried the methods above to restore files encrypted by it. You can do this by checking out our instructional video on how to remove WannaCry. They also include some additional methods for file restoration. Bear in mind that these are not direct solutions to the issue and this is why we advise you to try all of the methods illustrated in this article and video at your own risk.

For most effective removal, malware researchers strongly advise victims to use an advanced anti-malware software. It will make sure that the Wana Decrypt0r 2.0 threat is completely removed and all the damage done by it is reverted. Installing such software on your computer greatly increases the real-time protection against such threats in the future.


It is highly recommended to run a scan before purchasing the full version of the software to make sure that the current version of the malware can be detected by SpyHunter.

Vencislav Krustev

A network administrator and malware researcher at SensorsTechForum with passion for discovery of new shifts and innovations in cyber security. Strong believer in basic education of every user towards online safety.

More Posts - Website

  • Idris Ezzy

    Sinffer won’t help if the malware is using asymmetric keys for Encrypt/Decrypt.

  • Andres Gonzalez

    first, u need to place your prompt on the files container folder, second… i don’t mind if commas are really needed.
    share your experience!

  • basically, to activate python you need to place the software and the
    programs in the Home folder if you are about to type the command this
    way : )

  • also, i’ll have you know that the script in this article was originally designed for other viruses using the same RSA combination, meaning the decrypt.py script is designed for RSA only. Then this key can be used to try and decrypt the AES files somehow. If you get the key, please respond back and we will try to assist the best way we can.

    PS: Google .decrypt.py scripts for python for decryption, there are a lot of scripts for different RSA strenghts. The RSA encryption used by this virus is in 2048 bit strenght which is unfortunately, the strongest stable 🙁

  • belette

    Hi
    Thanks your article is excellent!
    I have tried to reproduce the Method 1 of your article but unfortunately I have only the encryption piece of the ransom or a variant. Would you mind to share it in some way I can test it? (I dont know how/where to contact you so I am posting here..) many thanks

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.