T1106 Google Chronicle · YARA-L

Detect Native API in Google Chronicle

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/

YARA-L Detection Query

Google Chronicle (YARA-L)
yaral
rule t1106_native_api_abuse {
  meta:
    author = "Detection Engineering"
    description = "Detects T1106 Native API abuse: process injection via CreateRemoteThread/ProcessAccess and ntdll EDR unhooking via clean-copy remap"
    mitre_attack_technique = "T1106"
    mitre_attack_tactic = "Execution"
    severity = "HIGH"
    confidence = "HIGH"
    rule_version = "1.0"
    platforms = "Windows"

  events:
    (
      /* Signal 1 & 2: Process injection into high-value targets or from high-risk initiators */
      (
        $e.metadata.event_type = "PROCESS_INJECTION"
        and (
          re.regex($e.principal.process.file.full_path,
            `(?i)(winword|excel|powerpnt|outlook|mshta|wscript|cscript|regsvr32|rundll32|msiexec)\.exe$`)
          or (
            re.regex($e.target.process.file.full_path,
              `(?i)(lsass|csrss|winlogon|smss|wininit)\.exe$`)
            and not re.regex($e.principal.process.file.full_path,
              `(?i)(MsMpEng|SenseIR|SenseCnC|kavtray|bdservicehost|CylanceSvc|cb)\.exe$`)
          )
        )
      )
      or
      /* Signal 3: ntdll.dll loaded from non-standard path — EDR hook removal */
      (
        $e.metadata.event_type = "PROCESS_MODULE_LOAD"
        and re.regex($e.target.file.full_path, `(?i)ntdll\.dll$`)
        and not re.regex($e.target.file.full_path,
          `(?i)(Windows.(System32|SysWOW64|WinSxS).+ntdll\.dll)`)
      )
    )

  condition:
    $e
}
high severity high confidence

Chronicle YARA-L 2.0 rule detecting T1106 Native API abuse in two signal groups: (1) PROCESS_INJECTION events where the initiating process is a high-risk Office or scripting host, or where the target process is a protected system process (lsass, csrss, winlogon, smss, wininit) and the initiator is not a known trusted security tool; (2) PROCESS_MODULE_LOAD events where ntdll.dll is loaded from a path outside System32, SysWOW64, or WinSxS, indicating the clean-copy ntdll remap technique used by SysWhispers and similar direct-syscall frameworks to remove EDR user-mode hooks. Requires Sysmon telemetry ingested and parsed into Chronicle UDM; PROCESS_INJECTION covers both Sysmon EID 8 (CreateRemoteThread) and EID 10 (ProcessAccess) depending on the parser version.

Data Sources

Chronicle SIEMChronicle Forwarder with SysmonGoogle Security Operations UDM

Required Tables

UDM — PROCESS_INJECTION and PROCESS_MODULE_LOAD event types

False Positives & Tuning

  • Endpoint security software using PROCESS_INJECTION patterns for legitimate memory scanning — add 'and not re.regex($e.principal.process.file.full_path, ...)' exclusions for known EDR vendor install paths
  • Application virtualization platforms (VMware ThinApp, Microsoft App-V) that inject environment shim DLLs into process space as part of application isolation
  • Some .NET profiling and APM agents that load a patched copy of system DLLs from a local cache directory as part of bytecode rewriting — validate against known APM product paths
Download portable Sigma rule (.yml)

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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

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