Detection rules › Splunk

Known Process Injection Commands (PowerShell)

Group by
_time, host
Source
github.com/anvilogic-forge/armory

Adversaries may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges. Process injection is a method of executing arbitrary code in the address space of a separate live process. Running code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via process injection may also evade detection from security products since the execution is masked under a legitimate process. This use case detects PowerShell commands associated with process injection.

MITRE ATT&CK coverage

TacticTechniques
Privilege EscalationT1055 Process Injection
StealthT1055 Process Injection

Event coverage

Rule body yaml

id: '15997.23933'
title: Known Process Injection Commands
description: Adversaries may inject code into processes in order to evade process-based
  defenses as well as possibly elevate privileges. Process injection is a method of
  executing arbitrary code in the address space of a separate live process. Running
  code in the context of another process may allow access to the process's memory,
  system/network resources, and possibly elevated privileges. Execution via process
  injection may also evade detection from security products since the execution is
  masked under a legitimate process. This use case detects PowerShell commands associated
  with process injection.
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_powershell` (TERM(EventCode=4103) OR
  "<EventID>4103<" OR TERM(EventCode=4104) OR "<EventID>4104<") ("VirtualAlloc" OR
  "VirtualAllocEx" OR "VirtualProtect" OR "LdrLoadDll" OR "LoadLibrary" OR "LoadLibraryA"
  OR "LoadLibraryEx" OR "GetProcAddress" OR "OpenProcess" OR "OpenProcessToken" OR
  "AdjustTokenPrivileges" OR "WriteProcessMemory" OR "CreateRemoteThread" OR "NtCreateThreadEx"
  OR "CreateThread" OR "QueueUserAPC" OR "SuspendThread" OR "ResumeThread" OR "GetDelegateForFunctionPointer")
  | table _time, host, user process, process_*, signature_id | bin span=1s | stats
  values(*) as * by _time, host '
techniques:
- privilege-escalation:process injection
technique_id: 
- T1055
data_category:
- PowerShell logs
references: null

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_powershell` (TERM(EventCode=4103) OR "<EventID>4103<" OR TERM(EventCode=4104) OR "<EventID>4104<") ("VirtualAlloc" OR "VirtualAllocEx" OR "VirtualProtect" OR "LdrLoadDll" OR "LoadLibrary" OR "LoadLibraryA" OR "LoadLibraryEx" OR "GetProcAddress" OR "OpenProcess" OR "OpenProcessToken" OR "AdjustTokenPrivileges" OR "WriteProcessMemory" OR "CreateRemoteThread" OR "NtCreateThreadEx" OR "CreateThread" OR "QueueUserAPC" OR "SuspendThread" OR "ResumeThread" OR "GetDelegateForFunctionPointer")

Stage 2: table

| table _time, host, user process, process_*, signature_id

Stage 3: bucket

| bin span=1s

Stage 4: stats

| stats values(*) as * by _time, host

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
EventCodeeq
  • 4103 corpus 105 (splunk 105)
  • 4104 corpus 268 (splunk 268)

Search terms

Bare-string tokens in the SPL search body. Splunk matches each token against _raw (the untyped raw event text) anywhere it appears, not against a specific field. These don't surface in the Indicators table because they aren't predicates on a known field.

StageTerm
1TERM
1"<EventID>4103<"
1TERM
1"<EventID>4104<"
1"VirtualAlloc"
1"VirtualAllocEx"
1"VirtualProtect"
1"LdrLoadDll"
1"LoadLibrary"
1"LoadLibraryA"
1"LoadLibraryEx"
1"GetProcAddress"
1"OpenProcess"
1"OpenProcessToken"
1"AdjustTokenPrivileges"
1"WriteProcessMemory"
1"CreateRemoteThread"
1"NtCreateThreadEx"
1"CreateThread"
1"QueueUserAPC"
1"SuspendThread"
1"ResumeThread"
1"GetDelegateForFunctionPointer"