Detection rules › Elastic

Suspicious Okta Agent Cross Process Activity

Source
github.com/elastic/protections-artifacts

Identifies attempt to perform code injection targeting OKTA related agent and service processes.

MITRE ATT&CK coverage

TacticTechniques
Stealth

Rule body

[rule]
description = "Identifies attempt to perform code injection targeting OKTA related agent and service processes."
id = "137c9bcd-6be7-4a60-9a06-4e22eb70eded"
license = "Elastic License v2"
name = "Suspicious Okta Agent Cross Process Activity"
os_list = ["windows"]
reference = [
    "https://www.elastic.co/security-labs/monitoring-okta-threats-with-elastic-security",
    "https://www.elastic.co/security-labs/okta-and-lapsus-what-you-need-to-know",
]
version = "1.0.5"

query = '''
api where
 process.Ext.api.behaviors : "cross-process" and process.Ext.api.name : ("WriteProcessMemory", "VirtualProtectEx", "ReadProcessMemory") and
 process.Ext.api.summary : ("*OktaVerify.exe*", "*OktaAgentService.exe*") and not process.Ext.api.behaviors : "parent-child" and
 process.Ext.api.metadata.target_address_name : "?*" and
 not process.Ext.api.metadata.target_address_name in ("PEB", "PEB32", "ProcessStartupInfo") and
 not process.thread.Ext.call_stack_final_user_module.name : ("Kernel", "Unknown", "Undetermined") and
 not (process.code_signature.status : "trusted" and startswith~(process.thread.Ext.call_stack_final_user_module.name, process.name)) and
 not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "?:\\windows\\sys*\\kernelbase.dll!CreateProcess*") and
 not process.thread.Ext.call_stack_final_user_module.path :
                              ("?:\\Program Files\\*.dll",
                               "?:\\Program Files (x86)\\*.dll",
                               "\\Program Files\\*.dll",
                               "\\Program Files (x86)\\*.dll",
                               "\\windows\\system32\\*.dll",
                               "\\windows\\syswow64\\*.dll",
                               "?:\\windows\\system32\\*.dll",
                               "?:\\Windows\\SysWOW64\\*.dll",
                               "?:\\Windows\\FireEye\\AppMonitorDll*.dll*",
                               "?:\\Windows\\apppatch\\AppPatch*\\exploitblocker.dll*")
'''

min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"


[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "8.10.0"

Stages and Predicates

Stage 1: api

api where
 process.Ext.api.behaviors : "cross-process" and process.Ext.api.name : ("WriteProcessMemory", "VirtualProtectEx", "ReadProcessMemory") and
 process.Ext.api.summary : ("*OktaVerify.exe*", "*OktaAgentService.exe*") and not process.Ext.api.behaviors : "parent-child" and
 process.Ext.api.metadata.target_address_name : "?*" and
 not process.Ext.api.metadata.target_address_name in ("PEB", "PEB32", "ProcessStartupInfo") and
 not process.thread.Ext.call_stack_final_user_module.name : ("Kernel", "Unknown", "Undetermined") and
 not (process.code_signature.status : "trusted" and startswith~(process.thread.Ext.call_stack_final_user_module.name, process.name)) and
 not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "?:\\windows\\sys*\\kernelbase.dll!CreateProcess*") and
 not process.thread.Ext.call_stack_final_user_module.path :
                              ("?:\\Program Files\\*.dll",
                               "?:\\Program Files (x86)\\*.dll",
                               "\\Program Files\\*.dll",
                               "\\Program Files (x86)\\*.dll",
                               "\\windows\\system32\\*.dll",
                               "\\windows\\syswow64\\*.dll",
                               "?:\\windows\\system32\\*.dll",
                               "?:\\Windows\\SysWOW64\\*.dll",
                               "?:\\Windows\\FireEye\\AppMonitorDll*.dll*",
                               "?:\\Windows\\apppatch\\AppPatch*\\exploitblocker.dll*")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.statuseqtrustedexcludes:process.code_signature.status field:"process.code_signature.status" value:"trusted"
process.thread.Ext.call_stack_final_user_module.namestarts_withprocess.nameexcludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"process.name"
process.thread.Ext.call_stackarray_any(no value, null check)excludes:process.thread.Ext.call_stack
process.Ext.api.behaviorseqparent-childexcludes:process.Ext.api.behaviors field:"process.Ext.api.behaviors" value:"parent-child"
process.Ext.api.metadata.target_address_nameinPEB, PEB32, ProcessStartupInfoexcludes:process.Ext.api.metadata.target_address_name field:"process.Ext.api.metadata.target_address_name" value:"PEB" field:"process.Ext.api.metadata.target_address_name" value:"PEB32" field:"process.Ext.api.metadata.target_address_name" value:"ProcessStartupInfo"
process.thread.Ext.call_stack_final_user_module.nameeqKernel, Unknown, Undeterminedexcludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"Kernel" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Unknown" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Undetermined"
process.thread.Ext.call_stack_final_user_module.pathwildcard?:\Program Files\*.dll, ?:\Program Files (x86)\*.dll, \Program Files\*.dll, \Program Files (x86)\*.dll, \windows\system32\*.dll, \windows\syswow64\*.dll, ?:\windows\system32\*.dll, ?:\Windows\SysWOW64\*.dll, ?:\Windows\FireEye\AppMonitorDll*.dll*, ?:\Windows\apppatch\AppPatch*\exploitblocker.dll*excludes:process.thread.Ext.call_stack_final_user_module.path

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
process.Ext.api.behaviorswildcard
  • cross-process corpus 20 (elastic 20)
field:"process.Ext.api.behaviors" kind:wildcard value:"cross-process"
process.Ext.api.metadata.target_address_namewildcard
  • ?* corpus 3 (elastic 3)
field:"process.Ext.api.metadata.target_address_name" kind:wildcard value:"?*"
process.Ext.api.namewildcard
  • ReadProcessMemory
  • VirtualProtectEx corpus 3 (elastic 3)
  • WriteProcessMemory corpus 4 (elastic 4)
field:"process.Ext.api.name" kind:wildcard
process.Ext.api.summarywildcard
  • *OktaAgentService.exe*
  • *OktaVerify.exe*
field:"process.Ext.api.summary" kind:wildcard