Detect Dynamic API Resolution in CrowdStrike LogScale
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.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1027 Obfuscated Files or Information
- Sub-technique
- T1027.007 Dynamic API Resolution
- Canonical reference
- https://attack.mitre.org/techniques/T1027/007/
LogScale Detection Query
#event_simpleName = ClassifiedModuleLoad
| ModuleFileName = /(?i)(\\kernel32\.dll|\\kernelbase\.dll|\\ntdll\.dll)$/
| ImageFileName != /(?i)^[Cc]:\\Windows\\/
| ImageFileName != /(?i)^[Cc]:\\Program Files/
| ImageFileName != /(?i)^[Cc]:\\Program Files \(x86\)/
| ImageFileName != null
| groupBy(
[ComputerName, ImageFileName, TargetProcessId],
function=[
count(field=ModuleFileName, distinct=true, as=CoreDLLCount),
collect(field=ModuleFileName, as=LoadedModules),
max(field=@timestamp, as=LastSeen),
selectLast(field=UserName, as=UserName),
selectLast(field=SHA256HashData, as=ProcessSHA256)
]
)
| CoreDLLCount >= 1
| sort(field=CoreDLLCount, order=asc, limit=100)
| select([ComputerName, UserName, ImageFileName, CoreDLLCount, LoadedModules, ProcessSHA256, LastSeen]) CrowdStrike LogScale (Falcon) query detecting dynamic API resolution by correlating ClassifiedModuleLoad events where core Windows DLLs (kernel32.dll, kernelbase.dll, ntdll.dll) are loaded by processes outside standard system directories. Results are grouped by host, process image, and process ID to surface distinct DLL load counts per process. Processes from non-standard paths with intentionally minimal DLL loads indicate manual API resolution consistent with malware families including PlugX, Raccoon Stealer, AvosLocker, TONESHELL, and CHIMNEYSWEEP.
Data Sources
Required Tables
False Positives & Tuning
- CrowdStrike Falcon sensor components and other co-installed security products that may generate ClassifiedModuleLoad telemetry from their own non-standard installation paths as part of DLL interception for behavioral monitoring
- Gaming platforms (Steam, Epic Games Launcher) and media applications installed to custom drive locations outside Program Files that dynamically load core DLLs for performance-critical subsystems
- IT remote administration tools (RMM agents, patch management clients, endpoint management software) deployed by enterprise IT to organization-defined custom directory paths that legitimately load these system libraries at startup
Other platforms for T1027.007
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Demonstrate GetProcAddress Dynamic API Resolution in PowerShell
Expected signal: Sysmon Event ID 1: PowerShell process creation with Add-Type and DllImport. PowerShell ScriptBlock Log Event ID 4104: the P/Invoke declarations and GetProcAddress call. Sysmon Event ID 7: user32.dll loaded by powershell.exe.
- Test 2API Hash Resolution Simulation
Expected signal: PowerShell ScriptBlock Log Event ID 4104: the hash function implementation and the list of API names being hashed. The output shows API-to-hash mappings as adversarial malware would store them.
- Test 3Inspect Binary IAT for Dynamic Resolution Indicators
Expected signal: Sysmon Event ID 1: dumpbin.exe execution with /imports argument on calc.exe. The findstr filter shows LoadLibrary and GetProcAddress imports if present.
- Test 4Create Minimal-Import Executable for Testing
Expected signal: Sysmon Event ID 1: csc.exe compilation (T1027.004 indicator). Sysmon Event ID 1: dynapi.exe execution from Temp. Sysmon Event ID 7: kernel32.dll and user32.dll loaded by dynapi.exe. The dynapi.exe IAT will contain only LoadLibrary and GetProcAddress.
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.