T1106

Native API

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.

Microsoft Sentinel / Defender
kusto
// T1106 — Native API abuse: cross-process injection and direct NT API usage
// Signal 1: CreateRemoteThread API calls from suspicious initiating processes
let HighRiskParents = dynamic(["winword.exe", "excel.exe", "powerpnt.exe", "outlook.exe",
  "mshta.exe", "wscript.exe", "cscript.exe", "regsvr32.exe", "rundll32.exe",
  "msiexec.exe", "werfault.exe", "explorer.exe"]);
let ProtectedTargets = dynamic(["lsass.exe", "csrss.exe", "winlogon.exe", "smss.exe", "wininit.exe"]);
let TrustedSecurityTools = dynamic(["MsMpEng.exe", "SenseIR.exe", "SenseCnC.exe", "kavtray.exe",
  "bdservicehost.exe", "CylanceSvc.exe", "cb.exe"]);
let InjectionEvents =
    DeviceEvents
    | where Timestamp > ago(24h)
    | where ActionType in~ ("CreateRemoteThreadApiCall", "MemoryRemoteProtect",
                            "NtAllocateVirtualMemoryApiCall", "InjectIntoProcess")
    | extend TargetProcess = tostring(AdditionalFields.TargetProcessName)
    | extend GrantedAccess = tostring(AdditionalFields.GrantedAccess)
    | where
        // Office/script interpreters injecting into anything
        InitiatingProcessFileName has_any (HighRiskParents)
        // Any process injecting into security-critical system processes
        or (TargetProcess has_any (ProtectedTargets)
            and not (InitiatingProcessFileName has_any (TrustedSecurityTools)))
    | extend Signal = "cross_process_injection"
    | project Timestamp, DeviceName, AccountName, Signal, ActionType,
              InitiatingProcessFileName, InitiatingProcessCommandLine,
              InitiatingProcessParentFileName, TargetProcess, GrantedAccess,
              InitiatingProcessId, AdditionalFields;
// Signal 2: ntdll.dll loaded from non-standard path (API unhooking technique)
let UnhookingEvents =
    DeviceImageLoadEvents
    | where Timestamp > ago(24h)
    | where FileName =~ "ntdll.dll"
    | where not (FolderPath has_any ("\\Windows\\System32\\", "\\Windows\\SysWOW64\\",
                                     "\\Windows\\WinSxS\\"))
    | extend Signal = "ntdll_unhooking"
    | project Timestamp, DeviceName, AccountName, Signal,
              ActionType = "ImageLoad", InitiatingProcessFileName,
              InitiatingProcessCommandLine, InitiatingProcessParentFileName,
              TargetProcess = "", GrantedAccess = "",
              InitiatingProcessId, AdditionalFields = todynamic(pack("DllPath", FolderPath));
union InjectionEvents, UnhookingEvents
| sort by Timestamp desc
high severity medium confidence

Data Sources

Process: Process Creation Process: OS API Execution Module: Module Load Microsoft Defender for Endpoint

Required Tables

DeviceEvents DeviceImageLoadEvents

False Positives

  • Endpoint security products (AV, EDR, DLP agents) that legitimately use process injection for in-memory scanning or API hooking — exclude by InitiatingProcessFileName matching known security vendor executables
  • Game anti-cheat engines (BattlEye, EasyAntiCheat, Vanguard) that inject into game processes for integrity monitoring — baseline these on gaming workstations
  • Software DRM and licensing systems that use code injection to verify license state at runtime
  • Legitimate debuggers (WinDbg, x64dbg, Visual Studio debugger) that use NtOpenProcess and write memory for debugging — expected on developer machines
  • Virtualization and sandboxing tools (VMware Tools, VirtualBox Guest Additions) that load modified ntdll copies or interact with process memory for guest-host communication

Unlock Pro Content

Get the full detection package for T1106 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections