Detection rules › Elastic
Suspicious Executable Memory Permission Modification
Identifies suspicious memory permission modification from read and execute R-X to read only. This may indicate an attempt to hide executable code while in sleep state.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule body
[rule]
description = """
Identifies suspicious memory permission modification from read and execute R-X to read only. This may indicate an
attempt to hide executable code while in sleep state.
"""
id = "c6e63ef1-e2d8-4703-80c7-a544f2aa5c6e"
license = "Elastic License v2"
name = "Suspicious Executable Memory Permission Modification"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/doubling-down-etw-callstacks"]
version = "1.0.16"
query = '''
api where process.Ext.api.name == "VirtualProtect" and process.executable != null and
process.Ext.api.parameters.protection == "R--" and process.Ext.api.parameters.protection_old == "R-X" and
process.thread.Ext.call_stack_summary : "?*" and
not (process.code_signature.subject_name : ("Electronic Arts, Inc.", "Activision Publishing Inc") and process.code_signature.trusted == true) and
process.thread.Ext.call_stack_final_user_module.name : "Unbacked" and
not process.thread.Ext.call_stack_final_user_module.name : ("Kernel", "Unknown", "Undetermined") and
not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("Kernel", "Kernel|*", "hmpalert.dll", "Unknown", "Unbacked") and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.protection_provenance : ("Kernel", "Kernel|*")) and
not process.thread.Ext.call_stack_final_user_module.path :
("?:\\windows\\system32\\apphelp.dll",
"?:\\windows\\syswow64\\apphelp.dll",
"?:\\windows\\microsoft.net\\framework*\\clr.dll",
"?:\\program files\\dotnet\\shared\\microsoft.netcore.app\\*\\coreclr.dll") and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 :
("f7c78dba07128af325d8da99138ebf78be163ecfb5da5b01fa6b65b96efecef1",
"ca6079aadef0e98ee94f59babe8d67c0412829a42581c7884659a2737833b83e",
"14ddc0fed1748f89318fbdc59c092e9891feffe5175ef22991b6a794fe539dc3",
"6ad6c03ac893bce8aeb65362c7615b7c74d457276ce6bdcde40a110178267fa3",
"f7c78dba07128af325d8da99138ebf78be163ecfb5da5b01fa6b65b96efecef1",
"e0f97f4ca158dc6de279467dd469b7d9da6613de64c7e5ed34bdd9d358dd8a90",
"b8962adcfb27934ff93f7fffe306e1f01b9342305e883443896204e24c68290b") and
not (process.code_signature.trusted == true and process.code_signature.subject_name : "Roblox Corporation") and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature,
$entry, $entry.subject_name: ("Bitdefender SRL", "Google LLC", "Mozilla Corporation", "Adobe Inc.") and $entry.status : "trusted") and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.callsite_trailing_bytes : "85c00f856a010000b84d5a00006639070f855c0100004889b424a8000000488d45e84863773c4c8d45e04803f748c745e00801000041b920000000488975d848") and
not (process.parent.executable : "C:\\Program Files (x86)\\Outline\\OutlineService.exe" and process.executable : "C:\\Windows\\SysWOW64\\netsh.exe") and
not (process.parent.executable : ("C:\\Program Files (x86)\\CyberCNSAgentV2\\cybercnsagentv2.exe", "C:\\Program Files (x86)\\CyberCNSAgent\\cybercnsagent.exe") and
process.executable : "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe") and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.symbol_info like ("c:\\windows\\system32\\ntdll.dll!LdrResolveDelayLoadedAPI*",
"c:\\windows\\system32\\ntdll.dll!LdrShutdownProcess*"))
'''
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.name == "VirtualProtect" and process.executable != null and
process.Ext.api.parameters.protection == "R--" and process.Ext.api.parameters.protection_old == "R-X" and
process.thread.Ext.call_stack_summary : "?*" and
not (process.code_signature.subject_name : ("Electronic Arts, Inc.", "Activision Publishing Inc") and process.code_signature.trusted == true) and
process.thread.Ext.call_stack_final_user_module.name : "Unbacked" and
not process.thread.Ext.call_stack_final_user_module.name : ("Kernel", "Unknown", "Undetermined") and
not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("Kernel", "Kernel|*", "hmpalert.dll", "Unknown", "Unbacked") and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.protection_provenance : ("Kernel", "Kernel|*")) and
not process.thread.Ext.call_stack_final_user_module.path :
("?:\\windows\\system32\\apphelp.dll",
"?:\\windows\\syswow64\\apphelp.dll",
"?:\\windows\\microsoft.net\\framework*\\clr.dll",
"?:\\program files\\dotnet\\shared\\microsoft.netcore.app\\*\\coreclr.dll") and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 :
("f7c78dba07128af325d8da99138ebf78be163ecfb5da5b01fa6b65b96efecef1",
"ca6079aadef0e98ee94f59babe8d67c0412829a42581c7884659a2737833b83e",
"14ddc0fed1748f89318fbdc59c092e9891feffe5175ef22991b6a794fe539dc3",
"6ad6c03ac893bce8aeb65362c7615b7c74d457276ce6bdcde40a110178267fa3",
"f7c78dba07128af325d8da99138ebf78be163ecfb5da5b01fa6b65b96efecef1",
"e0f97f4ca158dc6de279467dd469b7d9da6613de64c7e5ed34bdd9d358dd8a90",
"b8962adcfb27934ff93f7fffe306e1f01b9342305e883443896204e24c68290b") and
not (process.code_signature.trusted == true and process.code_signature.subject_name : "Roblox Corporation") and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature,
$entry, $entry.subject_name: ("Bitdefender SRL", "Google LLC", "Mozilla Corporation", "Adobe Inc.") and $entry.status : "trusted") and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.callsite_trailing_bytes : "85c00f856a010000b84d5a00006639070f855c0100004889b424a8000000488d45e84863773c4c8d45e04803f748c745e00801000041b920000000488975d848") and
not (process.parent.executable : "C:\\Program Files (x86)\\Outline\\OutlineService.exe" and process.executable : "C:\\Windows\\SysWOW64\\netsh.exe") and
not (process.parent.executable : ("C:\\Program Files (x86)\\CyberCNSAgentV2\\cybercnsagentv2.exe", "C:\\Program Files (x86)\\CyberCNSAgent\\cybercnsagent.exe") and
process.executable : "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe") and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.symbol_info like ("c:\\windows\\system32\\ntdll.dll!LdrResolveDelayLoadedAPI*",
"c:\\windows\\system32\\ntdll.dll!LdrShutdownProcess*"))
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 | |
process.code_signature.subject_name | eq | Electronic Arts, Inc., Activision Publishing Inc | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Electronic Arts, Inc." field:"process.code_signature.subject_name" value:"Activision Publishing Inc" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.code_signature.subject_name | eq | Roblox Corporation | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Roblox Corporation" |
process.executable | eq | C:\Windows\SysWOW64\netsh.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\SysWOW64\netsh.exe" |
process.parent.executable | eq | C:\Program Files (x86)\Outline\OutlineService.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files (x86)\Outline\OutlineService.exe" |
process.executable | eq | C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" |
process.parent.executable | eq | C:\Program Files (x86)\CyberCNSAgentV2\cybercnsagentv2.exe, C:\Program Files (x86)\CyberCNSAgent\cybercnsagent.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files (x86)\CyberCNSAgentV2\cybercnsagentv2.exe" field:"process.parent.executable" value:"C:\Program Files (x86)\CyberCNSAgent\cybercnsagent.exe" |
process.thread.Ext.call_stack | array_any | excludes:process.thread.Ext.call_stack | |
process.thread.Ext.call_stack_final_user_module.hash.sha256 | eq | f7c78dba07128af325d8da99138ebf78be163ecfb5da5b01fa6b65b96efecef1, ca6079aadef0e98ee94f59babe8d67c0412829a42581c7884659a2737833b83e, 14ddc0fed1748f89318fbdc59c092e9891feffe5175ef22991b6a794fe539dc3, 6ad6c03ac893bce8aeb65362c7615b7c74d457276ce6bdcde40a110178267fa3, f7c78dba07128af325d8da99138ebf78be163ecfb5da5b01fa6b65b96efecef1, e0f97f4ca158dc6de279467dd469b7d9da6613de64c7e5ed34bdd9d358dd8a90, b8962adcfb27934ff93f7fffe306e1f01b9342305e883443896204e24c68290b | excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256 |
process.thread.Ext.call_stack_final_user_module.name | eq | Kernel, Unknown, Undetermined | excludes: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.path | wildcard | ?:\windows\system32\apphelp.dll, ?:\windows\syswow64\apphelp.dll, ?:\windows\microsoft.net\framework*\clr.dll, ?:\program files\dotnet\shared\microsoft.netcore.app\*\coreclr.dll | excludes:process.thread.Ext.call_stack_final_user_module.path |
process.thread.Ext.call_stack_final_user_module.protection_provenance | wildcard | Kernel, Kernel|*, hmpalert.dll, Unknown, Unbacked | excludes:process.thread.Ext.call_stack_final_user_module.protection_provenance |
Indicators
These rows show field, operator, and value matches.