This detection rule identifies adversaries leveraging Windows Management Instrumentation (WMI) to execute commands and establish persistence, a tactic frequently employed by Advanced Persistent Threats (APTs) for stealthy lateral movement within Azure environments. Proactively hunting for this behavior in Azure Sentinel is critical because WMI operations often bypass traditional file-based monitoring, allowing attackers to operate undetected while accessing sensitive resources across the cloud infrastructure.
rule WMI_vbs : APT
{
meta:
description = "WMI Tool - APT"
author = "Florian Roth"
release_date = "2013-11-29"
confidential = false
score = 70
strings:
$s3 = "WScript.Echo \" $$\\ $$\\ $$\\ $$\\ $$$$$$\\ $$$$$$$$\\ $$\\ $$\\ $$$$$$$$\\ $$$$$$"
condition:
all of them
}
This YARA rule can be deployed in the following contexts:
This rule contains 1 string patterns in its detection logic.
Here are 5 specific false positive scenarios for the WMI Tool - APT detection rule, including suggested filters and exclusions:
Scenario: Microsoft Endpoint Configuration Manager (SCCM) Software Updates
ccmexec.exe) frequently utilizes WMI to query hardware inventory or push software updates across the enterprise network. This often triggers high-volume WMI event logs that mimic APT lateral movement behavior.ProcessName is ccmexec.exe and the CommandLine contains keywords like “SoftwareUpdates” or “Inventory”. Alternatively, filter out WMI queries originating from the SCCM site server IP range during known maintenance windows (e.g., 02:00–04:00).Scenario: Scheduled PowerShell Health Checks via Task Scheduler
powershell.exe to run health checks or compliance audits. These scripts frequently invoke WMI (Get-WmiObject) to gather system metrics, which can be flagged as suspicious APT activity due to the use of PowerShell in conjunction with WMI.ParentProcessName is svchost.exe (specifically the Schedule service) and the CommandLine matches a known hash or path pattern for internal audit scripts (e.g., C:\Scripts\HealthCheck.ps1).Scenario: Microsoft Defender Antivirus Real-Time Scanning
MsMpEng.exe) uses WMI interfaces to monitor file system changes and retrieve process attributes in real-time. This continuous interaction generates a steady stream of WMI events that can be misidentified as an attacker enumerating the environment.