This hypothesis posits that adversaries are utilizing dynamic API loading to inject malicious code into legitimate processes while evading static signature-based defenses. Proactively hunting for this behavior in Azure Sentinel is critical because it allows the SOC team to identify stealthy execution patterns early, preventing potential lateral movement before high-severity alerts trigger.
rule DynamicAPILoading: sharedcode
{
meta:
copyright = "2015 Novetta Solutions"
author = "Novetta Threat Research & Interdiction Group - trig@novetta.com"
Source = "eff542ac8e37db48821cb4e5a7d95c044fff27557763de3a891b40ebeb52cc55.ex_"
strings:
/*
83 C4 04 add esp, 4
50 push eax ; lpProcName
56 push esi ; hModule
FF 15 20 F0 40 00 call ds:GetProcAddress
68 A8 0C 41 00 push offset aLo_adlIbr_arYw; "Lo.adL ibr.ar yW"
A3 DC 3E 41 00 mov GetProcAddress_0, eax
E8 7D FF FF FF call CleanupString
83 C4 04 add esp, 4
50 push eax ; _DWORD
56 push esi ; _DWORD
FF 15 DC 3E 41 00 call GetProcAddress_0
68 94 0C 41 00 push offset aLoad_LibR_arYa; "Load. Lib r.ar yA"
A3 D4 3E 41 00 mov LoadLibraryW, eax
E8 63 FF FF FF call CleanupString
83 C4 04 add esp, 4
50 push eax ; _DWORD
56 push esi ; _DWORD
FF 15 DC 3E 41 00 call GetProcAddress_0
68 80 0C 41 00 push offset a_frE_eliBr_arY; ".Fr e.eLi br.ar y"
A3 D8 3E 41 00 mov LoadLibraryA_0, eax
E8 49 FF FF FF call CleanupString
*/
$a = { 83 C4 ?? 5? 5? FF 15 [4] 68 [4] A3 [4] E8 [4] 83 C4 ?? 5? 5? FF 15 [4] 68 [4] A3 [4] E8 [4] 83 C4 ?? 5? 5? FF 15 [4] 68 [4] A3 [4] E8}
condition:
$a in ((pe.sections[pe.section_index(".text")].raw_data_offset)..(pe.sections[pe.section_index(".text")].raw_data_offset + pe.sections[pe.section_index(".text")].raw_data_size))
}
This YARA rule can be deployed in the following contexts:
This rule contains 1 string patterns in its detection logic.
Here are 4 specific false positive scenarios for the DynamicAPILoading detection rule in an enterprise environment, along with recommended filters or exclusions:
Microsoft Office Add-in Initialization
EXCEL.EXE or WINWORD.EXE) dynamically loads external DLLs containing API calls to render toolbars and sync data.MSOffice* and the loaded module path contains \Program Files\Microsoft Office\root\office16\ or specific known vendor folders (e.g., \Adobe\Acrobat Pro DC\).Scheduled Antivirus Definition Updates
CrowdStrike.exe, SentinelOneAgent.exe) and the loaded module name matches the pattern of update components (e.g., *.update.dll or specific hash ranges for definition files).Java/JDK Runtime Class Loading
java.exe process frequently loads numerous .jar and .dll files into memory to handle API requests without restarting the application instance.