Malware & Threats

Malware Increasingly Abusing WMI for Evasion

Malware is increasingly using Windows Management Instrumentation (WMI) queries to evade detection and to determine the environment it is running in, FireEye researchers warn.

<p class="MsoNormal"><span><span><strong>Malware is increasingly using Windows Management Instrumentation (WMI) queries to evade detection and to determine the environment it is running in, FireEye researchers warn.</strong></span></span></p>

Malware is increasingly using Windows Management Instrumentation (WMI) queries to evade detection and to determine the environment it is running in, FireEye researchers warn.

Leveraging WMI to evade detection has been seen before, and Mandiant revealed last year that advanced persistent threat (APT) groups were using WMI and PowerShell to move laterally, harvest credentials, and search for useful information within Windows environments. Now, FireEye is offering more specific examples of how WMI queries can be leveraged for nefarious purposes.

Because WMI provides high-level interaction with Windows objects using C/C++, VBScript, JScript, and C#, the WMI services are being abused by malware authors to avoid virtualized environments and evade detection. In fact, FireEye explains that a WMI query can detect anti-virus programs because they are registered in AntiVirusProduct class under rootSecurityCenter2 namespace.

Some malware would first check the operating system and would look for an anti-virus program only if Windows Vista or later was detected. As soon as the malware was able to detect the OS and anti-virus, it would send the information, along with other user data, to the server to receive the right payload or to evade detection.

According to FireEye, some malware monitors the system for multiple security products, using different techniques, with the most popular virtualization programs detected with the help of WMI queries. The malware checks for BIOS information from Win32_BIOS class under rootcimv2 namespace. “Specific fields/columns can also be retrieved similar to an SQL query,” FireEye says.

The security researchers also found samples that used Win32_ComputerSystem class for virtual machine detection, which returned a ‘Model’ in the results, offering information about the virtual machine in case of VMware, VirtualBox and Virtual Machine. If matching strings were found in said filed, virtualization was detected.

Another piece of malware used Win32_VideoController and Win32_DiskDrive classes for detection, along with process names of VMware, Wireshark, Fiddler and other security products that were checked before execution of WMI queries. When executed in PowerShell, the WMI query would reveal plenty of information through which VMware was detected.

The same malware family was seen using Win32_DiskDrive to detect VirtualBox, Virtual Hard disk, and VMware. “When any of the virtual machines are detected, the process terminates itself, evading the behavioral analysis,” the security researchers note.

Advertisement. Scroll to continue reading.

Malware was also observed not only checking for a specific process from Win32_Process class, but also killing it. One application targeted by malicious programs is the well-known debugger called Immunity debugger, which is “terminated and its folder is deleted after changing permissions using Windows Script Host shell,” FireEye says.

What’s more, some malware would look for and kill the processes from anti-virus vendor Kingsoft Corporation. To find a process, malware usually employs CreateToolHelp32Snapshot, Process32First and Process32Next APIs, but the malware authors opted in for a WMI query instead, which allowed them to replace tens of lines of code.

An MS Office key generator was observed checking Windows Office Software Protection Service (which enables software vendors to enforce secure licensing on the client machines) through WMI queries. The malware would start the service if it wasn’t running, after which it would retrieve Office Software Protection Service object and then install MS Office product key using it.

“Malware writers are always in search of new ways to evade analysis frameworks and sandboxes to make the payload execution successful in their targeted environments and platforms. WMI provides a simple way of environment detection that can be used to evade sandboxes and dynamic analysis tools, which seem to be underestimated by reverse engineers and others in the security community. Mitigation steps should be taken to monitor WMI queries that could lead to possible evasion,” FireEye says.

Related Content

Copyright © 2024 SecurityWeek ®, a Wired Business Media Publication. All Rights Reserved.

Exit mobile version