PetrWrap Based on Petya Ransomware Attacks Organizations

PetrWrap Based on Petya Ransomware Attacks Organizations

Kaspersky Lab researchers have discovered a new ransomware family deployed in targeted attacks against organizations. There are a couple of interesting things about this operation the payload of which is a slightly different Petya ransomware the researchers dubbed PetrWrap.

Threat Summary

Short DescriptionAccording to Kaspersky, PetrWrap is written in C and compiled in MS Visual Studio. It contains a sample of Petya v3 ransomware which is the payload of the operation.
Symptoms Victim’s files are encrypted. The criminals used their own private and public keys.
Distribution MethodOrganizations have been victimized in targeted attacks.
Detection Tool See If Your System Has Been Affected by PetrWrap


Malware Removal Tool

Data Recovery ToolWindows Data Recovery by Stellar Phoenix Notice! This product scans your drive sectors to recover lost files and it may not recover 100% of the encrypted files, but only few of them, depending on the situation and whether or not you have reformatted your drive.
User ExperienceJoin Our Forum to Discuss PetrWrap.

Update June 2017! Learn more about the latest variant of Petya ransomware – Petya.A/ WannaCry – known to use the EternalBlue exploit deployed in the WannaCry outbreak. This new variant is currently active so be sure to inform yourself about its specifics.

Once in an organization’s network, the attackers used the PsExec tool to install the ransomware payload – on all endpoints and servers. But it’s not your typical Petya RaaS payload. PetrWrap has a special module that “patches the original Petya ransomware on the fly”.

Related: Mischa Ransomware Bonds with Petya Ransomware

PetrWrap Ransomware: Technical Overview

Kaspersky’s report indicates that the ransomware is written in C and compiled in MS Visual Studio. It contains a sample of Petya v3 ransomware which is the payload of the whole operation.

PetrWrap uses its own cryptographic routines and alters the code of Petya on runtime. This is done so that the execution is controlled and Petya is concealed during the infection process.

After being launched PetrWrap delays its execution (sleeps for 5400 seconds = 1.5 hours). Then it decrypts the main DLL of Petya from its data section and gets ready to call its exported function ZuWQdweafdsg345312. This function normally prepares Petya for further operations and starts the MBR overwrite process. PetrWrap, however, needs to hook a couple of Petya’s functions first, so it replaces the instructions that call Petya’s DllEntryPoint with NOPs (hex bytes 0x90). This prevents Petya from proceeding on its own and allows PetrWrap to make all the necessary computations and preparations before letting it continue.

PetrWrap Cryptography

In a normal Petya ransomware infection the ransomware would deploy a 16-byte key and the Salsa20 cipher to encrypt the MFT of the NTFS partitions on local drives. In the case of PetrWrap, the criminals used their own private and public keys. As a result, the ransomware uses the following cryptographic routines, as explained by Kaspersky’s researchers:

  • PetrWrap contains an embedded public key master_pub;
  • Upon each individual infection, the ransomware generates a new pair of session keys ec_session_priv + ec_session_pub;
  • The ransomware computes ecdh_shared_digest = SHA512(ECDH(master_pub, ec_session_priv));
  • Then it ‘Intercepts’ the salsa key generated by Petya and encrypts it using ecdh_shared_digest;
  • Then it constructs user_id, a string representation that contains the encrypted salsa key and the ec_session_pub;
  • Finally, it passes this user_id to Petya, which uses it as if it was its own data.

In a nutshell, PetrWrap accomplishes the following list of activities:

1. The victim’s machine is locked and the MFT of NTFS partitions is encrypted securely (because Petya v3 which is used in this attack doesn’t have flaws of the earlier versions and implements Salsa20 correctly);
2. The lockscreen doesn’t show the flashing skull animation and doesn’t contain any mentions of Petya which makes it harder to assess the situation and determine the extent of the caused damage;
3. The developers of PetrWrap didn’t have to write the low-level bootloader code and risk making mistakes similar to the ones observed in earlier versions of Petya.

PetrWrap Decryption

Unfortunately, the strong encryption used by PetrWrap gets in the way of encryption. As Kaspersky researchers put it, “a decryption key is out of the question”. Victims of the ransomware are currently organizations but individuals may also be targeted. Ransomware is known to know no boundaries. If you have been victimized by PetrWrap, you could try and restore your files with third-party solutions but there is no guarantee they could work.

In the future, always remember to keep your system protected and your data properly backed up.


Malware Removal Tool

Spy Hunter scanner will only detect the threat. If you want the threat to be automatically removed, you need to purchase the full version of the anti-malware tool.Find Out More About SpyHunter Anti-Malware Tool / How to Uninstall SpyHunter


Milena Dimitrova

An inspired writer and content manager who has been with SensorsTechForum for 4 years. Enjoys ‘Mr. Robot’ and fears ‘1984’. Focused on user privacy and malware development, she strongly believes in a world where cybersecurity plays a central role. If common sense makes no sense, she will be there to take notes. Those notes may later turn into articles! Follow Milena @Milenyim

More Posts

Follow Me:

Leave a Comment

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

Time limit is exhausted. Please reload CAPTCHA.

Share on Facebook Share
Share on Twitter Tweet
Share on Google Plus Share
Share on Linkedin Share
Share on Digg Share
Share on Reddit Share
Share on Stumbleupon Share