A Decade of WMI Abuse – an Overview of Techniques in Modern Malware
Total Page:16
File Type:pdf, Size:1020Kb
WHITEPAPER Security A Decade of WMI Abuse – an Overview of Techniques in Modern Malware www.bitdefender.com Bitdefender Whitepaper A Decade of WMI Abuse – an Overview of Techniques in Modern Malware Contents Foreword ____________________________________________________________________________________________________ 3 WMI Overview _____________________________________________________________________________________________________________ 3 Malicious scenarios ________________________________________________________________________________________________________ 3 Execution ____________________________________________________________________________________________________________________ 3 Persistence __________________________________________________________________________________________________________________ 4 Defense Evasion _____________________________________________________________________________________________________________ 4 Discovery ____________________________________________________________________________________________________________________ 4 Lateral Movement ___________________________________________________________________________________________________________ 4 Command and Control ______________________________________________________________________________________________________ 5 Exfiltration ___________________________________________________________________________________________________________________ 5 Technical Analysis. Malware Collection _______________________________________________________________________ 5 Kingminer _________________________________________________________________________________________________________________ 5 Maze Ransomware ________________________________________________________________________________________________________ 5 Emotet ____________________________________________________________________________________________________________________ 6 A Technical Analysis of Emotet ______________________________________________________________________________________________ 6 sLoad ______________________________________________________________________________________________________________________ 8 sLoad Technical Analysis ____________________________________________________________________________________________________ 8 Miner Downloader ________________________________________________________________________________________________________ 11 Miner Downloader Technical Analysis ______________________________________________________________________________________ 11 Conclusion__________________________________________________________________________________________________ 12 Bibliography ________________________________________________________________________________________________ 13 Author Ruben Andrei CONDOR - Security Researcher @ Bitdefender 2 Bitdefender Whitepaper A Decade of WMI Abuse – an Overview of Techniques in Modern Malware Foreword WMI Overview Malicious scenarios Windows Management Instrumentation (WMI) The earliest mainstream use of WMI was Stuxnet, a [1] is the infrastructure for management data and piece of malware that completely reshaped cyber- operations on Windows-based operating systems. security. As a result, today’s malware increasingly WMI is the Microsoft implementation of Web-Based abuses WMI (Windows Management Instrumentation). Enterprise Management (WBEM). WMI uses the Stuxnet, one of the most sophisticated worms Common Information Model (CIM) industry standard of 2010, affected nuclear processing facilities in to represent systems, applications, networks, devices Natanz, Iran and used WMI to enumerate users and and other managed components. spread to available network shares. It also used MOF (Managed Object Format) files, the means for WMI, which can be used in all Windows-based creating and registering providers and events for applications, is designed to work with C/C++, VBA WMI. In other words, it (ab)used the WMI - Technique or any scripting language that has an engine on T1084, Windows Management Instrumentation Event Windows and can handle ActiveX objects. Many Subscription, for Persistence, Technique T1087, Windows features have associated WMI providers, Account Discovery, and Technique T1135, Network they implement the functionality described by Share Discovery, for Discovery and Technique T1105, WMI classes, methods and properties to manage Remote File Copy, for Lateral Movement. associated Windows features. A management application communicates with WMI by using a variety This article details a collection of malware that of interfaces, all based on the Component Object use WMI to achieve their goal. This compilation Model (COM). aims to inform security practitioners and decision- makers about current malicious techniques, each Main WMI classes: in correspondence with the tactics from the MITRE Att&ck Matrix[2], and remind our partners of the • WMI System Classes - predefined classes included importance of proper WMI monitoring in combating in every namespace in the WMI core, they provide cyber attacks. much of the basic functionality and are similar in purpose to the system tables in SQL server; Direct or indirect use of the Management • MSFT Classes - offer means to manipulate Instrumentation may be involved in the following OS features, such as remote events and policy tactics, each in correspondence with relevant extensions; techniques: • CIM Classes - common information model (CIM) schema classes, you can inherit from these Execution • Technique T1047, the Windows Management classes. Win32 classes inherit from CIM classes; Instrumentation technique; • Standard Consumer Classes - set of WMI event • Technique T1559.001, Inter-Process consumers that trigger an action upon receipt of an Communication: Component Object Model. arbitrary event. Interacting with WMI is done through COM; • Technique T1059.001, Command and Scripting Interpreter: PowerShell. For instance, by using the Get-WmiObject cmdlet to get instances of WMI classes; • Technique T1021.006, Remote Services: Windows Remote Management. WMI supplies management data for WinRM; 3 Bitdefender Whitepaper A Decade of WMI Abuse – an Overview of Techniques in Modern Malware • Technique T1053, Scheduled Task/ Job. The Win32_ScheduledJob WMI class represents a job created with the AT command; Persistence • Technique T1546.003, Event Triggered Execution: Windows Management Instrumentation Event Subscription. WMI can be used to install event filters, providers, consumers and bindings that execute code when a defined event occurs; • Technique T1133, External Remote Services. WinRM can be used; • Technique T1547.001, Boot or Logon Autostart Execution: Registry Run Keys/ Startup Folder. StdRegProv WMI class contains methods that manipulate registry run keys; Defense Evasion • Technique T1562.001, Impair Defense: Disable or Modify Tools. The technique can be achieved, for example, deleting registry keys via WMI, or using wmic.exe to terminate processes; • Technique T1202, Indirect Command Execution. Often to avoid detection, malware may use Win32_Process WMI class to execute commands, without invoking cmd.exe directly; • Technique T1112, Modify Registry. StdRegProv WMI class contains methods that manipulate registry keys; Discovery • Technique T1087, Account Discovery. The Win32_UserAccount WMI class contains information about a user account on a computer system, the Win32_LoggedOnUser WMI class relates a session and a user account; • Technique T1083, File and Directory Discovery. The Win32_Directory WMI class can manipulate a directory. The CIM_DataFile WMI class represents a named collection of data. The Win32_ShortcutFile WMI class repesents shortcut files; • Technique T1135, Network Share Discovery. The Win32_Share WMI class repesents a shared resource; • Technique T1120, Peripheral Device Discovery. There are a lot of useful WMI classes, such as: Win32_CDROMDrive, Win32_DesktopMonitor, Win32_InfraredDevice, Win32_Keyboard, Win32_Printer, Win32_SerialPort, Win32_USBController, Win32_VideoControlleretc; • Technique T1069, Permission Groups Discovery. The Win32_Group WMI class gives information about a group account, and Win32_GroupUser relates a group and an account that is a member of that group; • Technique T1057, Process Discovery. The Win32_Process WMI class may offer plenty; • Technique T1012, Query Registry. You can obtain data from the registry by using the StdRegProv WMI class, as well as the Win32_Registry class; • Technique T1018, Remote System Discovery. The Win32_PingStatus can return data from computers that have both IPv4 and IPv6 addresses; • Technique T1082, System Information Discovery. There are a variety of useful classes, for example Win32_ OperatingSystem, Win32_SystemResourcesetc; • Technique T1016, System Network Configuration Discovery. The Win32_SystemNetworkConnections WMI class relates a network connection, the MSFT_NetAdapter can offer information about network adapters; • Technique T1007, System Service Discovery. The Win32_Service WMI class represents a service; • Technique T1124, System Time Discovery. Using the Win32_TimeZone you can retrieve time zone information; • Technique T1497, Virtualization/ Sandbox Evasion. The Win32_ComputerSystem WMI class, as well as Win32_ BaseBoard can detect a VM; Lateral Movement • Technique T1559.001, Inter-Process Communication: Component Object Model. Interacting with WMI is done through COM; • Technique T1021.006, Remote Services: Windows Remote Management. WMI supplies management