Detection rules › Elastic

Suspicious System Path File Overwrite

Source
github.com/elastic/protections-artifacts

Identifies attempts to overwrite protected Windows system image (PE header) under System32 or SysWOW64. This pattern may indicate exploitation attempting to replace trusted system binaries for privilege escalation.

MITRE ATT&CK coverage

TacticTechniques
Privilege Escalation

Rule body

[rule]
description = """
Identifies attempts to overwrite protected Windows system image (PE header) under System32 or SysWOW64. This pattern may
indicate exploitation attempting to replace trusted system binaries for privilege escalation.
"""
id = "c4e8f2a6-9d1b-4c7e-a3f0-8b2e6d1c5a9f"
license = "Elastic License v2"
name = "Suspicious System Path File Overwrite"
os_list = ["windows"]
version = "1.0.1"

query = '''
file where event.action == "overwrite" and not user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and 
 (file.extension : ("exe", "dll") or file.Ext.header_bytes like "4d5a*") and 
 process.thread.Ext.call_stack_summary like "ntdll.dll*" and not process.thread.Ext.call_stack_summary like "ntdll.dll*|kernelbase.dll|*" and 
 file.path : ("C:\\Windows\\System32\\*", 
              "C:\\Windows\\SysWOW64\\*", 
              "C:\\Program Files (x86)\\Microsoft\\*", 
              "C:\\Program Files\\Microsoft\\*", 
              "C:\\Program Files\\Windows*",  
              "C:\\Program Files (x86)\\Windows*") and 
 _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like "C:\\Windows\\System32\\ntdll.dll!NtCreateFile*") and 
 not process.executable : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*") and 
 not (process.code_signature.subject_name : ("Zebra Technologies Corporation", "Zebra Technologies Corporation", "Euro Plus d.o.o.", "Amyuni Technologies, Inc.", "Amyuni Technologies, Inc.") and 
      process.code_signature.trusted == true) and 
 not file.path : ("C:\\WINDOWS\\system32\\spool\\DRIVERS\\x64\\*", 
                  "C:\\WINDOWS\\system32\\Drivers\\*",
                  "C:\\WINDOWS\\SysWOW64\\RongtaUSBMonUI.dll", 
                  "C:\\WINDOWS\\SysWOW64\\RongtaUSBMon.dll", 
                  "C:\\WINDOWS\\system32\\RongtaUSBMonUI.dll", 
                  "C:\\Windows\\SysWOW64\\CyberInstallerUninstallerSystem\\*.dll")
'''

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"


[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

[internal]
min_endpoint_version = "8.15.0"

Stages and Predicates

Stage 1: file

file where event.action == "overwrite" and not user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and 
 (file.extension : ("exe", "dll") or file.Ext.header_bytes like "4d5a*") and 
 process.thread.Ext.call_stack_summary like "ntdll.dll*" and not process.thread.Ext.call_stack_summary like "ntdll.dll*|kernelbase.dll|*" and 
 file.path : ("C:\\Windows\\System32\\*", 
              "C:\\Windows\\SysWOW64\\*", 
              "C:\\Program Files (x86)\\Microsoft\\*", 
              "C:\\Program Files\\Microsoft\\*", 
              "C:\\Program Files\\Windows*",  
              "C:\\Program Files (x86)\\Windows*") and 
 _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like "C:\\Windows\\System32\\ntdll.dll!NtCreateFile*") and 
 not process.executable : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*") and 
 not (process.code_signature.subject_name : ("Zebra Technologies Corporation", "Zebra Technologies Corporation", "Euro Plus d.o.o.", "Amyuni Technologies, Inc.", "Amyuni Technologies, Inc.") and 
      process.code_signature.trusted == true) and 
 not file.path : ("C:\\WINDOWS\\system32\\spool\\DRIVERS\\x64\\*", 
                  "C:\\WINDOWS\\system32\\Drivers\\*",
                  "C:\\WINDOWS\\SysWOW64\\RongtaUSBMonUI.dll", 
                  "C:\\WINDOWS\\SysWOW64\\RongtaUSBMon.dll", 
                  "C:\\WINDOWS\\system32\\RongtaUSBMonUI.dll", 
                  "C:\\Windows\\SysWOW64\\CyberInstallerUninstallerSystem\\*.dll")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_nameeqZebra Technologies Corporation, Zebra Technologies Corporation, Euro Plus d.o.o., Amyuni Technologies, Inc., Amyuni Technologies, Inc.excludes:process.code_signature.subject_name
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
file.pathwildcardC:\WINDOWS\system32\spool\DRIVERS\x64\*, C:\WINDOWS\system32\Drivers\*, C:\WINDOWS\SysWOW64\RongtaUSBMonUI.dll, C:\WINDOWS\SysWOW64\RongtaUSBMon.dll, C:\WINDOWS\system32\RongtaUSBMonUI.dll, C:\Windows\SysWOW64\CyberInstallerUninstallerSystem\*.dllexcludes:file.path
process.executablestarts_with?:\Program Files\, ?:\Program Files (x86)\excludes:process.executable field:"process.executable" value:"?:\Program Files\" field:"process.executable" value:"?:\Program Files (x86)\"
process.thread.Ext.call_stack_summarywildcardntdll.dll*|kernelbase.dll|*excludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll*|kernelbase.dll|*"
user.idinS-1-5-18, S-1-5-19, S-1-5-20excludes:user.id field:"user.id" value:"S-1-5-18" field:"user.id" value:"S-1-5-19" field:"user.id" value:"S-1-5-20"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • overwrite corpus 8 (elastic 8)
field:"EventType" kind:eq value:"overwrite"
file.Ext.header_byteswildcard
  • 4d5a* corpus 46 (elastic 46)
field:"file.Ext.header_bytes" kind:wildcard value:"4d5a*"
file.extensionwildcard
  • dll corpus 33 (elastic 33)
  • exe corpus 32 (elastic 32)
field:"file.extension" kind:wildcard
file.pathwildcard
  • C:\Program Files (x86)\Microsoft\*
  • C:\Program Files (x86)\Windows*
  • C:\Program Files\Microsoft\*
  • C:\Program Files\Windows*
  • C:\Windows\SysWOW64\*
  • C:\Windows\System32\* corpus 2 (sigma 1, elastic 1)
field:"TargetFilename" kind:wildcard
process.thread.Ext.call_stack_summarywildcard
  • ntdll.dll* corpus 4 (elastic 4)
field:"process.thread.Ext.call_stack_summary" kind:wildcard value:"ntdll.dll*"