Query Details

Endpoint Impacket Wmi LMP

Query

//Case1
DeviceEvents
| where Timestamp > ago(7d)
| where ActionType == "ProcessCreatedUsingWmiQuery" 
| where FileName == "cmd.exe"
| where ProcessCommandLine contains "/Q /c"
| project Timestamp, DeviceId, DeviceName, ActionType, FolderPath, FileName, ProcessCommandLine, InitiatingProcessCommandLine


//Case2
DeviceProcessEvents
| where Timestamp > ago(7d)
| where InitiatingProcessParentFileName == "WmiPrvSE.exe"
| where InitiatingProcessFolderPath has "cmd.exe"
| where InitiatingProcessCommandLine contains "/Q /c"
| project Timestamp, DeviceId, DeviceName, ActionType, FolderPath, FileName, InitiatingProcessCommandLine, ProcessCommandLine

About this query

name : Credential Access - Hunting for Impacket Wmiexec activity description :

Explanation

This query is used to hunt for "Impacket Wmiexec" activity, which is a suspicious activity that could indicate a security threat. The query looks for two different cases:

Case 1: It searches for instances where the "cmd.exe" process is created using a WMI query and the process command line contains "/Q /c" parameters. It retrieves information such as the timestamp, device ID, device name, action type, folder path, file name, process command line, and initiating process command line.

Case 2: It looks for events in the DeviceProcessEvents table where the parent process of the initiating process is "WmiPrvSE.exe", the initiating process folder path contains "cmd.exe", and the initiating process command line contains "/Q /c" parameters. It retrieves similar information as in Case 1. These cases help identify potential instances of "Impacket Wmiexec" activity and can be used for further investigation and mitigation.

Details

Kijo Girardi profile picture

Kijo Girardi

Released: March 3, 2023

Tables

DeviceEventsDeviceProcessEvents

Keywords

DeviceEventsDeviceProcessEventsTimestampActionTypeFileNameProcessCommandLineInitiatingProcessCommandLine

Operators

toscalar()arg_max()count()mv-expand

Actions

GitHub