Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
Get access to immediate incident response assistance.
Get access to immediate incident response assistance.
Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
Ransomware seem to be the trend now and this type of malware will no doubt continue to grow. But do you still remember in the 90's when boot viruses were the norm? These malwares typically infect the boot sector of floppy and bootable drives just to display annoying things. How about 10-15 years ago when most worm malware used exploits to spread either thru SMB or DCERPC? What if you mix everything, the past and the present? You'll end up with Petya and the future.
In the last few days a destructive new Petya ransomware strain arose after earlier variants became notable last year which infected the MBR to display a ransom note. One noticeable behavior of previous Petya variants is that they only encrypted the MFT (Master File Table) to make the file system unreadable. In contrast, the new variant now also uses the typical ransomware file encryption. And in comparison to WannaCry, this new Petya does not just use the EternalBlue exploit for propagation, but also uses shared folders to spread through the network. It also uses legitimate tools like PSExec and WMI to execute Petya malware remotely. It is these features which allowed the malware to spread quickly in an internal network, regardless of whether systems were patched with the MS17-010 patch.
To further appreciate this new exciting malware, we took a deep dive into it to map out exactly what it is doing. Here is the overview of infection process.
There were initial reports suggesting emails and documents related to the new Petya but based on data from our Spam Research Database there is no evidence of such. Others have suggested that the DLL (perfc.dat) was executed thru an exploited Ukrainian taxation software called MeDoc.
Even without the main loader from the MeDoc Software, one can execute the DLL by calling the lone exported function using the rundll32.exe with the equivalent ordinal number #1. (These ordinal numbers are a chronological representation of each exported API functions within each DLL).
C:\Windows\system32\rundll32.exe perfc.dat #1
To make sure the malware can perform most of its malicious behaviors, it needs to check and adjust the required privileges of SeShutdownPrivilege, SeDebugPrivilege, and SeTcbPrivilege.
Note that the extent of the privilege that malware can attain will affect how it will perform other malicious behavior and how it can perform a system shutdown.
Petya next performs a process enumeration, and, by using its own propriety algorithm, it computes the hash of each process name that is currently running. It compares each hash with the following hardcoded hash related to AV processes.
0x2E214B44 – AVP.exe
0x6403527E – ccSvcHst.exe
0x651B3005 – NS.exe
If the malware has achieved a "SeDebugPrivilege" it will perform the following:
It creates a scheduled task to perform a System Shutdown an hour later. Just enough time to finish the propagation routine so as to infect other machines on the network.
It scans the local network for possible targets.
From the resource section of the DLL, it will load RT_RCDATA #1 and drop it in the user's temp folder as {random}.tmp. At the same time, a thread will be triggered to create a new pipe which will allow for the *.tmp file to connect and send out information.
Currently, we are still investigating this *.tmp file as it behaves like a trimmed down Mimikatz by opening and reading the LSASS memory space.
Another file will be loaded from the resource (RT_RCDATA #3) and will be dropped as dllhost.dat in the windows directory. This file is a legitimate PSEXEC tool from Sysinternals.
There are multiples ways the malware tries to spread itself and one of them is through network shares by performing the following:
Another way to spread is to perform an SMB attack using the EternalBlue exploit.
Petya ransomware performs the following to encrypt the files:
.3ds.7z.accdb.ai.asp.aspx.avhd.back.bak.c.cfg.conf.cpp.cs.ctl.dbf.disk.djvu.doc.docx .dwg.eml.fdb.gz.h.hdd.kdbx.mail.mdb.msg.nrg.ora.ost.ova.ovf.pdf.php.pmf.ppt.pptx .pst.pvi.py.pyc.rar.rtf.sln.s.ql.tar.vbox.vbs.vcb.vdi.vfd.vmc.vmdk.vmsd.vmx.vsdx.vsv .work.xls.xlsx.xvd.zip |
To cover its tracks and make it hard for forensics, Petya will execute the following:
Whether this is Petya or NotPetya, here in Trustwave SpiderLabs we believe that this malware is tailor-made to avoid a bunch of current security protections. It has used a DLL where the codes are within the export function which helps avoid it being executed in a sandbox. It infects the ever vulnerable MBR. It has several methods to spread without user-triggered events, and even tries to execute itself remotely using non-malicious software. It even covers it tracks to avoid forensics experts digging deep into how the system is being infected. We must admit that this malware has done a pretty good job knitting things together from the past to perhaps create an insight of what's ahead.
Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.
Copyright © 2024 Trustwave Holdings, Inc. All rights reserved.