The detection of a mutex named “maindll” may indicate an adversary attempting to coordinate or synchronize malicious activities across multiple instances of a process. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential persistence or coordination mechanisms used by adversaries to maintain control or evade detection.
rule maindll_mutex
{
meta:
author = "Matt Brooks, @cmatthewbrooks"
desc = "Matches on the maindll mutex"
ref = "https://citizenlab.org/2016/04/between-hong-kong-and-burma/"
strings:
$mutex = "h31415927tttt"
condition:
//MZ header //PE signature
uint16(0) == 0x5A4D and uint32(uint32(0x3C)) == 0x00004550 and $mutex
}
This YARA rule can be deployed in the following contexts:
This rule contains 1 string patterns in its detection logic.
Scenario: A legitimate system update or patching tool (e.g., Microsoft Update, Windows Server Update Services) creates a mutex named maindll_mutex during installation.
Filter/Exclusion: Check for the presence of known update tools or processes (e.g., wusa.exe, msiexec.exe) in the process tree or command line arguments.
Scenario: A scheduled task (e.g., via Task Scheduler) runs a legitimate application (e.g., Microsoft SQL Server Agent) that uses a mutex named maindll_mutex to prevent multiple instances.
Filter/Exclusion: Filter by process name or command line containing “SQL Server” or “Task Scheduler” and check for scheduled task context.
Scenario: A system administration task (e.g., using PowerShell or Group Policy) temporarily creates a mutex to synchronize operations across multiple servers.
Filter/Exclusion: Exclude processes running under the SYSTEM account or with elevated privileges, or filter by known administrative scripts.
Scenario: A third-party application (e.g., Adobe Acrobat, Microsoft Office) uses a mutex named maindll_mutex to manage internal synchronization.
Filter/Exclusion: Check for known application names in the process name or command line, or filter by application-specific process IDs.
Scenario: A legitimate service (e.g., IIS, Exchange, or Active Directory) creates a mutex during startup to ensure single instance operation.
Filter/Exclusion: Filter by service name or process name (e.g., w3wp.exe, msiexec.exe, lsass.exe) and check for service startup context.