Dynamic API Resolution
Adversaries may obfuscate then dynamically resolve API functions called by their malware in order to conceal malicious functionalities and impair defensive analysis. API functions called by malware leave static artifacts such as strings in payload files and in the Import Address Table (IAT). To avoid static analysis, adversaries use dynamic API resolution: hashes of function names are stored in malware in lieu of literal strings, and malware uses GetProcAddress() and LoadLibrary() to manually reproduce the linking process. Threat actors including Mustang Panda, Lazarus Group, Latrodectus, Bazar, Brute Ratel C4, TONESHELL, PlugX, Raccoon Stealer, AvosLocker, and CHIMNEYSWEEP use this technique.
DeviceImageLoadEvents
| where Timestamp > ago(24h)
| where FileName in~ ("kernel32.dll", "ntdll.dll", "kernelbase.dll")
| where not (InitiatingProcessFolderPath startswith "C:\\Windows\\"
or InitiatingProcessFolderPath startswith "C:\\Program Files\\"
or InitiatingProcessFolderPath startswith "C:\\Program Files (x86)\\")
| summarize
LoadedModules=make_set(FileName),
ModuleCount=dcount(FileName),
TotalLoads=count()
by DeviceName, InitiatingProcessFileName, InitiatingProcessFolderPath, InitiatingProcessSHA256
| where ModuleCount >= 1
| join kind=leftouter (
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName !in~ ("svchost.exe", "lsass.exe", "services.exe", "explorer.exe")
| summarize ImportCount=dcount(FileName) by DeviceName, SHA256
) on DeviceName
| project DeviceName, InitiatingProcessFileName, InitiatingProcessFolderPath,
InitiatingProcessSHA256, LoadedModules, ModuleCount
| sort by ModuleCount asc Data Sources
Required Tables
False Positives
- Small portable utilities that genuinely have minimal imports and only use LoadLibrary/GetProcAddress for cross-version compatibility
- Legitimate security tools and EDR agents that use dynamic loading for compatibility across Windows versions
- Custom in-house applications written to be compatible with multiple Windows versions using dynamic API loading
- Certain Go or Rust compiled binaries that have unusual DLL load patterns compared to C/C++ equivalents
References (5)
- https://attack.mitre.org/techniques/T1027/007/
- https://www.huntress.com/blog/hackers-no-hashing-randomizing-api-hashes-to-evade-cobalt-strike-shellcode-detection
- https://www.blackhat.com/docs/us-15/materials/us-15-Choi-API-Deobfuscator-Resolving-Obfuscated-API-Functions-In-Modern-Packers.pdf
- https://www.ired.team/offensive-security/defense-evasion/windows-api-hashing-in-malware
- https://dr4k0nia.github.io/dotnet/coding/2022/08/10/HInvoke-and-avoiding-PInvoke.html
Unlock Pro Content
Get the full detection package for T1027.007 including response playbook, investigation guide, and atomic red team tests.