T1106 Splunk · SPL

Detect Native API in Splunk

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/

SPL Detection Query

Splunk (SPL)
spl
// T1106 — Native API abuse: Sysmon-based detection for process injection and cross-process memory access
// Signal 1: CreateRemoteThread (Sysmon Event ID 8) — classic injection finale
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=8
| eval SourceImage=lower(SourceImage)
| eval TargetImage=lower(TargetImage)
| eval HighRiskSource=if(match(SourceImage,
    "(winword\.exe|excel\.exe|powerpnt\.exe|outlook\.exe|mshta\.exe|wscript\.exe|cscript\.exe|regsvr32\.exe|rundll32\.exe|msiexec\.exe)"),
    1, 0)
| eval ProtectedTarget=if(match(TargetImage,
    "(lsass\.exe|csrss\.exe|winlogon\.exe|smss\.exe|wininit\.exe)"),
    1, 0)
| eval TrustedSecurity=if(match(SourceImage,
    "(msmpeng\.exe|senseir\.exe|cavtray\.exe|bdservicehost\.exe|cylancesvc\.exe)"),
    1, 0)
| where (HighRiskSource=1 OR ProtectedTarget=1) AND TrustedSecurity=0
| eval Signal="create_remote_thread"
| eval RiskScore=if(HighRiskSource=1 AND ProtectedTarget=1, 100, if(ProtectedTarget=1, 80, 60))
| table _time, host, User, Signal, RiskScore, SourceImage, SourceCommandLine,
         TargetImage, StartAddress, StartModule, StartFunction
| eval _comment="Signal 1: CreateRemoteThread"
| append
    [ search index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=10
      | eval SourceImage=lower(SourceImage)
      | eval TargetImage=lower(TargetImage)
      | eval GrantedAccess=lower(GrantedAccess)
      | eval InjectRights=if(match(GrantedAccess, "(0x1f[0-9a-f]{4}|0x[0-9a-f]*38[0-9a-f]*|0x[0-9a-f]*28[0-9a-f]*)"), 1, 0)
      | eval ProtectedTarget=if(match(TargetImage, "(lsass\.exe|csrss\.exe|winlogon\.exe)"), 1, 0)
      | eval HighRiskSource=if(match(SourceImage,
            "(winword\.exe|excel\.exe|powerpnt\.exe|mshta\.exe|wscript\.exe|cscript\.exe|rundll32\.exe)"),
            1, 0)
      | where InjectRights=1 AND (ProtectedTarget=1 OR HighRiskSource=1)
      | eval Signal="process_access_injection_rights"
      | eval RiskScore=if(ProtectedTarget=1, 90, 65)
      | table _time, host, User, Signal, RiskScore, SourceImage, SourceCommandLine,
               TargetImage, GrantedAccess ]
| sort - RiskScore _time
high severity medium confidence

Detects Native API process injection using two Sysmon event types. Signal 1 uses Event ID 8 (CreateRemoteThread) to catch the final step of process injection — a thread created in a remote process — from high-risk initiators (Office apps, script interpreters) or into protected processes (lsass, csrss, winlogon). Signal 2 uses Event ID 10 (ProcessAccess) to detect cross-process handle opens with injection-capable access rights (PROCESS_VM_WRITE 0x0020 + PROCESS_VM_OPERATION 0x0008 = 0x0028, or PROCESS_ALL_ACCESS). A risk score of 100 is assigned when both conditions are true (high-risk source AND protected target). Results are sorted by risk score to prioritize highest-severity events.

Data Sources

Process: OS API ExecutionProcess: Process AccessSysmon Event ID 8 (CreateRemoteThread)Sysmon Event ID 10 (ProcessAccess)

Required Sourcetypes

XmlWinEventLog:Microsoft-Windows-Sysmon/Operational

False Positives & Tuning

  • Security products using CreateRemoteThread for legitimate injection (AV in-memory scanning, DLP agents) — add TrustedSecurity exclusion list per environment
  • Game anti-cheat engines injecting into game processes on workstations designated for gaming
  • Debuggers (Visual Studio, WinDbg) performing cross-process inspection with full access rights on developer machines
  • Monitoring tools (Process Monitor, VMware Tools) accessing process memory for diagnostic or virtualization purposes
  • Software installers that briefly inject into other processes for configuration patching during installation
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