Malicious documents may attempt to locate the kernel32 base address in memory to bypass address space layout randomization, indicating potential evasion techniques. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify advanced threats that may evade traditional detection mechanisms.
YARA Rule
rule maldoc_find_kernel32_base_method_1 : maldoc
{
meta:
author = "Didier Stevens (https://DidierStevens.com)"
strings:
$a1 = {64 8B (05|0D|15|1D|25|2D|35|3D) 30 00 00 00}
$a2 = {64 A1 30 00 00 00}
condition:
any of them
}
This YARA rule can be deployed in the following contexts:
This rule contains 2 string patterns in its detection logic.
Scenario: A legitimate system update or patching tool (e.g., Windows Update, Microsoft Baseline Security Analyzer) is executed, which dynamically loads kernel32.dll and uses its base address for internal operations.
Filter/Exclusion: Check for process names like wuauclt.exe, msiexec.exe, or setup.exe using the process.name field.
Scenario: A scheduled administrative task (e.g., Task Scheduler) runs a script or executable that interacts with kernel32.dll for legitimate system maintenance (e.g., log cleanup, registry checks).
Filter/Exclusion: Filter by process.name containing taskhost.exe or schtasks.exe, or check for known administrative task names in the task.name field.
Scenario: A third-party enterprise management tool (e.g., Microsoft Intune, SCCM, or Puppet) executes a payload that accesses kernel32.dll for configuration or policy enforcement.
Filter/Exclusion: Use process.name to exclude known management tools like ccmexec.exe, intunewsm.exe, or puppet.exe.
Scenario: A legitimate security tool (e.g., Windows Defender, CrowdStrike Falcon, or Bitdefender) performs memory scanning or analysis that involves accessing kernel32.dll.
Filter/Exclusion: Filter by process.name such as MsMpEng.exe, falcon.exe, or bdagent.exe.
Scenario: A system diagnostic or performance monitoring tool (e.g., PerfMon, Process Monitor, or Wireshark) interacts with kernel32.dll during routine data collection or logging.
Filter/Exclusion: Use process.name to exclude tools like perfmon.exe, procmon.exe, or wireshark.exe.