Microsoft reported evidence of destructive malware targeting organizations in Ukraine starting from January 13 . The LIFARS threat intelligence team have analyzed the malicious samples and provided a detailed analysis of the execution flow. The main objective of this technical brief is to reveal the sophisticated TTPs demonstrated by threat actors.
We have determined that the wiper has implemented two TLS (thread local storage) callbacks. These callbacks allow the malicious file to execute code before the actual entry point:
The binary replaces the top-level exception handler using the SetUnhandledExceptionFilter API:
The process retrieves a handle to the MBR (Master Boot Record) by calling the CreateFileW function (0x10000000 = GENERIC_ALL, 0x3 = FILE_SHARE_READ | FILE_SHARE_WRITE, 0x3 = OPEN_EXISTING):
The MBR is overwritten with a buffer that contains the ransom note and a shellcode that will be used to print it. The shellcode also performs other destructive actions that will be explained:
The malware prints the ransom note on the screen after rebooting using the “INT 16” BIOS interrupt call. Each character is moved to the AL register and then printed. The shellcode is displayed in the figure below (16-bit):
The binary doesn’t reboot the machine after the MBR is overwritten. After a manual reboot, the victim is presented with the following message:
The buffer written above contains a Disk Address Packet Structure, and the general format of such structure is presented in :
The malware needs to set the following values in order to write to a disk:
- Set AH = 0x43 (EXTENDED WRITE)
- Set DL = 0x80 (C drive)
- Set SI = 0x7C72 – offset to Disk Address Packet Structure
- Set transfer buffer 16-bit offset = 0x7C82 – offset to “AAAAA”
- Set transfer buffer 16-bit segment = CS – the code segment selector
The shellcode uses the “INT 0x13” interrupt call in LBA (logical block addressing) mode and performs the writing operations:
If the above operation is successful, the code adds 199 to the LBA and continues until the end of the disk is reached. Otherwise, the Drive index is increased by 1, and the malware tries to access the next disk.
The file is a .NET malware that spawns two PowerShell processes used to sleep for 20 seconds:
It downloads the 3rd stage disguised as a JPG image from the Discord app:
The Ukrainian authorities blamed Russia for attacks in the context of the geopolitical tensions. LIFARS Threat Intelligence Team believes that there is a high possibility to see more wiper and ransomware attacks against Ukrainian institutions soon.