Detect Execution of PSEXESVC via Remote Systems
Description of the Query:
KQL Query:
// Detect Execution of PSEXESVC via a Remote System
DeviceProcessEvents
| where Timestamp > ago(1d) // Limit results to the last 24 hours
| where ActionType == "ProcessCreate" // Focus on process creation events
| where InitiatingProcessFileName contains "PSEXESVC.exe" // Filter for PSEXESVC execution
| extend ParentProcessName = InitiatingProcessFileName // Extract the parent process name
| extend ParentCommandLine = InitiatingProcessCommandLine // Extract the parent process command line
| extend UserName = tostring(split(InitiatingProcessAccountName, @"\")[1]) // Extract username for context
| extend IsRemoteExecution = iff(ParentCommandLine contains @"\\" or ParentCommandLine contains "remotetools", true, false)
| where IsRemoteExecution == true // Focus on events involving remote execution
| project
Timestamp,
DeviceName,
UserName,
InitiatingProcessAccountName,
ProcessCommandLine,
InitiatingProcessFileName,
ParentCommandLine,
ActionType
| sort by Timestamp descExplanation of the Query:
Use Case:
Notes:
PreviousDetect DeviceNetworkEvents for LOLBAS with Download or Upload FunctionsNextIdentify Suspicious String in Service Creation ImagePath
Last updated