eSentire has been closely monitoring the Petya/NotPetya malware outbreak this week. Our threat lab has learned more about the behaviors and propagation methods used by this variant. While latest research suggests that this attack may be the result of a geo-political agenda (targeting Ukraine), indications suggest that activity and spread is winding down.

Read on for a summary of the latest from the eSentire Threat Intelligence lab:


How does the malware spread itself?

There are at least three mechanisms by which the malware is known to spread from one machine to another.  The first involves the ETERNALBLUE and ETERNALROMANCE SMB exploits from the Shadow Brokers dump of alleged NSA hacking tools.  When the Wannacry worm was released into the wild in May 2017, the ETERNALBLUE exploit allowed it to spread like wildfire due to many organizations not having applied the MS17-010 patch that Microsoft had released a couple of months earlier.  It was probably less effective this time around, as many organizations would have deployed the patches by now.  Nevertheless, it remains a potent infection vector on networks containing out-of-date (unpatched) Windows hosts.

The other two mechanisms are more interesting.  They are examples of well-known techniques that penetration testers and hackers use to move from computer to computer inside a network that they have successfully compromised.  The first involves the administration tool PsExec, which is often used for remote deployment of software on enterprise networks.  The second leverages a built-in Windows tool called WMIC (Windows Management Instrumentation Command-Line) that can also be used to remotely manage computers on enterprise networks.

Both of these mechanisms require valid administrative credentials in order to work.  The Petya malware comes bundled with a credential-stealing tool (based on the well-known Mimikatz) that it uses to extract cached user credentials from the memory of the infected machine, and passes them on to PsExec/WMIC for use in infecting other computers on the network.


ti graphicDiagram: How Petya/NotPetya Spreads


What does the malware do on an infected machine?

In addition to spreading itself from system to system, the Petya malware includes two kinds of encryption functionality.  The standard file encryption part scans all fixed drives on the computer for files with “interesting” extensions, and encrypts them with the AES encryption algorithm.  It then creates a ransom note file called README.TXT that contains an encrypted version of the AES key.  If there are multiple drives, the files on each drive will be encrypted with a different AES key, and will have a separate ransom note file.

The low-level part of the encryption targets two critical data structures on the hard disk, namely the Master Boot Record (MBR) and the Master File Table (MFT).  Petya first overwrites the Master Boot Record with its own version that prevents the system from booting its regular operating system and displays a ransom note screen instead.  It saves a copy of the original MBR, and creates a scheduled task to restart the system after it has had a chance to complete its network propagation phase.  In addition to overwriting the MBR, it also encrypts the Master File Table, which is the main file system data structure that Windows relies on to locate files on disk.  Unfortunately, the encryption key is then thrown away by the malware, rendering the MFT unrecoverable.  The “installation ID” displayed on the ransom note screen is randomly generated and cannot be used to recover the MFT encryption key.  This fact has led some researchers to conclude that Petya/NotPetya was not intended to be for-profit ransomware, and the motivations behind it may have been political.


How can your computer(s) get infected?

Petya/NotPetya is a worm (malware that autonomously spreads by copying itself from victim to victim), which means the most likely cause of infection is exposure to a previously infected machine on the same network.  However, in order to kick start the spreading process, an initial set of computers must first be infected in a different way.  Malware researchers sometimes call this the “initial infection vector”.

Early reports pointed to malicious Microsoft Word documents using the well-known CVE-2017-0199 vulnerability to download and install Petya on victim computers.  While this is certainly a possibility, we have not seen any confirmed instances of this infection vector.  The purported samples we examined in our lab turned out to be spreading a different strain of malware known as Lokibot.

A more unusual infection vector has now emerged as the prime suspect.  According to multiple sources, the Ukrainian tax accounting software maker MeDoc had its software update mechanism co-opted in order to spread the Petya malware to unsuspecting users.  MeDoc is one of only two tax software packages approved by the Ukrainian government, so anyone doing business with Ukraine is likely to use it.  This could explain how the malware was able to infect some organizations outside of the Ukraine.  After initial denials, MeDoc has now confirmed that a breach of its systems has been detected and is currently being investigated.

eSentire Media Contacts

Mandy Bachus | eSentire | [email protected] | +1 519.651.2200 x5226 | @MandyBachus

Angela Tuzzo | MRB Public Relations | [email protected] | +1 732.758.1100 x105 | @MRB_PR

Ready to start the conversation about cybersecurity?
Talk to us today.
Let's Talk