Large-Scale Petya Ransomware Attack In Progress, Hits Europe Hard - TrendLabs Security Intelligence Blog bitcoin currency of which country

Large-Scale Petya Ransomware Attack In Progress, Hits Europe Hard – TrendLabs Security Intelligence Blog bitcoin currency of which country

A large-scale ransomware attack reported to be caused by a variant of the petya ransomware is currently hitting various users, particularly in europe. This variant, which trend micro already detects as RANSOM PETYA.SMA, is known to use both the eternalblue exploit and the psexec tool as infection vectors. Users and organizations are thus advised to perform the following mitigation steps immediately in order to prevent and avoid infection:

• apply the security patch MS17-010

• disable TCP port 445

• restrict accounts with administrator group access

We are currently analyzing this threat and will update this post as more details become available.

[RELATED: the most frequently asked questions that dispel and clarify misconceptions and comparisons about this threat]

Infection flow

As previously mentioned, this ransomware’s initial entry into the system is through the “admin$” share, after which it is executed by psexec, a microsoft utility used to run processes on remote systems, or windows management information command-line (WMIC), which is an interface that simplifies the use of windows management instrumentation (WMI).Bitcoin currency of which country it also uses the eternalblue exploit—also used by wannacry—that targets a vulnerability in server message block (SMB) v1. This petya variant is dropped into a system as perfc.Dat, after which it uses the rundll32.Exe process to run and carry out its file encryption routine. Unusually for ransomware, it does not change the extensions of any encrypted files. It targets more than 60+ file extensions to encrypt; it is worth noting that the file types it targets are typically used in enterprise settings; images and video files, which are usually targeted by other ransomware, are notably absent.

This ransomware then adds a scheduled task that reboots the system after at least an hour. Meanwhile, the master boot record (MBR) is also modified so that the MFT encryption routine will display the ransom note upon reboot.Bitcoin currency of which country A fake CHKDSK notice is initially displayed; this is when the MFT encryption happens.

Figure 1. Infection diagram

Figure 2. Ransomware notices displayed after reboot

Figure 3. Ransomware notices displayed after reboot

Aside from the use of the eternalblue exploit, there are other similarities to wannacry. Like that attack, this petya variant’s ransom process is relatively simple: it also uses a hardcoded bitcoin address, making decryption a much more labor-intensive process on the part of the attackers. This is in contrast to earlier petya attacks, which had a more developed UI for this process. Each user is asked to pay US$300. As of this time, approximately US$7,500 had been paid into the bitcoin address. As in all ransomware attacks, we advice against paying the ransom–this is particularly true in this case, as the email account mentioned in the ransom note is no longer active.Bitcoin currency of which country

PsExec and windows management information command-line (WMIC)

Petya cleverly uses legitimate windows processes psexec and windows management information command-line, which is an interface that simplifies the use of windows management instrumentation (WMI).

Once petya is dropped, it will drop psexec.Exe as dllhost.Dat on the target machine. The malware also drops a copy of itself to \\{remote machine name}\admin$\{malware filename}. It then executes the dropped copy by using dllhost.Dat locally (which is the file name of the psexec tool) with the following parameters:

Dllhost.Dat \\{remote machine name} -accepteula -s -d C:\windows\system32\rundll32 “C:\windows\{malware filename}”,#1 {random number minimum 10} {enumerated credentials}

The format of {enumerated credentials} is as follows:

“un1:pw1” “un2:pw2” “un3:pw3” … “unn:pwn”

bitcoin currency of which country

If this is unsuccessful, petya will then use WMIC.EXE to execute the file in the remote machine:

%system%\wbem\wmic.Exe /node:”{node}” /user:”{user name}” /password:”{password}” process call create “C:\windows\system32\rundll32 \”C:\windows\{malware filename}\” #1 {random number minimum 10} {enumerated credentials}”

Petya will use psexec or WMIC to spread the malware to other systems within the local network. As previously mentioned, it also uses the eternalblue exploit to propagate; however, if eternalblue exploit fail, this variant then attempts to use eternalromance, another smbv1 exploit.

Information extraction method

We discovered that this petya variant uses an advanced method to extract information from the infected system. It makes use of a customized mimikatz—a legitimate security tool—to extract usernames and passwords.Bitcoin currency of which country the 32-bit and 64-bit mimikatz executables are encrypted and stored in the resource section of the ransomware. The extraction method runs when the main malware process opens a pipe, which is used by the custom mimikatz to write its results. These results are then read by the main malware process. As mentioned earlier, petya is able to spread to other systems within the local network by using this extracted information.

