Security Experts:

Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

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.

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.

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.

Written By

Ionut Arghire is an international correspondent for SecurityWeek.

Click to comment

Expert Insights

Related Content

Malware & Threats

Microsoft plans to improve the protection of Office users by blocking XLL add-ins from the internet.

Cybercrime

CISA, NSA, and MS-ISAC issued an alert on the malicious use of RMM software to steal money from bank accounts.

Cybercrime

Chinese threat actor DragonSpark has been using the SparkRAT open source backdoor in attacks targeting East Asian organizations.

Application Security

Electric car maker Tesla is using the annual Pwn2Own hacker contest to incentivize security researchers to showcase complex exploit chains that can lead to...

Malware & Threats

Cybercrime in 2017 was a tumultuous year "full of twists and turns", with new (but old) infection methods, a major return to social engineering,...

Cybercrime

A recently disclosed vBulletin vulnerability, which had a zero-day status for roughly two days last week, was exploited in a hacker attack targeting the...

Malware & Threats

Norway‎-based DNV said a ransomware attack on its ship management software impacted 1,000 vessels.

Malware & Threats

A GitHub Codespaces feature meant to help with code development and collaboration can be abused for malware delivery.