Detection rules › Elastic

Suspicious File Memory Mapping via Managed .NET

Source
github.com/elastic/protections-artifacts

Identifies attempts to map the content of a file in a memory region with RWX permissions from a Managed .NET application.

MITRE ATT&CK coverage

TacticTechniques
Stealth

Rule body

[rule]
description = """
Identifies attempts to map the content of a file in a memory region with RWX permissions from a Managed .NET
application.
"""
id = "6bd0cf1f-e3b9-4c09-884e-1a722f10326b"
license = "Elastic License v2"
name = "Suspicious File Memory Mapping via Managed .NET"
os_list = ["windows"]
reference = [
    "https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffile2",
    "https://www.elastic.co/security-labs/dissecting-remcos-rat-part-four",
    "https://www.elastic.co/security-labs/doubling-down-etw-callstacks",
]
version = "1.0.3"

query = '''
api where process.Ext.api.name == "MapViewOfFile" and process.Ext.api.parameters.protection == "RWX" and
 process.Ext.api.parameters.size >= 100000 and process.Ext.api.metadata.target_address_name == "Unbacked" and
 process.thread.Ext.call_stack_final_user_module.name == "system.core.ni.dll" and
 not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info :"c:\\windows\\sys?????\\kernelbase.dll!LoadLibrary*")
'''

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

[[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 == "MapViewOfFile" and process.Ext.api.parameters.protection == "RWX" and
 process.Ext.api.parameters.size >= 100000 and process.Ext.api.metadata.target_address_name == "Unbacked" and
 process.thread.Ext.call_stack_final_user_module.name == "system.core.ni.dll" and
 not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info :"c:\\windows\\sys?????\\kernelbase.dll!LoadLibrary*")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.thread.Ext.call_stackarray_any(no value, null check)excludes:process.thread.Ext.call_stack

Indicators

These rows show field, operator, and value matches.