Detection rules › Elastic

Potential Privilege Escalation via Elevated IFileOperation

Time window
1m
Sequence by
dll.path, file.path
Source
github.com/elastic/protections-artifacts

Identifies attempts to elevate privileges by dropping a DLL file via elevated IFileOperation (Rename, Move or Copy) followed by DLL side-loading into a process running with SYSTEM integrity. Attackers may attempt to hijack DLL search order and stealthily execute code with elevated permissions.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies attempts to elevate privileges by dropping a DLL file via elevated IFileOperation (Rename, Move or Copy)
followed by DLL side-loading into a process running with SYSTEM integrity. Attackers may attempt to hijack DLL search
order and stealthily execute code with elevated permissions.
"""
id = "8b4791a8-2355-4f43-8b60-d367b5c2aa51"
license = "Elastic License v2"
name = "Potential Privilege Escalation via Elevated IFileOperation"
os_list = ["windows"]
reference = [
    "https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ifileoperation",
    "https://www.elastic.co/security-labs/Hunting-for-Suspicious-Windows-Libraries-for-Execution-and-Evasion",
]
version = "1.0.34"

query = '''
sequence with maxspan=1m
  [file where event.action in ("creation", "overwrite", "rename", "modification") and

   /* IFileOperation are performed by DllHost */
   process.name : "dllhost.exe" and user.id like ("S-1-5-21*", "S-1-12-*") and

   /* executable file dropped via NewItem, Rename, Move or Copy IFileOperation */
   (file.extension : "dll" or file.Ext.header_bytes : "4d5a*") and

   /* protected system paths usually abused via DLL search order hijack */
   file.path : ("?:\\Windows\\system32\\*",
                "?:\\Windows\\syswow64\\*",
                "?:\\Program Files (x86)\\Microsoft\\*",
                "?:\\Program Files\\Microsoft\\*",
                "?:\\Program Files\\Windows *", 
                "?:\\Program Files (x86)\\Windows *")] by file.path
  [library where
   /* non MS signed */
   process.executable :
               ("?:\\Windows\\system32\\*",
                "?:\\Windows\\syswow64\\*",
                "?:\\Program Files (x86)\\Microsoft\\*",
                "?:\\Program Files\\Microsoft\\*", 
                "?:\\Program Files\\Windows *", 
                "?:\\Program Files (x86)\\Windows *") and
  not (dll.code_signature.subject_name : "Microsoft *" and dll.code_signature.trusted == true) and
  not startswith~(dll.name, process.name) and
  not dll.hash.sha256 :
               ("5177f7b0d88bf122b2b7e94293513cefee82970d8b5697e12821ccbe091c8e15",
                "108c16cecced0112da8095053c4efce83eeca319bf58f83412f8cf7f124a7dd5",
                "ed9ebcff2f6f28511814e726f701ab759398c3132a7382e28dd7c6ed58d32d90")] by dll.path
'''

min_endpoint_version = "7.16.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 1

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.002"
name = "Bypass User Account Control"
reference = "https://attack.mitre.org/techniques/T1548/002/"



[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"



[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "7.16.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by dll.path, file.path.

Stage 1: file

[file where event.action in ("creation", "overwrite", "rename", "modification") and
   process.name : "dllhost.exe" and user.id like ("S-1-5-21*", "S-1-12-*") and
   (file.extension : "dll" or file.Ext.header_bytes : "4d5a*") and
   file.path : ("?:\\Windows\\system32\\*",
                "?:\\Windows\\syswow64\\*",
                "?:\\Program Files (x86)\\Microsoft\\*",
                "?:\\Program Files\\Microsoft\\*",
                "?:\\Program Files\\Windows *",
                "?:\\Program Files (x86)\\Windows *")] by file.path

Stage 2: library

[library where
   process.executable :
               ("?:\\Windows\\system32\\*",
                "?:\\Windows\\syswow64\\*",
                "?:\\Program Files (x86)\\Microsoft\\*",
                "?:\\Program Files\\Microsoft\\*",
                "?:\\Program Files\\Windows *",
                "?:\\Program Files (x86)\\Windows *") and
  not (dll.code_signature.subject_name : "Microsoft *" and dll.code_signature.trusted == true) and
  not startswith~(dll.name, process.name) and
  not dll.hash.sha256 :
               ("5177f7b0d88bf122b2b7e94293513cefee82970d8b5697e12821ccbe091c8e15",
                "108c16cecced0112da8095053c4efce83eeca319bf58f83412f8cf7f124a7dd5",
                "ed9ebcff2f6f28511814e726f701ab759398c3132a7382e28dd7c6ed58d32d90")] by dll.path

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
dll.code_signature.subject_namestarts_withMicrosoft excludes:dll.code_signature.subject_name field:"dll.code_signature.subject_name" value:"Microsoft "
dll.code_signature.trustedeqtrueexcludes:dll.code_signature.trusted field:"dll.code_signature.trusted" value:"true"
dll.hash.sha256eq5177f7b0d88bf122b2b7e94293513cefee82970d8b5697e12821ccbe091c8e15, 108c16cecced0112da8095053c4efce83eeca319bf58f83412f8cf7f124a7dd5, ed9ebcff2f6f28511814e726f701ab759398c3132a7382e28dd7c6ed58d32d90excludes:dll.hash.sha256 field:"dll.hash.sha256" value:"5177f7b0d88bf122b2b7e94293513cefee82970d8b5697e12821ccbe091c8e15" field:"dll.hash.sha256" value:"108c16cecced0112da8095053c4efce83eeca319bf58f83412f8cf7f124a7dd5" field:"dll.hash.sha256" value:"ed9ebcff2f6f28511814e726f701ab759398c3132a7382e28dd7c6ed58d32d90"
dll.namestarts_withprocess.nameexcludes:dll.name field:"dll.name" value:"process.name"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • creation corpus 58 (elastic 58)
  • modification corpus 72 (elastic 72)
  • overwrite corpus 8 (elastic 8)
  • rename corpus 22 (elastic 21, sigma 1)
field:"EventType" kind:in
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)
field:"file.extension" kind:wildcard value:"dll"
file.pathwildcard
  • ?:\Program Files (x86)\Microsoft\* corpus 2 (elastic 2)
  • ?:\Program Files (x86)\Windows *
  • ?:\Program Files\Microsoft\* corpus 2 (elastic 2)
  • ?:\Program Files\Windows *
  • ?:\Windows\system32\* corpus 2 (elastic 2)
  • ?:\Windows\syswow64\* corpus 2 (elastic 2)
field:"TargetFilename" kind:wildcard
process.executablewildcard
  • ?:\Program Files (x86)\Microsoft\* corpus 3 (elastic 3)
  • ?:\Program Files (x86)\Windows * corpus 2 (elastic 2)
  • ?:\Program Files\Microsoft\* corpus 3 (elastic 3)
  • ?:\Program Files\Windows * corpus 2 (elastic 2)
  • ?:\Windows\system32\* corpus 6 (elastic 6)
  • ?:\Windows\syswow64\* corpus 6 (elastic 6)
field:"Image" kind:wildcard
process.namewildcard
  • dllhost.exe corpus 19 (elastic 17, splunk 2)
field:"process_name" kind:wildcard value:"dllhost.exe"
user.idwildcard
  • S-1-12-* corpus 46 (elastic 46)
  • S-1-5-21* corpus 47 (elastic 47)
field:"user.id" kind:wildcard