Petya 2017 is a Wiper not a Ransomware
Ransomware-as-a-service soon to be renamed Lure-as-a-Service
TL;DR: The ransomware was a lure for the media, this variant of Petya is a disguised wiper.
What’s the difference between a wiper and a ransomware ?
The goal of a wiper is to destroy and damage. The goal of a ransomware is to make money. Different intent. Different motive. Different narrative. A ransomware has the ability to restore its modification such as (restoring the MBR like in the 2016 Petya, or decrypting files if the victim pays)â€Š—â€Ša wiper would simply destroy and exclude possibilities of restoration.
Yesterday, we provided a preliminary analysis where we demonstrated that the 27th June 2017 version of Petya leveraged SMB exploits ETERNALBLUE and ETERNALROMANCE.
Today, we spent more time to understand how the files could be retrieved and how the actual MBR and MFT was being encoded.
Sloppy sector blocks modifications
Fortunately, there are multiple excellent existing analysis from 2016 Petya that have been published last year in multiple languages such as French, or English [1, 2]. Today, Microsoft published a very descriptive analysis of the 2017 Petya but for some reasons missed the below part.
- 027cc450ef5f8c5f653329641ec1fed91f694e0d229928963b30f6b0d7d3a745(27th 2017)
After comparing both implementation, we noticed that the current implementation that massively infected multiple entities in Ukraine was in fact a wiper which just trashed the 24 first sector blocks of the disk while replicating itself. Some noted that this was mainly slack space as only the first sector is relevant for most of machinesâ€Š—â€Šexcept few exceptions. I mainly note that since this can be used in some scenarios, this is why I consider it a sloppy overwrite.
The first sector block is being reversibly encoded by XORed with the 0x7 key and saved later in the 34th block. But since it replaces it with a new bootloader (
41f75e5f527a3307b246cadf344d2e07f50508cf75c9c2ef8dc3bae763d18ccf) of 0x22B1 bytes it basically sets
v19 to 0x19 (25).
16.0: kd:x86> ? 0x22B1 - (0x22B1 & 0x1FF) + 0x1024 Evaluate expression: 12836 = 00003224 16.0: kd:x86> ? 0x00003224 >> 9 Evaluate expression: 25 = 00000019
That would mean that 24 sector blocks following the first sector block are being purposely overwritten, they are not read or saved anywhere. Whereas the original 2016 Petya version correctly reads each sector block and reversibly encode them.
2016 Petya modifies the disk in a way where it can actually revert its changes. Whereas, 2017 Petya does permanent and irreversible damages to the disk.
On the left, we can see the current version of Petya clearly got rewritten to be a wiper and not a actual ransomware.
Left (2017 Petya) with the wiper codeâ€Š—â€ŠRight (2016 Petya) which reads and encode sector blocks.
This means the MBR section of the disk is purposely over written by the new bootloader
No more email address for payment
Moreover, the payment email address isn’t accessible anymore if victims would happen to send payments.
Wiper function executed under some conditions
After further analysis, (see Appendix A) we also discovered that the attackers implemented a function that wipes the first 10 sectors under two conditions:
- If the hash command computed from a running process name (unknown so far) returns
- If the function that replaces the actual MBR returns an error. Probably as a generic way to detect EDR trying to prevent bootloader modifications.
The hash command generation, and flag gestion for the different modes can be found in our decompiled version here.
As Kaspersky reported, the key generated itself on the screen is fake and randomly generated. After looking more at how the encryption file key was generated, we also notice an inconsistency that reinforces this statement. This can also be proven by comparing “installation key” displayed in the README.txt and on the screenâ€Š—â€Šas you can see the format is clearly different.
On the left is the display by the MBR code we described above as sloppy written, on the right the content of the README.txt with an actual key generated by the ransomware.
This means that assuming a decryptor would come to be released, the input required would have to come through the README.txtâ€Š—â€Šnot from the screen.
We believe the ransomware was in fact a lure to control the media narrative, especially after the WannaCry incidents to attract the attention on some mysterious hacker group rather than a national state attacker like we have seen in the past in cases that involved wipers such as Shamoon.
The attacker took an existing ransomware which he repackaged.
Lately, the number of attacks against Ukraine increased from Power Grids being shut down to the car a top military intelligence officer exploding yesterdayâ€Š—â€Šthe day Petya.2017 infected Ukraine.
The fact of pretending to be a ransomware while being in fact a nation state attackâ€Š—â€Šespecially since WannaCry proved that widely spread ransomware aren’t financially profitableâ€Š—â€Šis in our opinion a very subtle way from the attacker to control the narrative of the attack.
Additional note, come join Kaspersky & Comae tomorrow Thursday 29 @ 10AM EST for a technical webinar on Pety
aâ€Š—â€Šno sales pitch. We promise ! Only technical stuff.