Windows Service Configuration Hjack
Description
Identifies suspicious modification of a Windows service configuration using RPC. Adversaries may use this technique to maintain persistence or run with System privileges avoiding logging related to service creation.
Query · eql
sequence with maxspan=3m
[registry where event.action == "modification" and process.name : "services.exe" and
registry.path : ("HKLM\\SYSTEM\\*ControlSet*\\Services\\*\\ImagePath", "HKLM\\SYSTEM\\ControlSet*\\Services\\*\\Parameters\\ServiceDll")] as event0
[any where
(event.category : "library" and not dll.code_signature.status : "trusted" and stringcontains~(event0.registry.data.strings, dll.path)) or
(event.category : "process" and event.action == "start" and process.parent.name : "services.exe" and stringcontains~(event0.registry.data.strings, process.name))]
[registry where event.action == "modification" and process.name : "services.exe" and
registry.path : ("HKLM\\SYSTEM\\*ControlSet*\\Services\\*\\ImagePath", "HKLM\\SYSTEM\\ControlSet*\\Services\\*\\Parameters\\ServiceDll") and
event0.registry.path == registry.path and registry.data.strings : "?*" and
not stringcontains~(event0.registry.data.strings, registry.data.strings)]