Disk modification procedure

Before encryption, petya will first modify the MBR as part of its process.

The malware has two conditions for disk modification. First, it will detect whether or not AVP.Exe is running. If it detects that it is running, it will write code (0xbaadf00d) to the system’s MBR making the system unbootable.

If AVP.Exe is not running, it will proceed to do the following routine:

bitcoin currency of which country

It will access the following sectors:

• sectors 0 to 18 (disk offset 0 to 25ffh) are overwritten with its own boot program.

• sector 32 (disk offset 4000h to 41ffh) is written with structured data containing MFT encryption state, key and nonce pair for master file table (MFT) encryption, bitcoin wallet and personal installation key (encrypted file encryption key).

• sector 33 (disk offset 4200h to 43ffh) is filled with 07h.

The original MBR is encrypted:

• sector 34 (disk offset 4400h to 45ffh) is written with the XOR-encrypted original MBR.

If the above process fails, it will overwrite sectors 0-9 with code (0xbaadf00d).

Administrator rights are needed to write to the MBR. If a direct execution of the malware is done without administrator rights, it won’t write to MBR. However, given its arrival method, system user rights will be inherited, resulting in both MBR and file encryption.Bitcoin currency of which country

Like previous petya variants, this variant also encrypts the infected system’s MFT. The main DLL first generates a key and nonce pair using the cryptgenrandom API. The generated key is then written to the disk, so that when the infected system restarts, the malware boot code will use the saved key to start the MFT encryption using salsa20 algorithm. It is during this process that the fake CHKDSK screen (as shown in figure 2 above) is displayed.

By using the cryptgenrandom API to generate the encryption key, this petya variant fixes a flaw in the older versions’ encryption routine, making this variant more difficult to decrypt. It is worth noting, though, that based on our analysis of its code, this petya variant actually deletes the encryption key it used. This makes decryption not just difficult, but virtually impossible even for malware author.Bitcoin currency of which country

The MBR is recoverable since it is saved and is only encrypted by XOR with a fixed key. However, the encrypted MFT does not seem to be decryptable.

The summarized steps for MFT encryption is as follows:

• as stated earlier, petya will first modify the MBR

• it then encrypts its target files

• after rebooting, the modified MBR code will run and encrypt the MFT via a fake CHKDSK routine

Take note that systems are supposed to have a backup, or second MFT, which the malware does not touch. However, this backup MFT comes with certain limitations—specifically, it can only mirror the first four file record entries. As such, the backup MFT cannot be used for recovery beyond the 16th file record entry, nor is it a reliable method for recovering the encrypted MFT.

Petya’s behavior with antivirus processes

bitcoin currency of which country

In addition to its main processes, petya also exhibits behavioral changes when it detects certain AV-related processes running in the system.

Specifically, petya will check if the following processes are running:

• avp.Exe

• NS.Exe

• ccsvchst.Exe

If avp.Exe is found running, petya will proceed with both MBR overwriting and file encryption. However, after rebooting the infected machine, it will not perform MFT encryption. In this case, if the user has somehow managed to back up their MBR, they can theoretically restore the system since the MFT was not encrypted. Despite this, the affected files will still be encrypted.

If the processes NS.Exe or ccsvchst.Exe are found running, petya will refrain from propagating using the SMB exploits eternalblue and eternalromance. The ransomware will still attempt to spread via other methods.Bitcoin currency of which country

Trend micro solutions

Further information about trend micro solutions may be located within this article.

The following SHA256 hashes are related to this threat:

• 027cc450ef5f8c5f653329641ec1fed91f694e0d229928963b30f6b0d7d3a745

• 64b0b58a2c030c77fdb2b537b2fcc4af432bc55ffb36599a31d418c7c69e94b1

• 752e5cf9e47509ce51382c88fc4d7e53b5ca44ba22a94063f95222634b362ca5

With additional analysis from brian cayanan and anthony melgarejo

[RELATED: learn who is most at risk from this petya outbreak, as well as mitigation best practices for enterprises]

Updated on june 27, 2017, 9:50 PM PDT to add more technical information

Updated on june 28, 2017, 1:22 PM PDT to add more details on the disk modification procedures and include an additional SHA256 hash

Updated on june 29, 2017, 2:09 AM PDT to add more details on the infection flow, disk modification procedures and update the infection diagram

bitcoin currency of which country

Updated on july 06, 2017, 12:55 AM PDT to add more details on petya’s interaction with various antivirus processes

Updated on july 07, 2017, 2:30 AM PDT to add more details on the disk modification procedures