Detect Native API in CrowdStrike LogScale
Adversaries may interact with the native OS application programming interface (API) to execute behaviors. Native APIs provide a controlled means of calling low-level OS services within the kernel, such as those involving hardware/devices, memory, and processes. Adversaries abuse these APIs to execute code while bypassing higher-level defensive sensors, AMSI, and user-mode API hooks. Common attack patterns include: direct syscall invocation (bypassing ntdll.dll hooks entirely), process injection via NT memory APIs (NtAllocateVirtualMemory, NtWriteVirtualMemory, NtCreateThreadEx, RtlCreateUserThread), API unhooking by re-mapping a clean copy of ntdll.dll from disk, and spawning processes via NtCreateProcess or NtCreateProcessEx rather than the standard Win32 CreateProcess. Real-world actors including Cobalt Strike, Medusa Group, and tools like SysWhispers leverage direct syscalls specifically to evade EDR user-mode hooks.
MITRE ATT&CK
- Tactic
- Execution
- Technique
- T1106 Native API
- Canonical reference
- https://attack.mitre.org/techniques/T1106/
LogScale Detection Query
/* T1106 — Native API: process injection and ntdll unhooking
CrowdStrike Falcon NG-SIEM / LogScale — Falcon sensor telemetry */
/* Signal 1 & 2: NT API injection primitives — remote thread creation and NT memory API calls */
(
#event_simpleName = "CreateRemoteThreadV2"
OR #event_simpleName = "VirtualAllocExApiCall"
OR #event_simpleName = "NtAllocateVirtualMemoryApiCall"
OR #event_simpleName = "WriteProcessMemoryApiCall"
)
| HighRiskSource := SourceProcessImageFileName =
/(?i)(winword|excel|powerpnt|outlook|mshta|wscript|cscript|regsvr32|rundll32|msiexec)\.exe$/
| ProtectedTarget := TargetProcessImageFileName =
/(?i)(lsass|csrss|winlogon|smss|wininit)\.exe$/
| TrustedSecurity := SourceProcessImageFileName =
/(?i)(MsMpEng|SenseIR|SenseCnC|kavtray|bdservicehost|CylanceSvc|cb)\.exe$/
| filter(HighRiskSource = true OR (ProtectedTarget = true AND TrustedSecurity != true))
| Signal := "InjectionAPI_T1106"
| RiskScore := case {
HighRiskSource = true AND ProtectedTarget = true => 100;
ProtectedTarget = true => 80;
HighRiskSource = true => 60;
* => 40
}
| table(
[_time, ComputerName, UserName, Signal, RiskScore, #event_simpleName,
SourceProcessImageFileName, SourceCommandLine,
TargetProcessImageFileName, TargetProcessId],
limit=1000
)
/* Signal 3: ntdll.dll loaded from non-standard path — EDR unhooking */
| union {
#event_simpleName = "ClassifiedModuleLoad"
OR #event_simpleName = "SuspiciousModuleLoad"
| ImageFileName = /(?i)ntdll\.dll$/
| NOT ImageFileName = /(?i)(Windows\\System32|Windows\\SysWOW64|Windows\\WinSxS)/
| Signal := "NtdllUnhook_EDRBypass_T1106"
| RiskScore := 90
| table(
[_time, ComputerName, UserName, Signal, RiskScore, #event_simpleName,
ContextImageFileName, ImageFileName],
limit=1000
)
}
| sort(field=RiskScore, order=desc)
| sort(field=_time, order=desc) Detects T1106 Native API abuse in CrowdStrike Falcon NG-SIEM / LogScale. Signal 1 and 2 cover injection API chains: CreateRemoteThreadV2 for classic remote thread injection, and NT memory API calls (VirtualAllocExApiCall, NtAllocateVirtualMemoryApiCall, WriteProcessMemoryApiCall) from high-risk Office or script interpreter processes, or targeting protected system processes. Signal 3 covers ntdll.dll loaded from paths outside System32/SysWOW64/WinSxS via ClassifiedModuleLoad or SuspiciousModuleLoad events, identifying the SysWhispers-style clean-copy remap technique used to neutralize EDR user-mode hooks before direct syscall execution. Note: SourceProcessImageFileName and TargetProcessImageFileName availability varies by event type — NtAllocate/WriteProcessMemory events may use TargetImageFileName; adjust field names to match your sensor version and FDR schema.
Data Sources
Required Tables
False Positives & Tuning
- CrowdStrike Falcon sensor itself performs cross-process memory inspection and may generate matching injection API events — apply SourceProcessImageFileName exclusions for CSFalconService.exe and related Falcon process paths
- JIT compilers and managed runtimes (.NET CLR, JVM, V8/Node.js) perform VirtualAllocEx and WriteProcessMemory calls within their own address space for JIT code emission — correlate with TargetProcessId matching SourceProcessId to filter self-injection
- Windows Subsystem for Linux (WSL2) and Hyper-V virtualization infrastructure use NT memory management APIs across process boundaries that may match injection API event patterns on host systems running WSL2 workloads
Other platforms for T1106
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 1NtAllocateVirtualMemory Direct Call via PowerShell P/Invoke
Expected signal: Sysmon Event ID 1: Process Create for powershell.exe with CommandLine containing 'NtAllocateVirtualMemory'. MDE DeviceEvents: NtAllocateVirtualMemoryApiCall ActionType from the powershell.exe process. PowerShell ScriptBlock Log Event ID 4104: full script content including the DllImport declaration and the API call.
- Test 2Process Injection via NtCreateRemoteThread (C# Executable)
Expected signal: Sysmon Event ID 8 (CreateRemoteThread): SourceImage=powershell.exe, TargetImage=notepad.exe, StartAddress pointing to null (suspended thread with null entry point). Sysmon Event ID 10 (ProcessAccess): SourceImage=powershell.exe, TargetImage=notepad.exe, GrantedAccess=0x1F0FFF. MDE DeviceEvents: CreateRemoteThreadApiCall with InitiatingProcessFileName=powershell.exe.
- Test 3API Unhooking — Remap ntdll.dll from Disk
Expected signal: Sysmon Event ID 7 (ImageLoad): The ntdll.dll module is already loaded, but if the unhooking completed (in a real attack), a second load from a temp path would appear. PowerShell ScriptBlock Log Event ID 4104: full script showing ntdll.dll path access and byte comparison. MDE DeviceFileEvents: ReadFile operation on C:\Windows\System32\ntdll.dll from powershell.exe.
- Test 4Direct Syscall Execution via Inline Assembly (SysWhispers2-style)
Expected signal: If compiled: Sysmon Event ID 1 (Process Create) for syscall_test.exe; Sysmon Event ID 11 (File Create) for the .exe in %TEMP%; MDE DeviceFileEvents for the VirtualAlloc RWX allocation. The byte pattern 4C 8B D1 B8 xx 00 00 00 0F 05 C3 in the allocated memory region is the direct syscall stub signature. If not compiled: PowerShell ScriptBlock Event ID 4104 captures the stub bytes for signature validation.
References (13)
- https://attack.mitre.org/techniques/T1106/
- https://outflank.nl/blog/2019/06/19/red-team-tactics-combining-direct-system-calls-and-srdi-to-bypass-av-edr/
- https://redops.at/en/blog/direct-syscalls-vs-indirect-syscalls
- https://www.cyberbit.com/blog/endpoint-security/malware-mitigation-when-direct-system-calls-are-used/
- https://www.mdsec.co.uk/2020/12/bypassing-user-mode-hooks-and-direct-invocation-of-system-calls-for-red-teams/
- https://github.com/jthuraisamy/SysWhispers2
- https://github.com/klezVirus/SysWhispers3
- https://undocumented.ntinternals.net/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1106/T1106.md
- https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createremotethread
- https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon
- https://docs.microsoft.com/en-us/windows/win32/procthread/process-security-and-access-rights
- https://security.stackexchange.com/questions/270586/direct-system-calls-detection-edr
Unlock Pro Content
Get the full detection package for T1106 including response playbook, investigation guide, and atomic red team tests.