Detection rules › Elastic
Potential Unbacked Memory Content Masking
Detects multiple Windows Memory API calls to modify the protection of the same memory address in a short time window.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule body
[rule]
description = "Detects multiple Windows Memory API calls to modify the protection of the same memory address in a short time window."
id = "358b23e4-ed82-454f-9351-69f5844e7da9"
license = "Elastic License v2"
name = "Potential Unbacked Memory Content Masking"
os_list = ["windows"]
version = "1.0.6"
query = '''
sequence by process.entity_id, process.Ext.api.parameters.size, process.Ext.api.parameters.address with maxspan=60s
[api where process.Ext.api.name == "VirtualProtect" and
process.Ext.api.summary : "*Unbacked*" and process.Ext.api.parameters.size >= 100000 and
process.Ext.api.behaviors == "execute_fluctuation" and process.Ext.api.behaviors == "allocate_shellcode" and
process.thread.Ext.call_stack_final_user_module.name != "Kernel" and
process.thread.Ext.call_stack_final_user_module.hash.sha256 != "eed60fb1abc328b156313abdc5e44389d25e59ffb3c1eb9353baf611c2c7147d" and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and $entry.subject_name == "Activision Publishing Inc")]
[api where process.Ext.api.name == "VirtualProtect" and
process.Ext.api.summary : "*Unbacked*" and process.Ext.api.parameters.size >= 100000 and
process.Ext.api.behaviors == "execute_fluctuation" and process.Ext.api.behaviors == "allocate_shellcode"]
'''
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
Ordered sequence: each step below must occur in order within 1m, correlated by process.Ext.api.parameters.address, process.Ext.api.parameters.size, process.entity_id.
Stage 1: api
[api where process.Ext.api.name == "VirtualProtect" and
process.Ext.api.summary : "*Unbacked*" and process.Ext.api.parameters.size >= 100000 and
process.Ext.api.behaviors == "execute_fluctuation" and process.Ext.api.behaviors == "allocate_shellcode" and
process.thread.Ext.call_stack_final_user_module.name != "Kernel" and
process.thread.Ext.call_stack_final_user_module.hash.sha256 != "eed60fb1abc328b156313abdc5e44389d25e59ffb3c1eb9353baf611c2c7147d" and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and $entry.subject_name == "Activision Publishing Inc")]
Stage 2: api
[api where process.Ext.api.name == "VirtualProtect" and
process.Ext.api.summary : "*Unbacked*" and process.Ext.api.parameters.size >= 100000 and
process.Ext.api.behaviors == "execute_fluctuation" and process.Ext.api.behaviors == "allocate_shellcode"]
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.thread.Ext.call_stack_final_user_module.code_signature | array_any | excludes:process.thread.Ext.call_stack_final_user_module.code_signature |
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 |
process.Ext.api.name | eq |
| field:"process.Ext.api.name" kind:eq value:"VirtualProtect" |
process.Ext.api.parameters.size | ge |
| field:"process.Ext.api.parameters.size" kind:ge value:"100000" |
process.Ext.api.summary | wildcard |
| field:"process.Ext.api.summary" kind:wildcard value:"*Unbacked*" |
process.thread.Ext.call_stack_final_user_module.hash.sha256 | ne |
| field:"process.thread.Ext.call_stack_final_user_module.hash.sha256" kind:ne value:"eed60fb1abc328b156313abdc5e44389d25e59ffb3c1eb9353baf611c2c7147d" |
process.thread.Ext.call_stack_final_user_module.name | ne |
| field:"process.thread.Ext.call_stack_final_user_module.name" kind:ne value:"Kernel" |