Detection rules › Elastic
Suspicious Windows NT API Hooking
Identifies attempts to hook certain memory section mapping related APIs with suspicious properties. This may indicate an attempt to evade defense leveraging API hooking.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule body
[rule]
description = """
Identifies attempts to hook certain memory section mapping related APIs with suspicious properties. This may indicate an
attempt to evade defense leveraging API hooking.
"""
id = "63f3d1c5-7e19-48db-965d-cc2a52e96650"
license = "Elastic License v2"
name = "Suspicious Windows NT API Hooking"
os_list = ["windows"]
version = "1.0.5"
query = '''
api where process.Ext.api.name == "WriteProcessMemory" and process.Ext.api.behaviors == "hook_api" and
process.Ext.api.summary : "* Self,*" and
process.Ext.api.summary like
("*ntdll.dll!??CreateSection*", "*ntdll.dll!??OpenSection*", "*ntdll.dll!??Close*", "*ntdll.dll!??MapViewOfSection*", "*ntdll.dll!??UnmapViewOfSection*") and
process.Ext.api.parameters.size == 21 and
not process.Ext.api.behaviors in ("cross-process", "parent-child") and process.thread.Ext.call_stack_final_user_module.name != "Kernel" and
not (process.code_signature.status == "trusted" and startswith~(process.thread.Ext.call_stack_final_user_module.name, process.name)) and
not process.thread.Ext.call_stack_final_user_module.path like
("?:\\program files\\*.dll",
"?:\\program files (x86)\\*.dll",
"\\program files\\*.dll",
"\\program files (x86)\\*.dll",
"?:\\windows\\sys?????\\hmpalert.dll",
"?:\\windows\\system32\\*\\tmmon*.dll*",
"?:\\windows\\sys?????\\esensordbi.dll*",
"?:\\windows\\system32\\umppc*.dll*",
"?:\\windows\\fireeye\\appmonitordll*.dll*",
"?:\\windows\\apppatch\\apppatch*\\exploitblocker.dll*")
'''
min_endpoint_version = "8.10.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
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.name == "WriteProcessMemory" and process.Ext.api.behaviors == "hook_api" and
process.Ext.api.summary : "* Self,*" and
process.Ext.api.summary like
("*ntdll.dll!??CreateSection*", "*ntdll.dll!??OpenSection*", "*ntdll.dll!??Close*", "*ntdll.dll!??MapViewOfSection*", "*ntdll.dll!??UnmapViewOfSection*") and
process.Ext.api.parameters.size == 21 and
not process.Ext.api.behaviors in ("cross-process", "parent-child") and process.thread.Ext.call_stack_final_user_module.name != "Kernel" and
not (process.code_signature.status == "trusted" and startswith~(process.thread.Ext.call_stack_final_user_module.name, process.name)) and
not process.thread.Ext.call_stack_final_user_module.path like
("?:\\program files\\*.dll",
"?:\\program files (x86)\\*.dll",
"\\program files\\*.dll",
"\\program files (x86)\\*.dll",
"?:\\windows\\sys?????\\hmpalert.dll",
"?:\\windows\\system32\\*\\tmmon*.dll*",
"?:\\windows\\sys?????\\esensordbi.dll*",
"?:\\windows\\system32\\umppc*.dll*",
"?:\\windows\\fireeye\\appmonitordll*.dll*",
"?:\\windows\\apppatch\\apppatch*\\exploitblocker.dll*")
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.status | eq | trusted | excludes:process.code_signature.status field:"process.code_signature.status" value:"trusted" |
process.thread.Ext.call_stack_final_user_module.name | starts_with | process.name | excludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"process.name" |
process.Ext.api.behaviors | in | cross-process, parent-child | excludes:process.Ext.api.behaviors field:"process.Ext.api.behaviors" value:"cross-process" field:"process.Ext.api.behaviors" value:"parent-child" |
process.thread.Ext.call_stack_final_user_module.path | wildcard | ?:\program files\*.dll, ?:\program files (x86)\*.dll, \program files\*.dll, \program files (x86)\*.dll, ?:\windows\sys?????\hmpalert.dll, ?:\windows\system32\*\tmmon*.dll*, ?:\windows\sys?????\esensordbi.dll*, ?:\windows\system32\umppc*.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.
| Field | Kind | Values | Search |
|---|---|---|---|
process.Ext.api.behaviors | eq |
| field:"process.Ext.api.behaviors" kind:eq value:"hook_api" |
process.Ext.api.name | eq |
| field:"process.Ext.api.name" kind:eq value:"WriteProcessMemory" |
process.Ext.api.parameters.size | eq |
| field:"process.Ext.api.parameters.size" kind:eq value:"21" |
process.Ext.api.summary | wildcard |
| field:"process.Ext.api.summary" kind:wildcard |
process.thread.Ext.call_stack_final_user_module.name | ne |
| field:"process.thread.Ext.call_stack_final_user_module.name" kind:ne value:"Kernel" |